Skip to content

Commit

Permalink
ensure that the wavelength model name is "WAVE" even if CTYPEi="AWAV"
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-simpson committed Apr 8, 2021
1 parent 62a1f23 commit 3d6cc90
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion astrodata/wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,10 @@ def fitswcs_linear(header):
FITS Header or dict with basic FITS WCS keywords.
"""
# We *always* want the wavelength solution model to be called "WAVE"
# even if the CTYPE keyword is "AWAV"
model_name_mapping = {"AWAV": "WAVE"}

if isinstance(header, fits.Header):
wcs_info = read_wcs_from_header(header)
elif isinstance(header, dict):
Expand All @@ -592,7 +596,8 @@ def fitswcs_linear(header):
name='crpix' + str(pixel_axis + 1)) |
models.Scale(cd[ax, pixel_axis]) |
models.Shift(crval[ax]))
linear_model.name = wcs_info['CTYPE'][ax][:4].upper()
ctype = wcs_info['CTYPE'][ax][:4].upper()
linear_model.name = model_name_mapping.get(ctype, ctype)
linear_model.outputs = (wcs_info['CTYPE'][ax],)
linear_model.meta.update({'input_axes': pixel_axes,
'output_axes': [ax]})
Expand Down

0 comments on commit 3d6cc90

Please sign in to comment.