RATRAN : get RESTFREQ written to FITS file

Current versions of RATRAN (http://www.sron.rug.nl/~vdtak/ratran/) does not put the FITS keyword RESTFREQ and the corresponding value in the output FITS-files by default. Below is a quick fix that I forgot to note down when I figured it out and thus had to rediscover twice…

Note about getting FITS output working:
make sure your shell variable CFITSIO is set to the path where it is installed, on my Ubuntu 13.04 this is CFITSIO=/usr/include:/usr/lib/x86_64-linux-gnu/:/usr/lib (several paths to make sure its correct) and also the LD_LIBRARY_PATH path (e.g. LD_LIBRARY_PATH=$LD_LIBRARY_PATH/usr/include)

So for the RESTFREQ to be printed we need to add it to the routine ‘openfits’, so edit ‘Ratran_install_dir/sky/openfits.f’

first add restfreq to the definition of the routine
change

SUBROUTINE openfits(lout,outname,naxis,naxes,status)

to

SUBROUTINE openfits(lout,outname,naxis,naxes,status,restfreq)

 then define the type

DOUBLE PRECISION restfreq

this should be added after the declaration of the other variables, i.e. after these lines

      INTEGER lout,blocksize,bitpix,status,naxis,naxes(3)
    LOGICAL simple,extend
    CHARACTER outname*60

then we need to tell it when and how to write it to the fits, so just after all the other header keywords are written, i.e.


call ftpkyd(lout,’CDELT3′,dble(velres),-8,”,status)
call ftpkyd(lout,’CRPIX3′,dble(nchan/2+1),-8,”,status)
call ftpkyd(lout,’CRVAL3′,0.d0,-8,”,status)

we add

call ftpkyd(lout,’RESTFREQ’,dble(restfreq),-8,”,status)

So now the function openfits can add the restfeq keyword, but now we also need to add this input argument to the call of that routine.
Save and close openfits.f, and open ‘Ratran_install_dir/sky/fmain.f’ and in this file, find the line that call the openfits rouitine, i.e. use the find function of your editor and search for ‘openfits’
Change the line

call openfits(lout(iline),outname,naxis,naxes,status)

to

call openfits(lout(iline),outname,naxis,naxes,status,nu(iline))

and done!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

RELATED POST

Raspberry Pi baby monitor – Hardware, part 1

Raspberry Pi baby monitor In this first of a multi-part post I will show my build of a Raspberry Pi…

Sync FitBit with Google Fit

Finally: sync FitBit and Google Fit at high time resolution! I have been trying to figure out a way to…

Monitor dependent setup in i3wm

Multiple configurations for different monitor setups in i3wm General Figure 1:¬†Anyone that recognize this image might find this "guide" useful!…

Installing IRAM GILDAS on Ubuntu

    Figure: Screenshot of GILDAS MAPPIN in action viewing an imported FITS spectral cube.Fore information on IRAM GILDAS, see http://www.iram.fr/IRAMFR/GILDAS/…

%d bloggers like this: