Astropy: Header.set can create empty valued keywords

Created on 27 Nov 2019  ·  3Comments  ·  Source: astropy/astropy

I don't know if this is a bug or is expected, but in astropy 3.0 this:

from astropy.io import fits
hdr = fits.header()
hdr.set('A')
print(hdr)

gets you this

A = ' '
END

but in 3.2 you get this

A = 
END

with no value. Is this valid FITS?

EDIT: Fixed code

Close? io.fits question

All 3 comments

Hmm... I see that in 4.1dev too. Do you want to git bisect and see which commit was the culprit?

Yes, this is valid FITS, it creates an undefined card : #8572

Yes, the commit is 545f488cbb4a5ccca908bffeb90bc29ad41bd9c1
I see that before this commit a value of None in this function was mapped to ' '
It's my understanding that this is the intended behavior, so this can be closed.

Was this page helpful?
0 / 5 - 0 ratings