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.

25 lines
981 B

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