A set of tools to verify the operation of the j2ms2 and tConvert programs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
981 B

#!/usr/bin/env python
from __future__ import print_function
import sys, astropy.io.fits
def fix_file(filename):
print("Fixing file:",filename)
fitsfile = astropy.io.fits.open(filename, mode='update')
# Add the correct sort order keyword with value time-baseline
# we've always written our FITS files that way but failed to
# (correctly) mention that in the header in such a way that
# AIPS would actually recognize that
fitsfile[0].header['SORTORDR'] = 'TB'
# The name of the FR(E)QSEL column in the 'AIPS FQ' table
# was possibly changed. We used to label the column 'FREQSEL'
# but AIPS seems to be looking for 'FRQSEL' these days
for (key, _) in filter(lambda kv: kv[1]=='FREQSEL', fitsfile['AIPS FQ'].header.items()):
fitsfile['AIPS FQ'].header.set(key, 'FRQSEL')
except astropy.io.fits.verify.VerifyError:
map(fix_file, sys.argv[1:])