cwitools.coordinates.get_wav_axis

cwitools.coordinates.get_wav_axis(header)

Returns a NumPy array representing the wavelength axis of a cube.

Parameters:header (astropy.io.fits.Header) – header that contains wavelength or velocity axis that is specified in ‘CTYPE’ keywords in any dimension.
Returns:Wavelength axis for this data.
Return type:numpy.ndarray

Examples

If you wanted to plot your spectrum vs. wavelength in matplotlib:

>>> import matplotlib.pyplot as plt
>>> from cwitools import cubes
>>> from astropy.io import fits
>>> spec,header = fits.getdata("myspectrum.fits",header=True)
>>> wav_axis = cubes.get_wav_axis(header)
>>> fig,ax = plt.subplots(1,1)
>>> ax.plot(wav_axis,spec)
>>> fig.show()