Re: howto make a fits cube in IDL? [message #56661 is a reply to message #56659] |
Wed, 07 November 2007 11:54  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
On Nov 7, 10:45 am, Tigran Khanzadyan <khanzad...@gmail.com> wrote:
> Dear All,
>
> I wish to create a FITS-CUBE from a model outcome in order to directly
> compare with the radio observations. So the task is to actually write
> on disk a Fits file which would have x,y and a spectra on each x,y
> position. A spectra itself has two dimensions - temperature and
> velocity.
>
> I was wondering if someone could point me to the right direction. I
> know that there is a "writefits" in NASA IDL ASTRO LIBRARY, but I cant
> quite find a task or routine to write FITS-CUBE.
This looks like a case for using the "Binary table" FITS format.
The routines MWRFITS and MRDFITS give a nice mapping between IDL
structures and FITS binary tables. So say you have 200 X,Y points and
that at each X,Y you have a temperature and velocity spectrum with 60
points.
IDL> str = {x:0, y:0, temperature:fltarr(60), velocity:fltarr(60) }
IDL> str = replicate(str, 200)
(If the number of points are not all the same in each spectra then you
could use pointers rather than fixed arrays.)
Then you fill the structure with the actual values, and finally write
the structure to a FITS file
IDL> mwrfits,str,'myfile.fits'
--Wayne
|
|
|