Skip to content

Commit

Permalink
Merge pull request #219 from LSSTDESC/u/jchiang/move_WCSAXES_keyword
Browse files Browse the repository at this point in the history
re-insert the WCSAXES keyword to precede other WCS keywords
  • Loading branch information
jchiang87 committed Jun 9, 2019
2 parents d0231cc + ef7e897 commit 8b0bc21
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions python/desc/imsim/camera_readout.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,13 @@ def write_fits_file(self, outfile, overwrite=True, run_number=None,
"""
output = fits.HDUList(fits.PrimaryHDU())
output[0].header = self.eimage[0].header
# Since `.header` acts like an unordered dict when set like
# this, we need to re-insert the WCSAXES keyword to precede
# any other WCS keywords as stipulated in the FITS Standard,
# version 4.0, section 8.2.
wcsaxes = output[0].header['WCSAXES']
del output[0].header['WCSAXES']
output[0].header.insert(5, ('WCSAXES', wcsaxes, ''))
if run_number is None:
run_number = self.visit
output[0].header['RUNNUM'] = str(run_number)
Expand Down

0 comments on commit 8b0bc21

Please sign in to comment.