Spectrum1D#
- class aesop.Spectrum1D(wavelength=None, flux=None, name=None, mask=None, wcs=None, meta={}, time=None, continuum_normalized=None)[source]#
Bases:
objectSimple 1D spectrum object.
A
Spectrum1Dobject can be used to describe one order of an echelle spectrum, for example.If the spectrum is initialized with
wavelength``s that are not strictly increasing, ``Spectrum1Dwill sort thewavelength,fluxandmaskarrays so thatwavelengthis monotonically increasing.- Parameters:
- wavelength
ndarray Wavelengths
- flux
ndarray Fluxes
- namestr (optional)
Name for the spectrum
- mask
ndarray(optional) Boolean mask of the same shape as
flux- wcs
Spectrum1DLookupWCS(optional) Store the WCS parameters
- metadict (optional)
Metadata dictionary.
- continuum_normalizedbool (optional)
Is this spectrum continuum normalized?
- wavelength
Attributes Summary
Methods Summary
flux_calibrate(flux_calibrated_spectrum, ...)Calculates coefficients of sensitivity function, then returns flux-calibrated spectrum
flux_calibrate_parameters(...[, plots])Interpolate high-res spectrum to low-res flux calibrated spectrum, then fit the ratio with a polynomial to flux calibrate.
from_array(wavelength, flux[, ...])Initialize a spectrum with the same call signature as
from_array.from_specutils(spectrum1d[, name])Convert a
Spectrum1Dobject into our Spectrum1D object.mask_outliers([reject_negative, mad_clip, ...])Identify outliers, update the
maskattribute.plot([ax])Plot the spectrum.
Attributes Documentation
- masked_flux#
- masked_wavelength#
Methods Documentation
- flux_calibrate(flux_calibrated_spectrum, polynomial_order)[source]#
Calculates coefficients of sensitivity function, then returns flux-calibrated spectrum
- Parameters:
- flux_calibrated_spectrum
Spectrum1D Already flux calibrated low-resolution spectrum of the same object
- polynomial_orderint
Order of polynomial fit
- flux_calibrated_spectrum
- Returns:
- transformed_spectrum
Spectrum1D Spectrum transformed with sensitivity polynomial
- transformed_spectrum
- flux_calibrate_parameters(flux_calibrated_spectrum, polynomial_order, plots=False)[source]#
Interpolate high-res spectrum to low-res flux calibrated spectrum, then fit the ratio with a polynomial to flux calibrate. Returns polynomial coefficients
- Parameters:
- flux_calibrated_spectrum
Spectrum1D Already flux calibrated low-resolution spectrum of the same object
- polynomial_orderint
Order of polynomial fit
- plotsbool
If True, plot the sensitivity data and the fit
- flux_calibrated_spectrum
- Returns:
- fit_params
ndarray Best-fit polynomial coefficients
- fit_params
- classmethod from_array(wavelength, flux, dispersion_unit=None, name=None, **kwargs)[source]#
Initialize a spectrum with the same call signature as
from_array.
- classmethod from_specutils(spectrum1d, name=None, **kwargs)[source]#
Convert a
Spectrum1Dobject into our Spectrum1D object.- Parameters:
- spectrum1d
Spectrum1D Input spectrum
- namestr
Target/spectrum name
- spectrum1d
- mask_outliers(reject_negative=True, mad_clip=True, mad_outlier_factor=3)[source]#
Identify outliers, update the
maskattribute.- Parameters:
- reject_negativebool (optional)
Reject fluxes < -0.5. Default is
True.- mad_clipbool
Reject fluxes more than
mad_outlier_factortimes the median absolute deviation (MAD) from the continuum flux.- mad_outlier_factorfloat
MAD-masking factor – fluxes more than
mad_outlier_factoraway from the continuum flux will be masked.