VLBA AIPS ans CASA Guide

From CASA Guides
Revision as of 15:30, 4 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 precedures, 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'

During this step, you should verify that the TFCrop flagging is doing what you expect.

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 ACSCL accor
SNSMO smoothcal
CLCAL applycal
APCAL gencal
CLCAL applycal

Parallactic Angle Correction

VLBAUTIL Procedure AIPS Task(s) CASA Task(s)
VLBAPANG CLCOR
opcode 'pang'
set parang=True in applycal, fringefit, and bandpass

Additional Tasks

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