SpectrumCollection

class specutils.SpectrumCollection(flux, spectral_axis=None, wcs=None, uncertainty=None, mask=None, meta=None)[source]

Bases: NDIOMixin

A 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 Spectrum1D objects.

For multidimensional spectra that all have the same spectral axis, use a Spectrum1D with dimension greater than 1. For a collection of spectra that have different shapes, use SpectrumList. For more on this topic, see Overview of How Specutils Represents Spectra.

The attributes on this class uses the same names and conventions as Spectrum1D, allowing some operations to work the same. Where this does not work, the user can use standard indexing notation to access individual Spectrum1D objects.

Parameters:
fluxastropy.units.Quantity

The flux data. The trailing dimension should be the spectral dimension.

spectral_axisastropy.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.

uncertaintyastropy.nddata.NDUncertainty or 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.

metalist

The list of dictionaries containing meta data to be associated with each spectrum in the collection.

Attributes Summary

energy

The spectral axis as an energy Quantity (in eV).

flux

The flux in the spectrum as a Quantity.

frequency

The spectral axis as a frequency Quantity (in GHz).

mask

The mask array for the spectrum.

meta

A dictionary of metadata for theis spectrum collection, or None.

ndim

The dimensionality of the collection.

nspectral

The length of the spectral dimension.

shape

The shape of the collection.

spectral_axis

The spectral axes as a Quantity.

uncertainty

The uncertainty in the spectrum as a Quantity.

wavelength

The spectral axis as a wavelength Quantity (in Angstroms).

wcs

The WCS's as an object array

Methods Summary

from_spectra(spectra)

Create a spectrum collection from a set of individual specutils.Spectrum1D objects.

Attributes Documentation

energy

The spectral axis as an energy Quantity (in eV).

flux

The flux in the spectrum as a Quantity.

frequency

The spectral axis as a frequency Quantity (in GHz).

mask

The mask array for the spectrum.

meta

A dictionary of metadata for theis spectrum collection, or None.

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.

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

The spectral axes as a Quantity.

uncertainty

The uncertainty in the spectrum as a Quantity.

wavelength

The spectral axis as a wavelength Quantity (in Angstroms).

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.Spectrum1D objects.

Parameters:
spectralist, ndarray

A list of Spectrum1D objects to be held in the collection. Currently the spectral_axis parameters (e.g. observer, radial_velocity) must be the same for each spectrum.