IRAF can't deal with .fits files

  • Context: Undergrad 
  • Thread starter Thread starter PLuz
  • Start date Start date
  • Tags Tags
    files
Click For Summary

Discussion Overview

The discussion revolves around issues encountered when using IRAF to process FITS files from the Sloan Digital Sky Survey (SDSS). Participants explore the compatibility of these files with IRAF, potential errors, and alternative methods for image reduction and analysis.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Exploratory

Main Points Raised

  • One participant reports difficulties using IRAF with SDSS FITS files, noting that commands like implot and imstat return errors, while ds9 works without issue.
  • Another participant suggests using Mathematica or Python's Pyfits as alternatives to IRAF, providing sample code to examine FITS headers and data.
  • A participant expresses frustration with IRAF and notes that errors related to non-standard header keywords appear when using Pyraf, indicating potential issues with the FITS files.
  • There is a suggestion to specify the image extension when using IRAF tasks, as SDSS FITS files are in multi-extension format, and a reference to the FITSUTIL package for handling such files is provided.
  • One participant mentions a lack of time to program tasks in Python, despite acknowledging its capabilities, and appreciates a shared resource for IRAF tutorials.

Areas of Agreement / Disagreement

Participants express differing opinions on the usability of IRAF with SDSS FITS files, with some suggesting that the issue lies within the files themselves, while others point to the need for specific commands to access the data correctly. The discussion remains unresolved regarding the best approach to handle the errors encountered.

Contextual Notes

Participants note that the SDSS FITS files contain non-standard keywords that may not be recognized by IRAF, leading to errors. There is also mention of the need to specify image extensions when working with multi-extension FITS files.

Who May Find This Useful

This discussion may be useful for individuals working with IRAF and SDSS FITS files, those exploring alternatives for image reduction in astronomy, and users seeking to understand the challenges associated with non-standard FITS file formats.

PLuz
Messages
60
Reaction score
0
I've been (trying) to learn astronomy, more specifically image reduction, using IRAF. I have, though, been having problems with the fits files from the Sloan Digital Sky Survey site. For example from this archive. I can't do anything with them. Implot, imstat all give errors. Using python, numdisplay can't work with this files either, although ds9 works fine.

I assume that with IRAF everything is fine since it can work with .fits from other surveys. My insistence with the above archive is the availability of the files (I haven't been able to find other source of unprocessed files...)

Can somebody help me? Is something wrong with the files or it might be something with IRAF?
 
Last edited:
Astronomy news on Phys.org
PLuz said:
I've been (trying) to learn astronomy, more specifically image reduction, using IRAF. I have, though, been having problems with the fits files from the Sloan Digital Sky Survey site. For example from this archive. I can't do anything with them. Implot, imstat all give errors. Using python, numdisplay can't work with this files either, although ds9 works fine.

I assume that with IRAF everything is fine since it can work with .fits from other surveys. My insistence with the above archive is the availability of the files (I haven't been able to find other source of unprocessed files...)

Can somebody help me? Is something wrong with the files or it might be something with IRAF?

I've never used IRAF, but Marthematica can open FITS files and allow you to examine them or plot the data inside. Python also has a module called Pyfits (available for download here). Here is some simple code I use to examine the FITS headers and data. One of these two should allow you to determine if the problem is with the files or with IRAF, although if ds9 works then the files are probably OK.

Code:
import pyfits

file = pyfits.open("your_file.fits")
header = file[0].header
data = file[0].data

print "Header items are:",header.keys()
for name in header.keys():
    print name, " is ",header[name]
print "\n"
print "Data size is:", data.shape
print "First data element is ",data[0,0]
 
How happy would I be if instead of IRAF I could just use Mathematica, MATLAB or even python, I hate that there isn't a viable alternative...

I just tried your suggestion and right after I enter the first command (after the import) pyraf tells me:

Code:
The following header keyword is invalid or follows an unrecognized non-standard convention:
SDSS                           / THIS HEADER CONTAINS SPECIAL SDSS KEYWORDS     
The following header keyword is invalid or follows an unrecognized non-standard convention:
UNSIGNED                       / UNSIGNED DATA - NO BSCALE OR BZERO KEYWORDS

So it seems the problem is in the file. My question is then changed to: How do we make IRAF deal with this errors?
 
PLuz said:
How happy would I be if instead of IRAF I could just use Mathematica, MATLAB or even python, I hate that there isn't a viable alternative...

I just tried your suggestion and right after I enter the first command (after the import) pyraf tells me:

Code:
The following header keyword is invalid or follows an unrecognized non-standard convention:
SDSS                           / THIS HEADER CONTAINS SPECIAL SDSS KEYWORDS     
The following header keyword is invalid or follows an unrecognized non-standard convention:
UNSIGNED                       / UNSIGNED DATA - NO BSCALE OR BZERO KEYWORDS

So it seems the problem is in the file. My question is then changed to: How do we make IRAF deal with this errors?

What are you trying to do with the data that you can't do with ds9 or Python? Have you tried looking at this site, which has tools for vieing the SDSS data?
 
You may find this useful http://www.twilightlandscapes.com/IRAFtutorial/IRAFintro_01.html
 
  • Like
Likes   Reactions: 1 person
To phyzguy:
There's nothing specific that I want to do with the images that I can't do with python, the thing is that I don't have time to program all the tasks on python. Sure there are some repositories but they don't have all the tasks and time is an issue right now.

To Chronos:
That site is really a big help. Thank you for this reference it has proven to be very helpful.
 
The SDSS FITS files are in MEF (multi-extension FITS) format, and so you need to specify the image extension to the iraf task, e.g.

cl> imstat sdss.fits[1]

where the "[1]" specifies image extension one (the usual image, others include BINTABLES that cannot be used with image tasks). The FITSUTIL external package has some tasks for dealing with MEF that may help, esp the FXHEADER task that will list the extensions. If you just want to deal with the image you can copy it out of the file using

cl> imcopy sdss.fits[1] new.fits
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
17
Views
6K
  • · Replies 1 ·
Replies
1
Views
5K
Replies
8
Views
5K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
10
Views
5K
  • · Replies 2 ·
Replies
2
Views
489
  • · Replies 1 ·
Replies
1
Views
3K