OneDSpectrum

class spectral_cube.lower_dimensional_structures.OneDSpectrum[source]

Bases: spectral_cube.lower_dimensional_structures.LowerDimensionalObject, spectral_cube.base_class.MaskableArrayMixinClass, spectral_cube.base_class.SpectralAxisMixinClass

Attributes Summary

hdu
hdulist
header
spectral_axis A Quantity array containing the central values of each channel along the spectral axis.

Methods Summary

quicklook([filename, drawstyle]) Plot the spectrum with current spectral units in the currently open
spectral_interpolate(spectral_grid[, ...]) Resample the spectrum onto a specific grid
spectral_smooth(kernel[, convolve]) Smooth the spectrum
with_fill_value(fill_value) Create a new OneDSpectrum with a different fill_value.
with_spectral_unit(unit[, ...])

Attributes Documentation

hdu
hdulist
header
spectral_axis

A Quantity array containing the central values of each channel along the spectral axis.

Methods Documentation

quicklook(filename=None, drawstyle='steps-mid', **kwargs)[source]

Plot the spectrum with current spectral units in the currently open figure

kwargs are passed to matplotlib.pyplot.plot

Parameters:

filename : str or Non

Optional - the filename to save the quicklook to.

spectral_interpolate(spectral_grid, suppress_smooth_warning=False, fill_value=None)[source]

Resample the spectrum onto a specific grid

Parameters:

spectral_grid : array

An array of the spectral positions to regrid onto

suppress_smooth_warning : bool

If disabled, a warning will be raised when interpolating onto a grid that does not nyquist sample the existing grid. Disable this if you have already appropriately smoothed the data.

fill_value : float

Value for extrapolated spectral values that lie outside of the spectral range defined in the original data. The default is to use the nearest spectral channel in the cube.

Returns:

spectrum : OneDSpectrum

spectral_smooth(kernel, convolve=<function convolve>, **kwargs)[source]

Smooth the spectrum

Parameters:

kernel : Kernel1D

A 1D kernel from astropy

convolve : function

The astropy convolution function to use, either astropy.convolution.convolve or astropy.convolution.convolve_fft

kwargs : dict

Passed to the convolve function

with_fill_value(fill_value)[source]

Create a new OneDSpectrum with a different fill_value.

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