OneDSpectrumMixin¶
- class specutils.spectra.spectrum_mixin.OneDSpectrumMixin[source]¶
Bases:
objectAttributes Summary
Converts the stored data and unit information into a quantity.
Returns the SpectralCoord object.
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, ...])with_flux_unit(unit[, equivalencies, ...])Returns a new spectrum with a different flux unit.
with_spectral_axis_and_flux_units(...[, ...])Perform
with_spectral_axis_unit()andwith_flux_unit()together.with_spectral_axis_unit(unit[, ...])Returns a new spectrum with a different spectral axis unit.
with_spectral_unit(unit[, ...])with_velocity_convention(velocity_convention)Attributes Documentation
- flux¶
Converts the stored data and unit information into a quantity.
- Returns:
QuantitySpectral data as a quantity.
- rest_value¶
- spectral_axis¶
Returns the SpectralCoord object.
- spectral_axis_index¶
- 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:
- new_data
Quantity The converted dispersion array in the new dispersion space.
- new_data
- 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. If uncertainty is defined, it will be converted to
StdDevUncertaintyin the new 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
Trueif updating the flux unit without converting data values. This is ignored foruncertaintycomponent.
- unitstr or
- Returns:
- new_spec
Spectrum A new spectrum with the converted flux array (and uncertainty, if applicable).
- new_spec
- with_spectral_axis_and_flux_units(spectral_axis_unit, flux_unit, velocity_convention=None, rest_value=None, flux_equivalencies=None, suppress_flux_conversion=False)[source]¶
Perform
with_spectral_axis_unit()andwith_flux_unit()together. See the respective methods for input and output definitions.- Returns:
- new_spec
Spectrum Spectrum in requested units.
- new_spec
- 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
WCSbased on the new spectral axis. The original WCS will be stored in theoriginal_wcsentry of the new object’smetadictionary.- 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.unitsequivalency.- 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