Skip to content

Commit

Permalink
chore(dragons): Add commit from DRAGONS in WCS
Browse files Browse the repository at this point in the history
Updates wcs to handle multiple undefined axes.
  • Loading branch information
teald committed Dec 18, 2024
1 parent 5c0409c commit b8e08b0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion astrodata/wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,17 @@ def read_wcs_from_header(header):
crval = []
cdelt = []

# Handle more than 1 undefined (i.e., not CTYPEi) axis
untyped_axes = 0
for i in range(1, wcsaxes + 1):
ctype.append(header.get(f"CTYPE{i}", "LINEAR"))
try:
this_ctype = header[f"CTYPE{i}"]

except KeyError:
this_ctype = f"LINEAR{untyped_axes+1 if untyped_axes else ''}"
untyped_axes += 1

ctype.append(this_ctype)
cunit.append(header.get(f"CUNIT{i}", None))
crpix.append(header.get(f"CRPIX{i}", 0.0))
crval.append(header.get(f"CRVAL{i}", 0.0))
Expand Down

0 comments on commit b8e08b0

Please sign in to comment.