Matt,

It appears that the problems you were having with FITS file manipulation may be due to rfits() trying to be too smart. The Right Way to get a consistent data file and fits header, in scientific units, is:

        $a   = rfits($filename);
        $hdr = $a->hdr;

That will scale $a into scientific units (applying any BSCALE and BZERO correction from the header). It also deletes BSCALE and BZERO from the header, to avoid confusion.

If you want to avoid the scaling, you can do this:

        $a = rfits($filename, {bscale=>0 });

(See the rfits documentation for more details).

In your case, you were doing this:

        $a = rfits($filename);
        $hdr = rfits_hdr($filename);

This yielded a scaled $a, and the original header. You should either use the rfits-supplied header (as the first example) or tell rfits not to apply bscaling (as in the second example).

Now, you were having a problem with IRAF not reading your output files with BITPIX=-64 and BZERO set to 32768; but that appears to be an IRAF problem: I checked my printed copy of the FITS User's Guide v4.0 (a bit long in the tooth) and the more recent keyword dictionary at "http://heasarc.gsfc.nasa.gov/docs/fcg/standard_dict.html";, and there's no mention of any restriction on BZERO and BSCALE. IRAF may have been complaining because the erroneous BZERO was shifting your data by another +32768. The one you had shifts data values from the range -32768-32767 (unsigned shorts) to scientific values in the range 0-65535 (unsigned shorts). On the second read, it would shift again, to the range 32768-98303.

Kindly,

Craig

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to