View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Rfits task question

Gabriel wrote on Jul 08, 2009

Hi,

this is a very simple question. I have a *.fits file about 63Mb. After I run rfits on that file (with 'datatype = ushort') I get apparently exactly the same image file, except this new file is exactly half the size of the original one.
I've read the help in IRAF about 'rfits', but it doesn't say much (or maybe I'm not understanding everything)
Anyway, I would really appreciate if someone explained to me what this task does, and why is it reducing the size of my file.

Thanks!
Gabriel

Mike Fitzpatrick wrote on Jul 08, 2009

What is the BITPIX value in the original FITS image? If it is 32 or -32 then then data are stored as 4-byte integer or as real respectively, doing the RFITS conversion to type ushort writes the image out (possibly with overflow of the values) as 2-byte values in the iraf image. Does an IMSTAT on the input and output image show the same results?

Note that RFITS is used to convert .fits files to .imh files, however if your 'imtype' environment variable is set the 'fits' (as it is in v2.14) and you don't explicitly provide a .imh extension on the output filename, the default output image type is also FITS. You can use FITS images directly in the system without converting them.

-Mike

Gabriel wrote on Jul 08, 2009

Hi Mike,

IMSTAT on the original (63 Mb) file reports:

NPIX MEAN STDDEV MIN MAX
164 -1438. 1550. -8311. 9.309

and this is the output of the 'rfits' on the original (63 Mb) file:

size=4064x4064 bitpix=-32 scaling=none pixtype=ushort
WARNING: FITS extensions may be present

This way I get a new (31.5 Mb) file, and IMSTAT on this file gives:

NPIX MEAN STDDEV MIN MAX
2 5.5 4.95 2. 9.

Does this 4-byte to 2-byte conversion affect the image in any way (if this is what's actually happening)?
I mean: will this 'rfits' process affect the data I obtain from the image frame (after the CCD photometry is done)?
This of course is critical, and I'm not sure that this conversion doesn't affect it (and if it doesn't affect the results: why use a larger file in the first place?, why not convert all files to 'ushort' type?)

Thanks a lot for your time and help,
Gabriel

Mike Fitzpatrick wrote on Jul 08, 2009

The RFITS output shows bitpix=-32 meaning the data are stored as real (4-byte) and so converting to ushort not only stores 2-byte pixels but is truncating the floating-point values to unsigned integer values. Of course there is a difference between floating-point and ushort data and they are NOT interchangeable for analysis,

If you don't explicitly request a change in data type the values will be preserved, but as I said, you don't need to do the conversion to use the file.

-Mike

Last post on Jul 08, 2009