SpectrumCollection#
- class specutils.SpectrumCollection(flux, spectral_axis=None, wcs=None, uncertainty=None, mask=None, meta=None, spectral_axis_index=None, redshift=None, radial_velocity=None, rest_value=None, velocity_convention=None)[source]#
Bases:
NDIOMixin,RedshiftMixinA class to represent a heterogeneous set of spectra that are the same length but have different spectral axes. Spectra that meet this requirement can be stored as multidimensional arrays, and thus can have operations performed on them faster than if they are treated as individual
Spectrumobjects.For multidimensional spectra that all have the same spectral axis, use a
Spectrumwith dimension greater than 1. For a collection of spectra that have different shapes, useSpectrumList. For more on this topic, see Overview of How Specutils Represents Spectra.The attributes on this class uses the same names and conventions as
Spectrum, allowing some operations to work the same. Where this does not work, the user can use standard indexing notation to access individualSpectrumobjects.- Parameters:
- flux
astropy.units.Quantity The flux data. The trailing dimension should be the spectral dimension.
- spectral_axis
astropy.units.Quantity The spectral axes of the spectra (e.g., wavelength). Must match the dimensionality of
flux.- wcswcs object or None
A wcs object (if available) for the collection of spectra. The object must follow standard indexing rules to get a sub-wcs if it is provided.
- uncertainty
astropy.nddata.NDUncertaintyor ndarray The uncertainties associated with each spectrum of the collection. In the case that only an n-dimensional quantity or ndaray is provided, the uncertainties are assumed to be standard deviations. Must match the dimensionality of
flux.- maskndarray or None
The n-dimensional mask information associated with each spectrum. If present, must match the dimensionality of
flux.- redshiftfloat or None
A single value to apply to every spectrum in the collection. Cannot be specified if
radial_velocityis specified.- radial_velocity
Quantity A single value to apply to all spectra in the collection. Cannot be specified if
redshiftis specified.- velocity_convention{“relativistic”, “optical”, “radio”}
Convention used for velocity conversions.
- rest_value
Quantity Any quantity supported by the standard spectral equivalencies (wavelength, energy, frequency, wave number). Describes the rest value of the spectral axis for use with velocity conversions.
- metalist
The list of dictionaries containing meta data to be associated with each spectrum in the collection.
- flux
Attributes Summary
The spectral axis as an energy
Quantity(in eV).The flux in the spectrum as a
Quantity.The spectral axis as a frequency
Quantity(in GHz).The mask array for the spectrum.
A dictionary of metadata for theis spectrum collection, or
None.The dimensionality of the collection.
The length of the spectral dimension.
The radial velocity(s) of the objects represented by this spectrum.
The redshift(s) of the objects represented by this spectrum.
The shape of the collection.
The spectral axes as a
Quantity.The uncertainty in the spectrum as a
Quantity.The spectral axis as a wavelength
Quantity(in Angstroms).The WCS's as an object array
Methods Summary
from_spectra(spectra)Create a spectrum collection from a set of individual
specutils.Spectrumobjects.Attributes Documentation
- mask#
The mask array for the spectrum.
- ndim#
The dimensionality of the collection. This is not the same as the dimensionality of the flux et al., because the trailing (spectral) dimension is not included here.
- nspectral#
The length of the spectral dimension.
- radial_velocity#
The radial velocity(s) of the objects represented by this spectrum. May be scalar (if this spectrum’s
fluxis 1D) or vector. Note that the concept of “RV of a spectrum” can be ambiguous, so the interpretation is set to some extent by either the user, or operations (like template fitting) that set this attribute when they are run on a spectrum.
- redshift#
The redshift(s) of the objects represented by this spectrum. May be scalar (if this spectrum’s
fluxis 1D) or vector. Note that the concept of “redshift of a spectrum” can be ambiguous, so the interpretation is set to some extent by either the user, or operations (like template fitting) that set this attribute when they are run on a spectrum.
- shape#
The shape of the collection. This is not the same as the shape of the flux et al., because the trailing (spectral) dimension is not included here.
- spectral_axis_index#
- wcs#
The WCS’s as an object array
Methods Documentation
- classmethod from_spectra(spectra)[source]#
Create a spectrum collection from a set of individual
specutils.Spectrumobjects.- Parameters:
- spectralist, ndarray
A list of
Spectrumobjects to be held in the collection. Currently the spectral_axis parameters (e.g. observer, radial_velocity) must be the same for each spectrum.