Using ACTIN with any spectra
In this tutorial we will learn how to use ACTIN for spectrographs other than the ones included or when we only have access to wavelength and flux vectors.
[1]:
from actin2 import ACTIN
actin = ACTIN()
Let’s use the test spectra that come with ACTIN as an example to extract only the wavelength and flux
[2]:
import glob, os
files = glob.glob(os.path.join(os.pardir, "actin2/test/HARPS/HD41248", "*_s1d_A.fits"))
files[0]
[2]:
'../actin2/test/HARPS/HD41248/HARPS.2014-01-24T01:18:06.472_s1d_A.fits'
Now we are going to read this file and retrieve the spectra (in this case already at the stellar rest frame)
[3]:
read_spec = actin.ReadSpec(files[0])
wave = read_spec.spectrum['wave']
flux = read_spec.spectrum['flux']
To calculate indices from a spectrograph that is not included in ACTIN, create a spectrum dictionary with wave and flux keys and a headers dictionary with extra information like the time of observation, target name, etc. (could be empty).
[4]:
spectrum = dict(wave=wave, flux=flux)
headers = dict()
Now we call actin.CalcIndices using the dictionaries and a list of indices with IDs as in the indices table to calculate the indices (to check the table print actin.IndTable().table). The results will be stored in the indices dictionary. Below is an example of an output for the Ca II H&K (aka S-index), I_CaII.
[5]:
indices = actin.CalcIndices(spectrum, headers, ['I_CaII']).indices
indices
[5]:
{'I_CaII': 0.1396179564558526,
'I_CaII_err': 0.0010474713400138317,
'I_CaII_Rneg': 0.00019413458539929707}