Reducing ATCA data with AIPS and Miriad

This documents provides a very brief instruction on how spectral line mosaics observed with the Australia Telescope Compact Array (ATCA) can be reduced with AIPS and Miriad in a combined approach. The advantage of using two different software packages is that we can benefit from the comfortable and interactive flagging tasks of AIPS on the one hand and the convenient and easy handling of mosaic observations in Miriad on the other hand.
To understand the different steps in the data reduction process the reader should already be familiar with the principles of interferometry and data reduction. For more information about Miriad and the individual Miriad tasks use the command help
in your Miriad session or consult the Miriad User's Guide. For detailed information about data reduction with AIPS, please consult the AIPS Cookbook.
The instructions given below are only valid for data taken with the old correlator at the ATCA. With the installation of the broadband correlator (CABB) in early 2009 some of the reduction steps described below will not work anymore and need to be modified (see remark further down this page).
1. Read original ATCA data files into AIPS
TASK 'ATLOD'
INFILE 'DISK:FILENAME'
APARM -1,0
...
By setting APARM(1) = -1
, the linear polarisations XX and YY will be relabelled as RR and LL. Since we are using AIPS for flagging only, this has no negative effect, but it is required for some AIPS tasks to work correctly.
2. Interactive flagging of bad data
TASK 'SPFLG'
GETN n
...
3. Write flagged data files to disk
TASK 'FITTP'
GETN n
OUTFILE 'DISK:FILENAME'
...
4. Read flagged data files into Miriad
fits op=uvin in=<infile> out=<outfile>
At this point, Miriad will automatically rename the polarisations into XX and YY again. A corresponding message should be displayed in the terminal window.
5. Apply flags
fgflag vis=<infile>
6. Concatenate all data files into one
uvcat vis=<infile1>,<infile2>,... out=<outfile>
7. Split data file up into individual sources
uvsplit vis=<infile> options=mosaic
8. Check gain amplitudes
uvspec vis=<infile> select="antennae(1,2)(1,2)" interval=0 axis=channel,amplitude device=/xs nxy=1,1
uvplt vis=<infile> axis=time,amplitude options=nobase nxy=1,1 device=/xs
9. Flag absorption lines, shadowed antennas, and bad data
uvflag vis=<infile> line=channel,<n>,<n0>,<dn>,<i> flagval=flag
uvflag vis=<infile> select="shadow(25)" flagval=flag
blflag vis=<infile> axis=time,amplitude device=/xs stokes=xx [or yy]
where applicable. It is wise to specify a somewhat larger value of 25 m instead of the true antenna diameter of 22 m when flagging shadowed data to allow for some “safety margin”.
10. Obtain bandpass solution
mfcal vis=<primary> interval=20,20 options=interpolate
(Only for primary calibrator.)
11. Check bandpass solution
gpplt vis=<primary> device=/xs yaxis=amp options=bandpass nxy=3,2
gpplt vis=<primary> device=/xs yaxis=phase options=bandpass nxy=3,2
12. Copy bandpass solution to secondary calibrator
gpcopy vis=<primary> out=<secondary> options=nopol,nocal
13. Obtain gain solutions
mfcal vis=<secondary> interval=5,5 options=nopassol
(Only for secondary (gain) calibrator.)
14. Check gain solutions
gpplt vis=<secondary> device=/xs yaxis=amplitude options=gains nxy=3,2
gpplt vis=<secondary> device=/xs yaxis=phase options=gains nxy=3,2
15. Apply flux calibration
gpboot vis=<secondary> cal=<primary>
(It seems like mfboot
is a better alternative.)
16. Copy bandpass and gain solutions to source file
gpcopy vis=<secondary> out=<source>
17. Apply bandpass and gain corrections
uvcat vis=<source> out=<outfile>
It seems that this step is no longer required as the following task, uvlin
, will automatically apply existing bandpass and gain tables.
18. Subtract continuum
uvlin vis=<infile> out=<outfile> chans=x1,x2,... order=2 mode=line
19. Create dirty beam and map
invert vis=<infile> map=<mapfile> beam=<beamfile> imsize=140 cell=30 robust=0 line=channel,dn,n1,1,1 options=double,mosaic
Please substitute appropriate values for imsize
, cell
, and sup
!
20. Deconvolve dirty map
mossdi map=<mapfile> beam=<beamfile> out=<modelfile> niters=100000 cutoff=0.05 region="polygon(x1,y1,x2,y2,...)"
Please substitute appropriate values for cutoff
.
21. Restore clean map
restor model=<modelfile> beam=<beamfile> map=<mapfile> out=<outfile>
At this point we are done with the data reduction and image deconvolution. Both AIPS and Miriad can be used for the calculation of moment maps and further data analysis.
Using Miriad only
Of course it is possible to use Miriad for the entire reduction. In this case, data files can be read in with:
atlod in=infile1,infile2,... out=outfile options=birdie,noauto,noif
All flagging must be done with the corresponding Miriad tasks, e.g. uvflag
. After flagging one can proceed with point 7 in the above list (splitting up the data file into individual sources).
Handling CABB data
Unfortunately, AIPS cannot handle the CABB data format. Hence, all CABB data will have to be read and processed with Miriad only. We can use the task atlod
for this purpose:
atlod in=<infile> out=<outfile> ifsel=4 options=birdie,rfiflag,noauto,nopol,hanning
In order to save disk space it is wise to restrict the amount of data being read in, for example by rejecting autocorrelations, XY and YX correlations, and by applying a Hann filter to the frequency axis. IFs 1 and 2 are the two continuum bands, whereas IFs 3 and higher refer to the different zoom bands present in the data (the example above would read in the second zoom band encountered). Data reduction can then proceed as normal with point 6 in the list above (concatenating all data files).
Another way of reducing the data volume of CABB data even further is by running the task uvaver
to average over a given number of spectral channels and exclude data from antenna 6 (if not required):
uvaver vis=<infile> out=<outfile> select="antennae(1,2,3,4,5)(1,2,3,4,5)" line=channel,N,n0,dn,dn
Here, N
is the new number of channels, n0
is the start channel in the original data, and dn
denotes the number of original channels to average over.
Self-calibration
In principle it is possible to self-calibrate on bright continuum sources in the mosaic field after successful gain calibration in order to obtain more accurate gain solutions at a better time resolution than the large interval between calibrator observations. When reducing CABB data, self-calibration may even be mandatory due to general instabilities in the CABB system that can lead to large phase variations and jumps. First of all, a continuum file must be created from the calibrated visibility data file, using the Miriad task uvlin
with mode=chan0
(see point 17). This continuum file must be inverted, deconvolved, and restored as described in points 19–21. The following steps are then required for self-calibration:
demos map=<modelfile> vis=<continuum> out=<template> options=detaper
The task demos
splits the mosaic of the model created by mossdi
up into individual pointings again. <continuum>
is the continuum visibility data file to be calibrated, and <template>
is a template for the names of the individual model files created by demos
. Each file name will automatically be complemented by a number.
selfcal model="<template>*" vis=<continuum> options=phase,mosaic interval=10 refant=3
This will self-calibrate on the continuum sources using the models of the individual pointings created before. Note that a wildcard can be used to address all files at once. Again, <continuum>
is the continuum visibility data file to be calibrated. The interval for gain solutions should be chosen such that reliable solutions can be obtained without the phase solutions becoming too noisy. It may also be advisable to calibrate phases only (which is the default behaviour of selfcal
).
Note that the task selfcal
will automatically adjust the interpolation tolerance of the gain solution to the same value as the interval
option. When a mosaic is processed, this may not be sufficient, and the interpolation tolerance should be changed again to a value large enough to cover an entire mosaic cycle, e.g.
puthd in=<infile>/interval value=0.020833333
will set the tolerance to half an hour (value
must be given in days). The self-calibrated data can then be inverted, deconvolved, and restored again to check the quality of the new gain solution. If required, the entire self-calibration procedure can be iterated two or three times to gradually improve the solution. In the end, the final solution must be copied to the spectral-line visibility data file with gpcopy
.
Velocity conversion
Instead of using spectral channels, it is also possible to specify velocities in invert
. Before doing this, however, we must apply the correct frequency-velocity relation to our uv data. First of all, we have to write the correct rest frequency into the header. For the HI line, e.g., we would define
puthd in=<infile>/restfreq value=1.4204057517667 type=double
Next, we must set the desired velocity rest frame, using the Miriad task uvredo
. In the following example the local standard-of-rest frame (lsr
) has been chosen, but the values barycentric
and observatory
are also possible:
uvredo vis=<infile> out=<outfile> options=velocity velocity=lsr
Having applied uvredo
to our uv data, we will be able to specify velocities in invert
which will provide us with a data cube with correct radial velocities in the specified rest frame. This is absolutely crucial when combining data from different observing runs which would otherwise not be properly aligned in the spectral dimension.