SpectraContainer#
The SpectraContainer class is a specialized python container for
MADCUBA exported spectra. MADCUBA exports spectra as a .spec archive,
containing FITS files alongside their history files. With this
class, the user can easily read spectra data from MADCUBA, perform a series
of operations on them, or quickly plot them.
Overview#
Core Attributes#
The SpectraContainer class stores FITS information in several
attributes:
bintable:Tablecontaining the spectra data.hist: Stores information from MADCUBA’s history file.filename: Filename of the .spec file. Used for tracking several operations performed on the file.
Examples#
Create an instance by reading a .spec file (recommended method):
>>> from madcubapy.io import SpectraContainer
>>> spec_container = SpectraContainer.read("example_file.spec")
We can also create an instance by providing any attribute stated before,
although it is not recommended because creating a bintable by hand is much
more complex than reading one. However, it can be useful to create a new
SpectraContainer by providing a previous bintable:
>>> new_container = SpectraContainer(bintable=spec_container.bintable)
To access the spectra data we can call the bintable attribute:
>>> spec_container.bintable
The history information is present in the hist attribute:
>>> spec_container.hist
Quality-of-Life Features#
The SpectraContainer class introduces methods and functions to
facilitate working with the data.
Creation of spectral axis
The headers of the spectra usually contain arrays for the Y axis of the data with the corresponding units, but not for the X axis. When reading a .spec file, the program automatically creates this axis.
Extensibility
New features will continue to be added, enhancing its capabilities for .spec file workflows.