Skip to content

Commit

Permalink
GNIRS IFU handling for focal_plane_mask descriptor (#408)
Browse files Browse the repository at this point in the history
* more flexible matching of IFU tag for new GNIRS SLIT header values

* modified to support LR-IFU and HR-IFU for focal_plane_mask descriptor (when pretty=True)

Co-authored-by: Oliver <oly@oberdorf.org>
  • Loading branch information
olyoberdorf and Oliver committed Oct 27, 2022
1 parent 5e72ba7 commit d3728e7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gemini_instruments/gnirs/adclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _type_spect(self):
slit = self.phu.get('SLIT', '').lower()
grat = self.phu.get('GRATING', '')
prism = self.phu.get('PRISM', '')
if slit == 'ifu':
if 'ifu' in slit:
tags.add('IFU')
elif ('arcsec' in slit or 'pin' in slit) and 'mm' in grat:
if 'MIR' in prism:
Expand Down Expand Up @@ -350,6 +350,10 @@ def focal_plane_mask(self, stripID=False, pretty=False):
fpm = slit
elif "XD" in decker:
fpm = "{}XD".format(slit)
elif "HR-IFU" in slit and "HR-IFU" in decker:
fpm = "HR-IFU"
elif "LR-IFU" in slit and "LR-IFU" in decker:
fpm = "LR-IFU"
elif "IFU" in slit and "IFU" in decker:
fpm = "IFU"
elif "Acq" in slit and "Acq" in decker:
Expand Down
16 changes: 16 additions & 0 deletions gemini_instruments/gnirs/tests/test_gnirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,21 @@ def test_ra_dec_from_text():
assert ad.target_dec() == pytest.approx(24.345277777777778)


# TODO: HR-IFU data doesn't exist yet, add one when available
EXPECTED_FPMS = [
('N20220918S0040.fits', "LR-IFU"),
("S20061213S0131.fits", "IFU")
]


@pytest.mark.dragons_remote_data
@pytest.mark.parametrize("filename,expected_fpm", EXPECTED_FPMS)
def test_ifu_fpm(filename, expected_fpm):
path = astrodata.testing.download_from_archive(filename)
ad = astrodata.open(path)
assert("IFU" in ad.tags)
assert(ad.focal_plane_mask(pretty=True) == expected_fpm)


if __name__ == "__main__":
pytest.main()

0 comments on commit d3728e7

Please sign in to comment.