Telluric Models¶
Similarly to stellar templates, the telluric model is constructed through a manager that will handle the construction and data storage.
The construction of the telluric model follows a recipe:
- Construct a transmittance model from a given source (by default, Telfit)
- Find the wavelength regions in which the transmittance model is smaller than a given percentage of the continuum
- Account for the BERV by either using the +- Maximum yearly variation or by shifting the mask to all BERVS in our dataset.
The following workflow summarizes the main steps in this process:

In [1]:
Copied!
from pathlib import Path
from ASTRA.data_objects import DataClassManager
from ASTRA.data_objects.DataClass import DataClass
from ASTRA.Instruments import ESPRESSO
from ASTRA.template_creation.TelluricModel import TelluricModel
from ASTRA.utils.choices import TELLURIC_CREATION_MODE, TELLURIC_EXTENSION
storage_path = Path("../../tmp")
manager = DataClassManager()
manager.start()
data: DataClass = manager.DataClass(
list(Path("/home/amiguel/spectra_collection/ESPRESSO/proxima").glob("*.fits")),
storage_path=storage_path,
instrument=ESPRESSO,
)
ModelTell = TelluricModel(
usage_mode="individual",
user_configs={
"CREATION_MODE": TELLURIC_CREATION_MODE.telfit,
"EXTENSION_MODE": TELLURIC_EXTENSION.LINES,
},
root_folder_path=storage_path,
)
ModelTell.Generate_Model(
dataClass=data,
telluric_configs={"continuum_percentage_drop": 1},
force_computation=False,
store_templates=True,
)
from pathlib import Path
from ASTRA.data_objects import DataClassManager
from ASTRA.data_objects.DataClass import DataClass
from ASTRA.Instruments import ESPRESSO
from ASTRA.template_creation.TelluricModel import TelluricModel
from ASTRA.utils.choices import TELLURIC_CREATION_MODE, TELLURIC_EXTENSION
storage_path = Path("../../tmp")
manager = DataClassManager()
manager.start()
data: DataClass = manager.DataClass(
list(Path("/home/amiguel/spectra_collection/ESPRESSO/proxima").glob("*.fits")),
storage_path=storage_path,
instrument=ESPRESSO,
)
ModelTell = TelluricModel(
usage_mode="individual",
user_configs={
"CREATION_MODE": TELLURIC_CREATION_MODE.telfit,
"EXTENSION_MODE": TELLURIC_EXTENSION.LINES,
},
root_folder_path=storage_path,
)
ModelTell.Generate_Model(
dataClass=data,
telluric_configs={"continuum_percentage_drop": 1},
force_computation=False,
store_templates=True,
)
After the model is constructed, we can remove the tellurics from all observations at once through
In [2]:
Copied!
data.remove_telluric_features(ModelTell)
data.remove_telluric_features(ModelTell)
A posteriori masking of tellurics¶
ASTRA also allows you to add a telluric mask on top of a previously created stellar template
In [3]:
Copied!
from pathlib import Path
from ASTRA.data_objects import DataClassManager
from ASTRA.data_objects.DataClass import DataClass
from ASTRA.Instruments import ESPRESSO
from ASTRA.template_creation.StellarModel import StellarModel
storage_path = Path("../../tmp")
manager = DataClassManager()
manager.start()
d: DataClass = manager.DataClass(
list(Path("/home/amiguel/spectra_collection/ESPRESSO/proxima").glob("*.fits")),
storage_path=storage_path,
instrument=ESPRESSO,
)
stell = StellarModel(
storage_path,
user_configs={},
)
stell.Generate_Model(
dataClass=d,
template_configs={},
force_computation=False,
)
stellar_template = stell.request_data(d.get_available_subInstruments()[0])
wave, flux, err, mask = stellar_template.get_data_from_spectral_order(order=147)
fig, axis = stellar_template.plot_spectra(
order=147,
return_fig_and_axis=True,
plot_options={"label": "Stellar template without telluric mask"},
)
# Ingest the telluric mask into the stellar template mask
stellar_template.remove_telluric_features(ModelTell)
fig, axis = stellar_template.plot_spectra(
order=147,
fig_and_axis=(fig, axis),
return_fig_and_axis=True,
plot_options={"label": "Template with telluric mask"},
)
axis.legend(ncol=2, loc=4, bbox_to_anchor=(1, 1))
from pathlib import Path
from ASTRA.data_objects import DataClassManager
from ASTRA.data_objects.DataClass import DataClass
from ASTRA.Instruments import ESPRESSO
from ASTRA.template_creation.StellarModel import StellarModel
storage_path = Path("../../tmp")
manager = DataClassManager()
manager.start()
d: DataClass = manager.DataClass(
list(Path("/home/amiguel/spectra_collection/ESPRESSO/proxima").glob("*.fits")),
storage_path=storage_path,
instrument=ESPRESSO,
)
stell = StellarModel(
storage_path,
user_configs={},
)
stell.Generate_Model(
dataClass=d,
template_configs={},
force_computation=False,
)
stellar_template = stell.request_data(d.get_available_subInstruments()[0])
wave, flux, err, mask = stellar_template.get_data_from_spectral_order(order=147)
fig, axis = stellar_template.plot_spectra(
order=147,
return_fig_and_axis=True,
plot_options={"label": "Stellar template without telluric mask"},
)
# Ingest the telluric mask into the stellar template mask
stellar_template.remove_telluric_features(ModelTell)
fig, axis = stellar_template.plot_spectra(
order=147,
fig_and_axis=(fig, axis),
return_fig_and_axis=True,
plot_options={"label": "Template with telluric mask"},
)
axis.legend(ncol=2, loc=4, bbox_to_anchor=(1, 1))
Out[3]:
<matplotlib.legend.Legend at 0x7f8310b27a10>