Skip to content

Instantly share code, notes, and snippets.

@malclocke
Created December 19, 2013 01:02
Show Gist options
  • Save malclocke/8032594 to your computer and use it in GitHub Desktop.
Save malclocke/8032594 to your computer and use it in GitHub Desktop.
Add BeSS headers to a FITS file
#! /usr/bin/env python
import pyfits
import argparse
parser = argparse.ArgumentParser(
description='Add BeSS FITS headers to a file')
parser.add_argument('filename', type=str, help='FITS filename')
parser.add_argument('--outfile', '-o', type=str, help='Output filename',
required=True)
args = parser.parse_args()
f = pyfits.open(args.filename)
header = f[0].header
data = f[0].data
# Modify for your requirements
header.update('BSS_INST', 'GSO880+SA100+QHY5')
header.update('BSS_SITE', 'Christchurch-NZ')
header.update('BSS_VHEL', 0.)
header.update('BSS_COSM', 'no correction')
header.update('BSS_TELL', 'no correction')
header.update('BSS_NORM', 'none')
pyfits.writeto(args.outfile, data, header, output_verify='fix')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment