You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Header assignment to CompImageHDU is not preserved on write #14081
>>> from astropy.io import fits
>>> ih = fits.ImageHDU()
>>> ih.header['test'] = 'right'
>>> ch = fits.CompImageHDU()
>>> ch.header['test'] = 'wrong'
>>> ch.header = ih.header # Assign the CompImageHDU the header from the ImageHDU
>>> ch.header['test']
'right' # This makes sense and is what I want
>>> ch.writeto('tmp.fits')
>>> chdl = fits.open('tmp.fits')
>>> chdl[1].header['test']
'wrong' # This doesn't seem right
I'm trying to assign a Header object to the .header attribute of a CompImageHDU. This assignment works while the HDU is in memory, but as soon as it's written to disk it reverts to the old header.
I looked into it a little bit and it looks like maybe CompImageHDU needs a custom setter on its .header attribute?? That's just a guess though.
Activity