IRAF can't deal with .fits files

  • Thread starter PLuz
  • Start date
  • Tags
    files
In summary: It allows you to run iraf tasks from within python, so you could use python for the tasks that are easier for you and still use iraf for the rest. Hope this helps.In summary, the individual has been having trouble with FITS files from the Sloan Digital Sky Survey site when using IRAF for image reduction. The individual has tried using other programs such as Mathematica and python, but has not had success. They have also found a helpful site for viewing SDSS data. The issue seems to be with the files themselves, and the individual is now wondering how to make IRAF deal with the errors. Suggestions are given for using specific tasks and external packages to help with this issue. Additionally, the individual may find
  • #1
PLuz
64
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
  • #2
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]
 
  • #3
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?
 
  • #4
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?
 
  • #5
You may find this useful http://www.twilightlandscapes.com/IRAFtutorial/IRAFintro_01.html
 
  • Like
Likes 1 person
  • #6
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.
 
  • #7
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
 

1. Why can't IRAF deal with .fits files?

IRAF, or the Image Reduction and Analysis Facility, was developed in the 1980s and was primarily designed to work with images in the FITS (Flexible Image Transport System) format. However, as technology has advanced, newer versions of FITS have been created that IRAF may not be compatible with. Additionally, IRAF is no longer actively maintained, so any updates to support newer versions of FITS would need to be done by external developers.

2. Can I convert .fits files to a format that IRAF can work with?

Yes, there are several software programs available that can convert .fits files to a format that IRAF can handle. Some popular options include DS9, Astropy, and PyFITS. However, keep in mind that the conversion process may result in loss of data or information, so it's important to carefully consider the implications before converting your files.

3. Are there any alternatives to using IRAF for analyzing .fits files?

Yes, there are several other software programs available for analyzing FITS files, such as AstroPy, SAOImage DS9, and ImageJ. These programs are actively maintained and updated, so they may have better compatibility with newer versions of FITS and may offer more advanced analysis tools.

4. Will IRAF ever be updated to support newer versions of FITS?

At this time, there are no plans to update IRAF to support newer versions of FITS. As mentioned earlier, IRAF is no longer actively maintained and any updates would need to be done by external developers. However, there may be other software programs that offer similar functionality and better compatibility with newer versions of FITS.

5. Can I still use IRAF if I need to work with .fits files?

While IRAF may not be able to handle all versions of FITS, it is still a valuable tool for image reduction and analysis in astronomy. If you need to work with .fits files, you may need to find a way to convert them to a compatible format or consider using alternative software programs. However, for those who are familiar with IRAF and its capabilities, it can still be a useful tool in certain situations.

Similar threads

Replies
1
Views
6K
  • Astronomy and Astrophysics
Replies
1
Views
6K
  • Art, Music, History, and Linguistics
Replies
4
Views
754
Replies
9
Views
1K
Replies
10
Views
2K
  • General Discussion
Replies
6
Views
787
  • Computing and Technology
Replies
2
Views
2K
  • Astronomy and Astrophysics
Replies
3
Views
3K
  • General Discussion
Replies
13
Views
1K
  • Programming and Computer Science
Replies
9
Views
3K
Back
Top