In order to measure stellar absorptions, I have developed the mindice code. Written in python, it fits the stellar absorptions for any user-given spectrum with a single command-line.
For example, the code is shipped with an optical spectrum of NGC1052, and running the command:
from mindice import mindice
import numpy as np
spec = np.loadtxt('NGC1052.spec', unpack=True)
mindice(spec[0], spec[1], ind = 'Mgb', plot = True)
You get the Mgb equivalent width:
One can also run the code iteratively, for as many indexes as needed. For example, [MgFe]' can be calculated with:
indexes = ['Mgb', 'Fe5270', 'Fe5335']
EW = {}
for index in indexes:
EW[index] = mindice(spec[0], spec[1], ind=index, plot=False)
MgFe = np.sqrt(EW['Mgb'] * (0.72*EW['Fe5270'] + 0.28*EW['Fe5335']))
The index definitions are in a file called mindice_defs.json, which contain all Lick/IDS (Worthey et al. 1994 ) optical indices, as well as the NIR absorptions from Eftekhari et al. (2021). The user can add their own definitions, as well as edit current ones.
If the input spectra comes with uncertainties, you can pass them with err=spec[2], and the code will also return the standard deviation for the measured index.
The code is open-source, and fully available at https://github.com/luisgdh/mindice.