View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

reading fits errors

douglas brenner wrote on Dec 16, 2008

ds 9 opens a multiple extension fits file but iraf can't read it. !!?

ERROR: FXF: EOF encountered while reading FITS file

code : magnify ( input = filename//"["//str(J)//"]", ...

help
thanks

Mike Fitzpatrick wrote on Dec 16, 2008

The usual cause of this is that the physical FITS file is not an integer multiple of 2880 byte blocks. I believe (but can't verify) that DS9 (more precisely, the CFITSIO library it uses) is a bit more forgiving about such things. See the REBLOCK task as a way to reblock the file to the proper size. Otherwise, are you sure the 'str(j)' is a valid extension?

-Mike

douglas brenner wrote on Dec 16, 2008

Thanks

str(j) is valid. I will look into reblock.
The file was made using the CFITSIO library; its 250x250x23. Is there a way to solve this problem when the file is written.

douglas brenner wrote on Dec 16, 2008

reblock (infiles = filename//"["//str(j)//"]", outfiles = "/Users/dsb/data/tmp.fits[0,overwrite]" )

Mike Fitzpatrick wrote on Dec 16, 2008

The file was made using the CFITSIO library; its 250x250x23. Is there a way to solve this problem when the file is written.


CFITSIO should produce a properly blocked image, however the NULL padding can sometime be removed when e.g. copying from a remote machine, restoring from tape, etc depending on the command used.

I wonder though whether you're using the extension syntax correctly though: Is this an MEF of 250x250 images with 23 extensions or simply a simple 3-D FITS file and you're trying to create a section to access one of the bands?? The code snippet you showed implies the former but if this isn't really an MEF file the error is explained by the invalid section. If what you want is to access a specific band of the 3-D data then you need to represent the entire image section, e.g.

magnify ( input = filename//"[*,*,"//str(J)//"]", ...


I seem to have misremembered how REBLOCK works since for disk files it uses the default block size (i.e. 4096) for disk files unless this is a tape device. You can force the padding using host commands like 'dd' but I'm not sure improper size is your problem.

-Mike

Last post on Dec 16, 2008