Adding Keywords to FITS headers

Try this:

>>> import astropy

>>> from astropy.io import fits

>>> hdulist = fits.open(‘filename’)

>>> hdu = hdulist[0]

to display the header: >>> hdu.header

to add a new keyword: >>> hdu.header[‘KEYWORD’] = ‘value’

to remove a keyword: >>> hdu.header.remove(‘KEYWORD’)

See Handling FITS files for more info

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s