cwitools.coordinates.get_indices¶
-
cwitools.coordinates.
get_indices
(wav1, wav2, header, bounded=True)¶ Returns wavelength layer indices for two given wavelengths in Angstrom.
Parameters: - wav1 (float) – Lower wavelength, in Angstrom.
- wav2 (float) – Upper wavelength, in Angstrom.
- header (astropy.io.fits.Header) – FITS header for this data cube.
Returns: The lower and upper wavelength indices for this range.
Return type: int tuple
Example
To find the indices corresponding to the wavelength range 4100-4200A:
>>> from astropy.io import fits >>> from cwitools import cubes >>> mydata,header = fits.getdata("mydata.fits",header=True) >>> a,b = cubes.get_band(4100,4200,header) >>> mydata_trimmed = mydata[a:b]