Starlink, pamela and molly use the .ndf (n-dimensional format) file format, which for two-dimensional images uses .sdf as a suffix. If your original files are in .fits format (they usually are!), then the first thing to do is to convert them into .sdf format using the Starlink package convert, which may need to be invoked by typing
Now we will use this package to convert each file from .fits to .sdf by typing a foreach loop at the command line:
foreach file (*.fits) fits2ndf $file $file:r end
Now you save disk space by throwing your .fits files into a .tar.gz file because you won't be needing them again:
tar -cvzf fitsfiles.tgz *.fits
In general, only homogeneous data can be reduced together in one go. You must therefore separate out data which was taken using different gratings or wavelength ranges. It's also a very good idea to do each night's observations separately.
The details on reducing spectra will be given for one image only. The same techniques can be used for all types of grating spectroscopy, but the precise reduction parameters will differ for datasets which cover different wavelength ranges or were taken using different gratings, etc. Once we get to the automated reduction, each different dataset will require its own parameter file.
For ESO .fits files, the file-name conventions can be very irritating because they often contain several full stops. This will cause the above command to fail as the shell doesn't know which full stop is the one which indicates the filename tail (the .sdf bit). You may also need to separate images from different CCDs taken at the same time (e.g., when using VLT/FORS2). Shell scripts for this kind of thing can be found in my page on VLT/FORS2 data. This shell script gets around both of these problems, converts your .fits files to .sdf files, and creates a list of initial and final names (but may need minor adjustments for other datasets). It will put each set of images from one CCD (indicated by the header keyword 'EXTNAME' in this case) into its own directory:
#!/bin/tcsh starlink kappa figaro convert if ( -e ~/adam/fits2ndf.sdf ) rm ~/adam/fits2ndf.sdf foreach infile (*.fits) set outfile = `echo $infile | sed s/:/-/g ` set outfile = `echo $outfile | sed s/T/_/g` set outfile = `echo $outfile | sed s/FORS2.//g` set outfile = $outfile:r:r".fits" set ccd = `fitshead $infile | grep EXTNAME` set ccd = `echo $ccd | sed s/"'"//` if ( -e $ccd ) then if ( ! -d $ccd ) then echo '### Problem: cannot create directory $ccd' end endif else mkdir $ccd endif fits2ndf $infile $ccd/$outfile:r echo $infile $outfile >> rename.lis end exit