[Numpy-discussion] proposal: smaller representation of string arrays
Phil Hodge
hodge at stsci.edu
Tue Apr 25 13:51:19 EDT 2017
On 04/25/2017 01:34 PM, Anne Archibald wrote:
> I know they're not numpy-compatible, but FITS header values are
> space-padded; does that occur elsewhere?
Strings in FITS headers are delimited by single quotes. Some keywords
(only a handful) are required to have values that are blank-padded (in
the FITS file) if the value is less than eight characters. Whether you
get trailing blanks when you read the header depends on the FITS
reader. I use astropy.io.fits to read/write FITS files, and that
interface strips trailing blanks from character strings:
TARGPROP= 'UNKNOWN ' / Proposer's name for the target
>>> fd = fits.open("test.fits")
>>> s = fd[0].header['targprop']
>>> len(s)
7
Phil
More information about the NumPy-Discussion
mailing list