parse_filter_from_header

grizli.utils.parse_filter_from_header(header, filter_only=False, jwst_detector=False, **kwargs)[source]

Get simple filter name out of an HST/JWST image header.

ACS has two keywords for the two filter wheels, so just return the non-CLEAR filter. For example,

>>> h = astropy.io.fits.Header()
>>> h['INSTRUME'] = 'ACS'
>>> h['FILTER1'] = 'CLEAR1L'
>>> h['FILTER2'] = 'F814W'
>>> from grizli.utils import parse_filter_from_header
>>> print(parse_filter_from_header(h))
F814W
>>> h['FILTER1'] = 'G800L'
>>> h['FILTER2'] = 'CLEAR2L'
>>> print(parse_filter_from_header(h))
G800L
Parameters
headerHeader

Image header with FILTER or FILTER1,FILTER2,…,FILTERN keywords

filter_onlybool

If true, don’t do any special handling with JWST but just return the FILTER keyword itself. Otherwise, for JWST/NIRISS, return {PUPIL}-{FILTER} and for JWST/NIRCAM, return {FILTER}-{PUPIL}

jwst_detectorbool

If True, prepend DETECTOR to output for JWST NIRCam and NIRISS to distinguish NIRCam detectors and filter names common between these instruments.

Returns
filterstr