astropy/ccdproc

ccdp.trim_image changes fits header

farinha09 opened this issue · 3 comments

I am using ccdp.trim_image to trim fits files and somehow is is changing the header

this is the before:
OBJECT = 'STD ' / Target description
INSTRUME= 'FORS2 ' / Instrument used
CD1_1 = 6.998078000E-05 / Translation matrix element.
CD1_2 = -1.000000000E-20 / Translation matrix element.
CD2_1 = -1.000000000E-20 / Translation matrix element.
CD2_2 = -6.998078000E-05 / Translation matrix element.
HIERARCH ESO OBS NTPL = 5 / Number of templates within OB

and this is the after:
OBJECT = 'STD ' / Target description
INSTRUME= 'FORS2 ' / Instrument used
HIERARCH ESO OBS NTPL = 5 / Number of templates within OB

why does this happen?

Sorry for the long delay -- a CCDData object converts a WCS in the header into an astropy WCS object and removes the wcs information from the header.

When the CCDData object is saved to a FITS file or is explicitly converted to an HDU the WCS information is put back into the header.

Thank you for the answer!

I'm going to close this issue since I think the question has been addressed but please do feel free to reopen it if you would like 😀