Spectrum1D¶
-
class
specutils.spectra.spectrum1d.
Spectrum1D
(flux=None, spectral_axis=None, wcs=None, velocity_convention=None, rest_value=None, *args, **kwargs)[source]¶ Bases:
specutils.spectra.spectrum_mixin.OneDSpectrumMixin
,astropy.nddata.NDDataRef
Spectrum container for 1D spectral data.
Parameters: flux :
astropy.units.Quantity
or astropy.nddata.NDData`-likeThe flux data for this spectrum.
spectral_axis :
astropy.units.Quantity
Dispersion information with the same shape as the last (or only) dimension of flux.
wcs :
astropy.wcs.WCS
orgwcs.wcs.WCS
WCS information object.
velocity_convention : {“doppler_relativistic”, “doppler_optical”, “doppler_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.
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 flux.
meta : dict
Arbitrary container for any user-specific information to be carried around with the spectrum container object.
Attributes Summary
bin_edges
energy
The energy of the spectral axis as a Quantity
in units of eV.frequency
The frequency as a Quantity
in units of GHzphoton_flux
The flux density of photons as a Quantity
, in units of photons per cm^2 per second per spectral_axis unitshape
wavelength
The wavelength as a Quantity
in units of AngstromsMethods Summary
spectral_resolution
(true_dispersion, …[, axis])Evaluate the probability distribution of the spectral resolution. Attributes Documentation
-
bin_edges
¶
-
photon_flux
¶ The flux density of photons as a
Quantity
, in units of photons per cm^2 per second per spectral_axis unit
-
shape
¶
Methods Documentation
-
spectral_resolution
(true_dispersion, delta_dispersion, axis=-1)[source]¶ Evaluate the probability distribution of the spectral resolution.
Parameters: true_dispersion :
Quantity
True value(s) of dispersion for which the resolution should be evaluated.
delta_dispersion :
Quantity
Array of (observed - true) dispersion bin edges to integrate the resolution probability density over.
axis : int
Which axis of
delta_dispersion
contains the strictly increasing dispersion values to interpret as bin edges. The dimension ofdelta_dispersion
along this axis must be at least two.Returns: numpy array
Array of dimensionless probabilities calculated as the integral of P(observed | true) over each bin in (observed - true). The output shape is the result of broadcasting the input shapes.
Examples
To tabulate a binned resolution function at 6000A covering +/-10A in 0.2A steps:
>>> R = spectrum1d.spectral_resolution( ... 6000 * u.Angstrom, np.linspace(-10, 10, 51) * u.Angstrom) >>> assert R.shape == (50,) >>> assert np.allclose(R.sum(), 1.)
To build a sparse resolution matrix for true wavelengths 4000-8000A in 0.1A steps:
>>> R = spectrum1d.spectral_resolution( ... np.linspace(4000, 8000, 40001)[:, np.newaxis] * u.Angstrom, ... np.linspace(-10, +10, 201) * u.Angstrom) >>> assert R.shape == (40000, 200) >>> assert np.allclose(R.sum(axis=1), 1.)
-