VLBA AIPS ans CASA Guide

From CASA Guides
Revision as of 19:05, 10 November 2022 by Jlinford (talk | contribs)
Jump to navigationJump to search

The Guide walks through the calibration of the data set used in the VLBA Basic Phase-referencing Calibration and Imaging tutorial. It presents the steps that should be taken to calibrate the data using both AIPS and CASA. In several cases the AIPS VLBAUTIL procedures are shown, as well as the AIPS tasks that those procedures call. To use the VLBAUTIL procedures, first enter 'run vlbautil' in AIPS to initialize all of the procedures.

Note that some steps are performed in different order depending on whether you are using AIPS or CASA. Also, be aware that not all tasks in AIPS have an equivalent task in CASA (yet).

To follow along with this Guide, users should download the TL016B.idifits data set used in the VLBA Basic Phase-referencing Calibration and Imaging tutorial.

Initial Calibration

This first section shows the steps for the initial calibration (instrumental delay, fringe fitting, bandpass correction).

Loading Data

Both AIPS and CASA need to take the FITS-IDI file and convert it into a format they can use. AIPS uses the UVDATA format, and CASA uses the Measurement Set (MS) format.

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
VLBALOAD
datain 'TL016B.idifits
outname 'TL016B'
FITLD
datain 'TL016B.idifits
outname 'TL016B'
clint 0.25
importfitsidi
fitsidifile='TL016B.idifits'
vis='tl018b.ms'
constobsiid=True
scanreindexgap_s=15


Observation Summary

Printing a summary of the observation is often useful for identifying the fringe finder, bandpass calibrator, phase reference calibrator, and science target. It is also useful for locating a good time range to use for the instrumental delay correction.

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
VLBASUMM
inname 'TL016B'
inclass 'UVDATA'
inseq 1
docrt 132
PRTAN
inname 'TL016B'
inclass 'UVDATA'
inseq 1
docrt 132
dotv 1
listobs
vis='tl016b.ms'
LISTR
inname 'TL016B'
inclass 'UVDATA'
inseq 1
optype 'scan'

NOTE: To have listobs save the osbervation summary to a file called 'tl018b_listobs.txt', set listfile='tl016b_listobs.txt'.


Quacking the Data

"Quacking" refers to flagging the beginning and/or end of each scan in an observation. This is a completely optional step, but it is often useful for VLBA data.

Flag the first 4 seconds of each scan.

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
none QUACK
datain 'TL016B.idifits
inclass 'UVDATA'
inseq 1
opcode 'BEG'
aparm 0 4/60 0
flagdata
vis='tl018b.ms'
mode='quack'
quackmode='beg'
quackinterval=4.0
quackincrement=True

Flag the last 4 seconds of each scan.

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
none QUACK
datain 'TL016B.idifits
inclass 'UVDATA'
inseq 1
opcode 'ENDB'
aparm 0 4/60 0
flagdata
vis='tl018b.ms'
mode='quack'
quackmode='endb'
quackinterval=4.0
quackincrement=True


Automated Flagging

The VLBA Basic Phase-referencing Calibration and Imaging tutorial shows users how to run the TFCrop automated flagging routine on the data to remove some time-based RFI. AIPS does not have an equivalent task to TFCrop, but users can opt to user the RFLAG automated flagging after the bandpass corrections have been applied (later in the calibration).

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
none none flagdata
vis='tl016b.ms'
mode='tfcrop'
datacolumn='data'
timecutoff=4.0
flagdimension='time'
action='calculate'
display='both'

With action='calculate', no flags will be generated. Instead, you should just verify that the TFCrop flagging is doing what you expect. You can always click 'Quit' and adjust the timecutoff parameter as you see fit.

Once you are satisfied that the program is going to flag things appropraitely, set action='apply' and run it again.

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
none none flagdata
vis='tl016b.ms'
mode='tfcrop'
datacolumn='data'
timecutoff=4.0
flagdimension='time'
action='apply'
display='both'

Double check that the flags look appropriate, then click "Stop Display" to have the TFCrop routine set and apply the flags.

For some obesrations, especially at frequencies below 4 GHz, it will be useful to have TFCrop look for RFI in both frequency and time. In this case, set fladimension='freqtime' (the default), and freqcutoff=3.0. Check that the flags look appropriate and adjust the freqcutoff parameter as necessary before applying the flags.


Flagging "By Hand"

The VLBA Basic Phase-referencing Calibration and Imaging tutorial includes a significant amount of additional flagging. AIPS users should start their flagging by using the graphical tools FTFLG, SPFLG, and TVFLG. CASA does not have equivalent graphical flagging tools. CASA users can try using the viewer to display the data in a manner similar to SPFLG and TVFLG, as described in Section 2.1.2 of VLBA Scientific Memo #38. However, the CASA viewer is not very reliable, especially for creating flags.

Fortunately, both AIPS and CASA have tasks for creating flags without a graphical interface. Here are examples of flagging some of the data:

Flag all baselines to HN on final scan of 4C39.5

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
none UVFLG
datain 'TL016B.idifits
inclass 'UVDATA'
inseq 1
timerange 0 12 13 23 0 12 16 53
antennas 3
opcode 'FLAG'
reason 'HNLOW'
flagdata
vis='tl018b.ms'
mode='manual'
field='4C39.25'
antenna='HN'
scan='181'

NOTE: Entering a short note in the reason adverb in UVLFG can be useful if the flags need to be undone at some point.

Flag the BR-PT baseline on scan 10

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
none UVFLG
datain 'TL016B.idifits
inclass 'UVDATA'
inseq 1
timerange 0 6 30 57 0 6 31 37
antennas 1 9 0
opcode 'FLAG'
reason 'BRPT10HOT'
flagdata
vis='tl018b.ms'
mode='manual'
field='J1154+6022'
antenna='BR&PT'
scan='10'

To see all the flags that are recommended for this observation, refer to the VLBA Basic Phase-referencing Calibration and Imaging tutorial.


Total Electron Content Correction

To make the TEC correction using TECOR, you will first need to download the appropriate TEC file from ftp://gdc.cddis.eosdis.nasa.gov/gps/products/ionex/. The VLBATECR procedure will download the necessary file automatically.

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
VLBATECR
inname 'TL016B'
inclass 'UVDATA'
inseq 1
TECOR
inname 'TL016B'
inclass 'UVDATA'
inseq 1
aparm 1 0
infile ' tec file '
no equivalent CASA task yet

NOTE: Do not use the tec_maps tool with VLBA data. It does not work properly for VLBI observations.


Earth Orientation Parameter Correction

To make the EOP correction using CLCOR, you will first need to download the appropriate file from ftp://cddis.gsfc.nasa.gov/vlbi/gsfc/ancillary/solve_apriori/usno_finals.erp. The VLBAEOPS procedure will download the necessary file automatically.

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
VLBAEOPS
inname 'TL016B'
inclass 'UVDATA'
inseq 1
CLCOR
inname 'TL016B'
inclass 'UVDATA'
inseq 1
opcode 'eops'
infile ' eop file '
no equivalent CASA task yet


Sampler Corrections

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
VLBACCOR
inname 'TL016B'
inclass 'UVDATA'
inseq 1
ACCOR
inname 'TL016B'
inclass 'UVDATA'
inseq 1
solint -0.5
accor
vis='tl016b.ms'
caltable='tl016b.accor'
solint='30s'
SNSMO
inname 'TL016B'
inclass 'UVDATA'
inseq 1
inver 0
samptype 'mwf'
smotype 'ampl'
cparm 0.5 0 0 0 0 1
outvers 0
smoothcal
vis='tl016b.ms'
tablein='tl016b.accor'
caltable='tl016b_smooth.accor'
smoothtype='median'
smoothtime=1800.0
CLCAL
inname 'TL016B'
inclass 'UVDATA'
inseq 1
opcode 'cali'
interp 'self'
snver 0
dobalnk -1
gainver 0
gainuse 0
applycal
vis='tl016b.ms'
gaintable=['tl016b_smooth.accor']
interp=['nearest']
parang=True


A Priori Calibration

When calibrating VLBA data in CASA, it is usual to generate the a priori calibration tables at this point: gain curve and system temperature. This step is unnecessary in AIPS because the gain curve (GC) and system temperature (TY) tables are created automatically with FITLD or VLBALOAD.

Gain Curve

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
none, done in VLBALOAD none, done in FITLD gencal
vis='tl018b.ms'
caltable='tl016b.gcal'
caltype='gc'

System Temperature

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
none, done in VLBALOAD none, done in FITLD gencal
vis='tl018b.ms'
caltable='tl016b.tsys'
caltype='tsys'
uniform=False


Instrumental Delay Correction

NOTE: Many VLBA users are likely familiar with the VLBAUTIL procedure VLBAPCOR and the associated AIPS task PCCOR, which use the pulse-cal tone information from the VLBA to correct for the instrumental delay. CASA does not currently have a means of working with the pulse-cal tones, so it cannot use this functionality. It is an area of active development for the NRAO and JIVE CASA software engineers and scientists.

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
VLBAMPCL
inname 'TL016B'
inclass 'UVDATA'
inseq 1
timerang 0 9 17 0 0 9 18 0
calsour '4C39.25'
refant 2
opcode 'CALP'
FRING
inname 'TL016B'
inclass 'UVDATA'
inseq 1
docal 1
gainuse 0
timerang 0 9 17 0 0 9 18 0
solint 0
calsour '4C39.25'
refant 2
aparm(1) 2
dparm(1) 1
dparm(8) 1
snver 0
fringefit
vis='tl016b.ms'
caltable='tl016b.sbd'
field='4C39.25'
timerange='09:17:00~09:18:00'
solint='inf'
zerorates=True
refant='FD'
minsnr=10
gaintable=['tl016b_smooth.accor', 'tl016b.gcal', 'tl016b.tsys']
interp=['nearest', 'nearest', 'nearest,nearest']
parang=True
CLCAL
inname 'TL016B'
inclass 'UVDATA'
inseq 1
timer 0
interp '2pt'
snver 0
refant 2
calsour '4C39.25'
opcode 'CALP'
gainver 0
gainuse 0
applycal
vis='tl016b.ms'
gaintable=['tl016b_smooth.accor', 'tl016b.gcal', 'tl016b.tsys', 'tl016b.sbd']
interp=['nearest', 'nearest', 'nearest,nearest', 'nearest']
parang=True

IMPORTANT Note that in the CASA calibration process, the gain curve and system temperature calibration tables have been applied at this point. That means the the amplitude values are now in Janskys. The AIPS amplitude calibration is not done until after the bandpass correction.


Global Fringe Fitting

The VLBAUTIL package contains 2 methods for doing the global fringe fit:

  • VLBAFRNG does a fringe fit on every source in the observation
  • VLBAFRGP does a fringe fit on the phase-reference calibrator(s) and transfers those solutions to the science target(s)

This observation required phase referencing, so we will use the VLBAFRGP method.

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
VLBAFRGP
inname 'TL016B'
inclass 'UVDATA'
inseq 1
calsour '4C39.25','J1154+6022'
gainuse 0
refant 2
search 9 5 4 8 7 3
solint 0.5
sources '4C39.25','J1154+6022','J1203+6031',
interpol '2pt'
FRING
inname 'TL016B'
inclass 'UVDATA'
inseq 1
calsour '4C39.25','J1154+6022'
docal 1
gainuse 0
refant 2
search 9 5 4 8 7 3
solint 0.5
snver 0
fringefit
vis='tl016b.ms'
caltable='tl016b.mbd'
field='4C39.25, J1154+6022'
solint='30s'
minsnr=5
zerorates=False
refant='FD,PT,LA,KP,OV,NL,HN'
gaintable=['tl016b_smooth.accor', 'tl016b.gcal', 'tl016b.tsys', 'tl016b.sbd']
interp=['nearest', 'nearest', 'nearest,nearest', 'nearest']
parang=True
CLCAL
inname 'TL016B'
inclass 'UVDATA'
inseq 1
timer 0
interp '2pt'
snver 0
refant 2
calsour '4C39.25','J1154+6022'
opcode 'CALP'
gainver 0
gainuse 0
applycal
vis='tl016b.ms'
gaintable=['tl016b_smooth.accor', 'tl016b.gcal', 'tl016b.tsys', 'tl016b.sbd', 'tl016b.mbd']
interp=['nearest', 'nearest', 'nearest,nearest', 'nearest', 'linear']
parang=True


Bandpass Correction

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
VLBABPSS
inname 'TL016B'
inclass 'UVDATA'
inseq 1
calsour '4C39.25'
refant 2
BPASS
inname 'TL016B'
inclass 'UVDATA'
inseq 1
calsour '4C39.25'
refant 2
docal 1
ginause 0
solint -1
bpassprm(5) 1
bpassprm(9) 1
bpassprm(10) 6
bandpass
vis='tl016b.ms'
caltable='tl016b.bpass'
field='4C39.25'
solint='inf'
refant='FD'
solnorm=True
bandtype='B'
gaintable=['tl016b_smooth.accor', 'tl016b.gcal', 'tl016b.tsys', 'tl016b.sbd', 'tl016b.mbd']
interp=['nearest', 'nearest', 'nearest,nearest', 'nearest', 'linear']
parang=True)
applycal
vis='tl016b.ms'
gaintable=['tl016b_smooth.accor', 'tl016b.gcal', 'tl016b.tsys', 'tl016b.sbd', 'tl016b.mbd', 'tl016b.bpass']
interp=['nearest', 'nearest', 'nearest,nearest', 'nearest', 'linear', 'linear,linear']
parang=True

NOTE: In AIPS, you do not need to apply the bandpass correction with CLCAL; you simply need to set doband=1 in all subsequent calibration steps.


Final Amplitude Calibration

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
VLBAAMP
inname 'TL016B'
inclass 'UVDATA'
inseq 1
ACSCL
inname 'TL016B'
inclass 'UVDATA'
inseq 1
docal 1
gainuse 0
doband 1
bpver 1
solint -2
accor
vis='tl016b.ms'
spw='*:7~121'
caltable='tl016b.acscl'
solint='2min'
gaintable=['tl016b_smooth.accor', 'tl016b.sbd', 'tl016b.mbd', 'tl016b.bpass']
interp=['nearest', 'nearest', 'linear', 'linear,linear']
SNSMO
inname 'TL016B'
inclass 'UVDATA'
inseq 1
samptype 'mwf'
doblank -1
smotype 'ampl'
cparm 0.5 0 0 0 0 1
inver 0
outver 0
smoothcal
vis='tl016b.ms'
tablein='tl016b.acscl'
caltable='tl016b_smooth.acscl'
smoothtype='median'
smoothtime=1800.0
CLCAL
inname 'TL016B'
inclass 'UVDATA'
inseq 1
opcode 'cali'
interpol 'self'
snver 0
doblank -1
gianver 0
gainuse 0
applycal
vis='tl016b.ms'
gaintable=['tl016b_smooth.accor', 'tl016b.gcal', 'tl016b.tsys', 'tl016b.sbd', 'tl016b.mbd', 'tl016b.bpass', 'tl016b_smooth.acscl']
interp=['nearest', 'nearest', 'nearest,nearest', 'nearest', 'linear', 'linear,linear', 'nearest']
parang=True
APCAL
inname 'TL016B'
inclass 'UVDATA'
inseq 1
tyver 0
gcver 0
snver 0
done with gencal in the A Priori Calibration section above
CLCAL
inname 'TL016B'
inclass 'UVDATA'
inseq 1
opcode 'cali'
interp 'self'
snver 0
doblank -1
gainver 0
gainuse 0
already applied above

IMPORTANT: When doing the final accor step in CASA, DO NOT apply the gain curve or system temperatures!


Parallactic Angle Correction

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
VLBAPANG
inname 'TL016B'
inclass 'UVDATA'
inseq 1
CLCOR
inname 'TL016B'
inclass 'UVDATA'
inseq 1
gainver 0
gainuse 0
opcode 'pang'
clcorprm 1 0
already done by setring parang=True in applycal, fringefit, and bandpass


Split the Calibrated Data Into a New File

At this point, it is good practice to apply all the calibration and split the calibrated data into a new file. It is usually a good idea to drop any of the edge channels that look bad, or that were not used in the final amplitude calibration step (VLBACSL, ACSCL, etc.).

In AIPS, you will get a separate file for each source you include in the sources adverb. If you leave sources blank, it will split out each source in the obsevration.

In CASA, you will create a new MS file with all of the sources you include in the field variable. Also, you can drop the autocorrelations from the new file by setting antennas='*&*'.

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
none SPLIT
inname 'TL016B'
inclass 'UVDATA'
inseq 1
sources 'J1154+6022','J1203+6031'
bchan 8
echan 122
docal 1
gainuse 0
doband 1
bpver 1
outclass 'split1'
split
vis='tl016b.ms'
outputvis='tl016b_cal1.ms'
field='J1154+6022,J1203+6031'
spw='*:7~121'
antenna='*&*'
datacolumn='corrected'


Self-Calibration Steps

This sections covers the steps needed to perform phase and amplitude self-calibration of the dataset.

NOTE: The VLBAUTIL procedures do not include self-calibration options, so the following subsections will only include AIPS tasks and the equivalent CASA tasks.


Imaging the Phase Reference Calibrator

The first step in self-calibration is to build a model of the phase reference calibrator with an imaging tool.

AIPS Task(s) CASA Task(s)
IMAGR
inname 'J1154+6022'
inclass 'SPLIT1'
inseq 1
sources 'J1154+6022'
stokes 'i'
cellsize 0.0002
imsize 512
robust 5
niter 1000
dotv 1
tclean
vis='tl016b_cal1.ms'
field='J1154+6022'
imagename='J1154_sc1'
imsize=[640], cell=['0.2mas']
stokes='I'
deconvolver='clark'
weighting='natural'
niter=1000
interactive=True
savemodel='modelcolumn'


Phase Self-Calibration

AIPS Task(s) CASA Task(s)
CALIB
inname 'TL016B'
inclass 'UVDATA'
inseq 1
calsour 'J1154+6022'
docal 1
gainuse 0
doband 1
bpver 1
in2name 'J1154+6022'
in2class 'icl001'
inseq 1
refant 2
solmode 'p'
solint 20/60
cmethod 'dft'
gaincal
vis='tl016b_cal1.ms'Mbr/>field='J1154+6022'
caltable='tl016b_cal1.dcal'
solint='inf'
refant='FD'
minblperant=3
gaintype='K'
calmode='p'
parang=False
gaincal
vis='tl016b_cal1.ms'Mbr/>field='J1154+6022'
caltable='tl016b_cal1.pcal'
solint='20s'
refant='FD'
minblperant=3
gaintype='G'
calmode='p'
parang=False
CLCAL
inname 'TL016B'
inclass 'UVDATA'
inseq 1
opcode 'calp'
interp '2pt'
snver 0
doblank -1
gainver 0
gainuse 0
applycal
vis='tl016b_cal1.ms'
field='J1154+6022'
gaintable=['tl016b_cal1.dcal','tl016b_cal1.pcal']
interp=['linear','linear']
parang=False


New Image of Calibrator

AIPS Task(s) CASA Task(s)
IMAGR
inname 'J1154+6022'
inclass 'SPLIT1'
inseq 1
sources 'J1154+6022'
stokes 'i'
cellsize 0.0002
imsize 512
robust 5
niter 1000
dotv 1
tclean
vis='tl016b_cal1.ms'
field='J1154+6022'
imagename='J1154_sc2'
imsize=[640], cell=['0.2mas']
stokes='I'
deconvolver='clark'
weighting='natural'
niter=1000
interactive=True
savemodel='modelcolumn'


Amplitude Self-Calibration

AIPS Task(s) CASA Task(s)
CALIB
inname 'TL016B'
inclass 'UVDATA'
inseq 1
calsour 'J1154+6022'
docal 1
gainuse 0
doband 1
bpver 1
in2name 'J1154+6022'
in2class 'icl001'
inseq 2
refant 2
solmode 'a&p'
solint 0
cmethod 'dft'
tclean
vis='tl016b_cal1.ms'
field='J1154+6022'
caltable='tl016b_cal1.apcal'
solint='inf'
refant='FD'
minblperant=4
gaintype='G'
calmode='ap'
solnorm=True
gaintable=['tl016b_cal1.dcal','tl016b_cal1.pcal']
interp=['linear','linear']
parang=False
CLCAL
inname 'TL016B'
inclass 'UVDATA'
inseq 1
opcode 'calp'
interp '2pt'
snver 0
doblank -1
gainver 0
gainuse 0
applycal
vis='tl016b_cal1.ms'
field='J1154+6022'
gaintable=['tl016b_cal1.dcal','tl016b_cal1.pcal','tl016b_cal1.apcal']
interp=['linear','linear','linear']
parang=False


Split Out Science Target

Imaging the Science Target

Additional Tasks

AIPS Task CASA Task
SPLIT split
IMAGR tclean
CALIB gaincal
POSSM plotms
SNPLT plotms
UVPLT plotms
UVFLG flagadata
FITTP exportuvfits or exportfits