fits_tools – Functions related with the fits format

Functions related with fits files

pyhetdex.tools.files.fits_tools.parse_fits_region(region)[source]

Convert a FITS region string with a format [x1:x2,y1:y2], or x1:x2,y1:y2 into an list.

Parameters:
region : str

The input region string

Returns:
list

List of region parameters

Examples

>>> parse_fits_region('[1:100,2:200]')
[1, 100, 2, 200]
pyhetdex.tools.files.fits_tools.wavelength_to_index(header, wavelength)[source]

Using the CRVAL1 and CDELT1 keywords in header determine the index of wavelength

Parameters:
header : dictionary like

dictionary containing the above keywords

wavelength : float

wavelength. If None, return None

Returns:
int or None

index of wavelength

Examples

>>> wavelength_to_index({'CRVAL1': 3500, 'CDELT1': 2}, 4000)
250