OneDSpectrumMixin

class specutils.spectra.spectrum_mixin.OneDSpectrumMixin[source]

Bases: object

Attributes Summary

flux

Converts the stored data and unit information into a quantity.

rest_value

spectral_axis

Returns the SpectralCoord object.

spectral_axis_unit

Deprecated since version v1.1.

spectral_wcs

Returns the spectral axes of the WCS

velocity

Converts the spectral axis array to the given velocity space unit given the rest value.

velocity_convention

Returns the velocity convention

Methods Summary

new_flux_unit(self, unit[, equivalencies, …])

Converts the flux data to the specified unit.

with_spectral_unit(self, unit[, …])

Returns a new spectrum with a different spectral axis unit.

with_velocity_convention(self, …)

Attributes Documentation

flux

Converts the stored data and unit information into a quantity.

Returns
Quantity

Spectral data as a quantity.

rest_value
spectral_axis

Returns the SpectralCoord object.

spectral_axis_unit

Deprecated since version v1.1: The spectral_axis_unit function is deprecated and may be removed in a future version. Use spectral_axis.unit instead.

Returns the units of the spectral axis.

spectral_wcs

Returns the spectral axes of the WCS

velocity

Converts the spectral axis array to the given velocity space unit given the rest value.

These aren’t input parameters but required Spectrum attributes

Parameters
unitstr or ~`astropy.units.Unit`

The unit to convert the dispersion array to.

rest~`astropy.units.Quantity`

Any quantity supported by the standard spectral equivalencies (wavelength, energy, frequency, wave number).

type{“doppler_relativistic”, “doppler_optical”, “doppler_radio”}

The type of doppler spectral equivalency.

redshift or radial_velocity

If present, this shift is applied to the final output velocity to get into the rest frame of the object.

Returns
~`astropy.units.Quantity`

The converted dispersion array in the new dispersion space.

velocity_convention

Returns the velocity convention

Methods Documentation

new_flux_unit(self, unit, equivalencies=None, suppress_conversion=False)[source]

Converts the flux data to the specified unit. This is an in-place change to the object.

Parameters
unitstr or Unit

The unit to convert the flux array to.

equivalencieslist of equivalencies

Custom equivalencies to apply to conversions. Set to spectral_density by default.

suppress_conversionbool

Set to true if updating the unit without converting data values.

Returns
Spectrum1D

A new spectrum with the converted flux array

with_spectral_unit(self, unit, velocity_convention=None, rest_value=None)[source]

Returns a new spectrum with a different spectral axis unit.

Parameters
unitUnit

Any valid spectral unit: velocity, (wave)length, or frequency. Only vacuum units are supported.

velocity_convention‘relativistic’, ‘radio’, or ‘optical’

The velocity convention to use for the output velocity axis. Required if the output type is velocity. This can be either one of the above strings, or an astropy.units equivalency.

rest_valueQuantity

A rest wavelength or frequency with appropriate units. Required if output type is velocity. The spectrum’s WCS should include this already if the input type is velocity, but the WCS’s rest wavelength/frequency can be overridden with this parameter.

with_velocity_convention(self, velocity_convention)[source]