[AstroPy] boolean header keyword
Erik Bray
embray at stsci.edu
Tue Apr 14 16:52:58 EDT 2015
T and F (without quotes) are bool literals in FITS. Hence,
In [1]: from astropy.io import fits
In [2]: h = fits.Header()
In [3]: h['SIMPLE'] = True
In [4]: h
Out[4]: SIMPLE = T
In [5]: h['SIMPLE'] = False
In [6]: h
Out[6]: SIMPLE = F
On 04/14/2015 04:26 PM, Abhijith Rajan wrote:
> Hello,
>
> This is most likely a question for Eric, but I thought I'd see if someone knew
> the answer. I'm using the setval command in astropy.io.fits to update a header
> keyword in an HST image (SUBARRAY). The keyword originally contains either a T
> or F if the image is a subarray or not.
>
> How do I use setval to change the keyword from T to F or vice versa. Right now
> its updating the header with a string and essentially crashing the code checking
> to make sure that the image is not a subarray.
>
> Thanks
> Abhi
>
> -------------------------------------------------------------------------------------------
> Abhijith Rajan
> PhD Candidate
> Arizona State University
> School of Earth & Space Exploration
> Interdisciplinary Sci & Tech Bldg 4 Rm 542
> Tempe, AZ 85287
> Tel: (480) 727-2559
> Fax: (480) 965-8102
> www.abhijithrajan.com <http://www.abhijithrajan.com>
> -------------------------------------------------------------------------------------------
>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>
More information about the AstroPy
mailing list