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 a Quantity array with the values of the spectral axis.
spectral_axis_unit Returns the units of the spectral axis.
spectral_wcs
velocity Converts the spectral axis array to the given velocity space unit given the rest value.
velocity_convention

Methods Summary

to_flux(unit[, equivalencies, …]) Converts the flux data to the specified unit.
with_spectral_unit(unit[, …]) Returns a new spectrum with a different spectral axis unit.
with_velocity_convention(velocity_convention)

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 a Quantity array with the values of the spectral axis.

spectral_axis_unit

Returns the units of the spectral axis.

spectral_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:

unit : str 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.

Returns:

~`astropy.units.Quantity`

The converted dispersion array in the new dispersion space.

velocity_convention

Methods Documentation

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

Converts the flux data to the specified unit.

Parameters:

unit : str or Unit

The unit to conver the flux array to.

equivalencies : list of equivalencies

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

suppress_conversion : bool

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

Returns:

Quantity

The converted flux array.

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

Returns a new spectrum with a different spectral axis unit.

Parameters:

unit : Unit

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_value : Quantity

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(velocity_convention)[source]