View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

FITS headers between iraf and aips

Michael Gregg wrote on May 29, 2011

Hi,

I recently read a bunch of data from old exabytes into AIPS, the only method available to me to get the data off the tapes. Using another AIPS task, I then wrote out the data from AIPS format to regular fits files. The data look fine and I can implot them in iraf and display them. The trouble is that AIPS has converted most of the header keywords into HISTORY lines by prepending the string "HISTORY" to the start of nearly every header line, as in this example:

HISTORY TIME = ' 0:59:58.0' / UT TIME
HISTORY EXPOSURE= 1 / EXPOSURE TIME (SEC)
HISTORY RA = ' 3:50:53.9' / RIGHT ASCENSION
HISTORY DEC = ' +37:22:40.0' / DECLINATION
etc...

These header lines originally looked like:

TIME = ' 0:59:58.0' / UT TIME
EXPOSURE= 1 / EXPOSURE TIME (SEC)
RA = ' 3:50:53.9' / RIGHT ASCENSION
DEC = ' +37:22:40.0' / DECLINATION
etc...

There are about 80 header lines so affected in each fits file, and I have about 2000 of these files. I am wondering if there is an easy way to restore the headers to their original format in batch so that IRAF (and I!) can easily recognize and read the keywords as keywords. I can do it manually file by file, and that would take way too long. The only thing I can think of is to try reading and rewriting the headers in IDL; I am hoping that maybe this problem has already been solved or that there is a simple way in IRAF already.

Thank you,

Michael Gregg
U.C. Davis

Mike Fitzpatrick wrote on May 29, 2011

Have a look at the HFIX task. Basically, you can use it to drive a 'sed' or an 'awk' script to edit the headers autmatically. For example, create a file with all the edit something like


s/HISTORY TIME/TIME/g
s/HISTORY EXPOSURE/EXPOSURE/g
      :         :         :


Then you can edit all of your images with the command

hfix *.fits command="!sed -f edits.txt $fname > temp; mv temp $fname"

Last post on May 29, 2011