cwitools.coordinates.get_wav_axis

cwitools.coordinates.get_wav_axis(header)

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

Args:
header (astropy.io.fits.Header): Can be 1D (spectrum) or 3D (cube) header.
Returns:
numpy.ndarray: Wavelength axis for this data.

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()

Note: input header must be 3D (X, Y, WAV) or 1D (WAV).