How to reduce ACSIS data with CLASS
Reducing ACSIS data with CLASS
To run the GILDAS software
(class, greg, etc) first type (or enter this in your .login file):
setenv GAG_ROOT_DIR /jcmt_sw/CLASS/GILDAS
setenv GAG_EXEC_SYSTEM x86_64-redhat-g95
source $GAG_ROOT_DIR/etc/login
The latest installed version (December 2010c) can be reached at all 64-bit
machines.
If you prefer to use CLASS and other Gildas software to reduce your spectra these
are the steps to take:
(at this moment one is working in Grenoble on methods to do the conversion in CLASS itself)
First make cubes of the ACSIS data with makecube or ORACDR.
Then extract subcubes of dimension 1,1,nspec from the cubes in NDF format and
convert these to FITS format.
Read the FITS files into CLASS.
This can be done with the
kappa
command
ndfcopy and the
convert
command
ndf2fits.
The following assumes that you are using the most recent
(Deneb) release of the Starlink
software.
to FITS
If you have multisubsystem observations made with RxA3, where the first subband is in LSB (USB)
and another is in USB (LSB), you have to change the sideband in the header of the USB (LSB)
cube:
kappa
wcsattrib file.sdf set sideband USB (LSB)
The simplest ways to convert .sdf files to FITS format is for:
RxA3 and RxW (single spectra):
convert
ndf2fits file.sdf file.fits encoding="fits-class"
RxA3, HARP, RxW (maps) - one single spectrum from position (1,1) in map:
kappa
ndfcopy in='file(1,1,)' out=file.sdf exten
./cubecopy file.sdf file_cc.sdf
convert
ndf2fits file_cc.sdf file.fits encoding="fits-class"
The parameter exten in ndfcopy extracts header arrays (e.g. Tsys, Trec, exposure time) correctly when copying the
cubes.
Cubecopy copies the cube, and updates the median values of the FITS header parameters
MEDTSYS, EFF_EXP, and EFF_TIME.
To convert maps one needs to do this for all positions in the map.
This is an example of a csh script that finds the dimensions of a cube
and extract all spectra
#!/bin/csh -f
#
# Use: scriptname [ndf_file_name]
#
source /star/etc/login >& /dev/null
source /star/etc/cshrc >& /dev/null
kappa >& /dev/null
convert >& /dev/null
if (`alias kappa` == "") then
echo ""
echo "Fatal: Initialization error of kappa environment"
echo ""
exit
endif
# Get the input NDF and strip .sdf extension
if ($# == 0) then
set def = `parget data_array GLOBAL`
echo -n "Input MAKECUBE cube /$def/ > "
set file = $<
if ("$file" == "") then
set file = $def
else if ("$file" == "\!" || "$file" == "\!\!") then
echo ""
exit
endif
else
set file = "$argv[1]"
shift
endif
set file = `echo $file | cut -d\. -f1`
# Find dimensions of the NDF file
ndftrace ${file} >& /dev/null
set dims = `parget dims ndftrace | head -1`
set lbnds = `parget lbound ndftrace | head -1`
set ubnds = `parget ubound ndftrace | head -1`
set xsize = $dims[1]
set ysize = $dims[2]
set xmin = $lbnds[1]
set xmax = $ubnds[1]
set ymin = $lbnds[2]
set ymax = $ubnds[2]
echo "Map size read in : $xsize x $ysize "
echo "Xrange read in : $xmin to $xmax "
echo "yrange read in : $ymin to $ymax "
# Extract individual spectra from the NDF and convert to FITS
@ nr = 0
@ i = $xmin
while ($i <= $xmax)
@ j = $ymin
while ($j <= $ymax)
ndfcopy in="${file}(${i},${j},)" out=${file}_${i}_${j} exten
./cubecopy ${file}_${i}_${j} ${file}_cc_${i}_${j}
ndf2fits ${file}_cc_${i}_${j} ${file}_${i}_${j}.fits encoding="fits-class"
echo "Finished ${file}_${i}_${j}.fits"
@ nr ++
@ j ++
end
@ i ++
end
stats "${file}(,,~1)" >& /dev/null
set nrpix = `parget numpix stats | head -1`
echo "-----------------------------------------"
echo "$file has $nrpix spectra."
echo "Routine created $nr fits files."
echo "-----------------------------------------"
to CLASS
These files can be converted into class format
%class
LAS90>file out jcmtdata mul (or sin)
LAS90>fits read file.fits
(or alternatively)
LAS90>fits read "/dir/subdir/file.fits"
LAS90>write n
(note: if the scannumber is missing in the fits header one needs to give
a number when writing to the output file, or it will be put to 1)
If you have large maps it is useful to do the conversion to
class format with a commandfile, e.g.
%ls *.fits > files.class
and then edit files.cfits with your favourite editor from
file.fits
to
fits read file.fits
write 1
etc
then
%class
to start class
LAS90>@files.class
Problems
Currently there are some problems with the FITS files converted in this
way.
Some header variables don't have the expected name in the FITS files.
To correct this, enter in CLASS before reading the file:
LAS90> sic\symbol OBSNUM SCAN-NUM
LAS90> sic\symbol NSUBSCAN SUBSCAN
LAS90> sic\symbol MEDTSYS TSYS
LAS90> sic\symbol EXP_TIME OBSTIME
LAS90> sic\symbol LINE NOTAKEY
LAS90> sic\symbol MOLECULE LINE
Note:
The SCAN number is missing (and put to 1 by class) when the ACSIS
spectrum is the sum of many spectra; the CLASS parameter NUMBER remains 0.
There is a FITS keyword LINE, but it is empty (CLASS LINE is part of MOLECULE).
The FITS keyword OBSID (present when the spectrum is from a single observation)
causes a warning for unknown reason.
The FITS spectrum may contain an extension image with the variance which
causes a warning. If this is a problem it can be removed with a KAPPA command from the sdf file, e.g. erase file_cc.sdf.variance
Other header parameters which are missing are:
tau (not calculated for ACSIS data)
weather parameters
beameff
forweff
All class spectra will have the observed position in the header
(offsets are 0 0 for every position in a map).
So in class one may want to modify the positions:
In order to do that one has to modify the projection to 'radio' (7).
set var pos wr
let proj 7
modi pos hh:mm:ss.ss dd:mm:ss
Because of limitations of the CLASS headers, observations made with very large radial velocities
will have incorrect velocities and velocity resolutions in CLASS. It is recommended in
such cases to observe with a calcalated sky frequency and velocity 0 km/s.
For help within class, greg, etc type help, or look at the
GILDAS homepage.
In the newest version of Greg/Graphic the Explain command is not working. Here is a
list of available tasks (run task).
Jan Wouterloot
|