Spectrum#

class sunkit_spex.spectrum.spectrum.Spectrum(
data,
*,
spectral_axis=None,
spectral_axis_index=None,
wcs=None,
**kwargs,
)[source]#

Bases: NDCube

Spectrum container for data which share a common spectral axis.

Note that “1D” in this case refers to the fact that there is only one spectral axis. Spectrum can contain ND data where data have a shape with dimension greater than 1.

Notes

A stripped down version of Spectrum1D from specutils.

Parameters:
  • data (Quantity) – The data for this spectrum. This can be a simple Quantity, or an existing Spectrum or NDCube object.

  • uncertainty (NDUncertainty) – Contains uncertainty information along with propagation rules for spectrum arithmetic. Can take a unit, but if none is given, will use the unit defined in the data.

  • spectral_axis (Quantity or SpectralAxis) – Dispersion information with the same shape as the dimension specified by spectral_axis_index or shape plus one if specifying bin edges.

  • spectral_axis_index (int default 0) – The dimension of the data which represents the spectral information default to first dimension index 0.

  • mask (ndarray-like) – Array where values in the flux to be masked are those that astype(bool) converts to True. (For example, integer arrays are not masked where they are 0, and masked for any other value.)

  • meta (dict) – Arbitrary container for any user-specific information to be carried around with the spectrum container object.

Examples

>>> import numpy as np
>>> import astropy.units as u
>>> from sunkit_spex.spectrum import Spectrum
>>> spec = Spectrum(np.arange(1, 11)*u.watt,spectral_axis=np.arange(1, 12)*u.keV)
>>> spec
<sunkit_spex.spectrum.spectrum.Spectrum object at ...
NDCube
------
Shape: (10,)
Physical Types of Axes: [('em.energy',)]
Unit: W
Data Type: float64

Attributes Summary

Attributes Documentation

spectral_axis#
spectral_axis_index#