feedburner
Enter your email address:

Delivered by FeedBurner

feedburner count
Showing posts with label IDL. Show all posts
Showing posts with label IDL. Show all posts

Reading FITS 1-D spectrum using IDL

Labels:

There are many IDL routines available for reading FITS file, a standard for astronomical data, but I have never been happy with their use for pretty simple thing of displaying the spectrum of the object. fits_read gives you the header and flux, but never the wavelength scale. readfits can also be useful, but it does so many other things, that I decided to write reading routine on my own.


Of course, I had to make use of fits_read to get the header and flux information from the FITS file. What is actually missing is the wavelength scale. So I create a wavelength array by taking header information from the FITS file. Header saves the value of the starting wavelength as CRVAL1 and the size of the increment as CDELT1. Now creating the wavelength array is not that difficult. My IDL routine is called myreadfits.pro and the source code is given below.



pro myreadfits, file, wavel, flux

fits_read, file, flux, header

crpos=where(strmid(header,0,6) eq "CRVAL1")
cr=strmid(header[crpos[0]],9,60)+0.
cdeltpos=where(strmid(header,0,6) eq "CDELT1")
cdelt=strmid(header[cdeltpos[0]],9,60)+0.
wavel=findgen(n_elements(flux))*cdelt+cr

end


Reblog this post [with Zemanta]




IDL resources unfurled

Labels:

IDL, Interactive Data Language, is quite a popular scientific computing application provided by ITT Visual Information System. It's usefulness can be seen with data analysis, scientific visualization and, best of all, its cross-platform development support. There are many introductions to IDL available online. In this blog, I shall be concentrating more on its usefulness towards some applications in the Astronomy and Astrophysics.