Skip to content

Commit

Permalink
Fix bug in cunit lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
pllim authored and kecnry committed Feb 27, 2023
1 parent a2e083a commit f8a0bd8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jdaviz/configs/cubeviz/plugins/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@ def _return_spectrum_with_correct_units(flux, wcs, metadata, data_type, target_w
continue
hdr = hdulist[ext].header
# The WCS could be swapped or unswapped.
for cunit_key in ('CUNIT3', 'CUNIT1'):
if not found_target and cunit_key in hdr and 'WAVE' in hdr[cunit_key]:
for cunit_num in (3, 1):
cunit_key = f"CUNIT{cunit_num}"
ctype_key = f"CTYPE{cunit_num}"
if not found_target and cunit_key in hdr and 'WAVE' in hdr[ctype_key]:
target_wave_unit = u.Unit(hdr[cunit_key])
found_target = True
break
Expand Down

0 comments on commit f8a0bd8

Please sign in to comment.