A tiny (and growing, depending on my needs) python module for analyses of Spectra in python.
You can install the package via pip:
pip install git+https://github.com/AstroTeutloff/spectra.git
or by cloning the repository:
git clone https://github.com/AstroTeutloff/spectra.git
cd spectra
pip install -e .The module is split up into "named" Spectra and the dataclass Spectrum. The
named spectra are instantiated from a file and usually hold not just the
spectral data (i.e. wavelengths, fluxes, flux uncertainties) in fields usually
called spectrum, or spectra (check the implementation on the case-by-case),
but also logistical information (e.g. the FITS header).
Explicit calculations are not performed with the named spectra classes, the
Spectrum class has a suite of commonly used methods for spectra (redshift,
adding two spectra, multiplying by a scalar factor)
The TransitionLine dataclass is also there, I'm not super sure what to do
with it yet, but its tested and can be used for visualisation purposes.
The named classes have a plot_spectrum() method.
import matplotlib.pyplot as plt
import spectra as sp
sdss_obj = sp.SDSSSpectrum("YOUR_SDSS_SPEC.fits")
_ = sdss_obj.plot_spectrum()
plt.show()- As of v0.1.0:
- Module no longer named
simplespec, new namespectra SDSSSpectrumno longer supports fitting the continuum. If need arises, it will be implemented in theSpectrumdataclass itself.SDSSSpectrumno longer supports masking the Spectrum edges. This might be refactored into theSpectrumdataclass.SDSSSpectrumno longer has QTables as itsspectraandcoaddfields, these are nowSpectrumobjects.BaseSpectrumno longer exists, because I didn't have a reason to keep it around.
- Module no longer named
If you have ideas and/or improvements, feel free to open a PR! :)