OneDSpectrumMixin¶
- class specutils.spectra.spectrum_mixin.OneDSpectrumMixin[source]¶
Bases:
object
Attributes Summary
Converts the stored data and unit information into a quantity.
Returns the SpectralCoord object.
Deprecated since version v1.1.
Returns the spectral axes of the WCS
Converts the spectral axis array to the given velocity space unit given the rest value.
Returns the velocity convention
Methods Summary
new_flux_unit
(unit[, equivalencies, ...])Deprecated since version v1.13.
with_flux_unit
(unit[, equivalencies, ...])Returns a new spectrum with a different flux unit
with_spectral_axis_unit
(unit[, ...])Returns a new spectrum with a different spectral axis unit.
with_spectral_unit
(unit[, ...])Deprecated since version v1.13.
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 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(unit, equivalencies=None, suppress_conversion=False)[source]¶
Deprecated since version v1.13: The new_flux_unit function is deprecated and may be removed in a future version. Use with_flux_unit instead.
- with_flux_unit(unit, equivalencies=None, suppress_conversion=False)[source]¶
Returns a new spectrum with a different flux unit
- 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.
- unitstr or
- Returns:
Spectrum1D
A new spectrum with the converted flux array
- with_spectral_axis_unit(unit, velocity_convention=None, rest_value=None)[source]¶
Returns a new spectrum with a different spectral axis unit. Note that this creates a new object using the converted spectral axis and thus drops the original WCS, if it existed, replacing it with a lookup-table
WCS
based on the new spectral axis. The original WCS will be stored in theoriginal_wcs
entry of the new object’smeta
dictionary.- 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.
- unit