CASA Guides:VLBA Basic Phase-referencing Calibration and Imaging

From CASA Guides
Revision as of 23:14, 4 March 2022 by Jlinford (talk | contribs)
Jump to navigationJump to search


This CASA Guide is for Version 6.4.0 of CASA. If you are using a later version of CASA and this is the most recent available guide, then you should be able to use most, if not all, of this tutorial.

Overview

This CASA Guide describes the procedure for calibrating a phase-referenced VLBA observation of the radio galaxy J1203+6031 (IVS 1200+608, ICRF3 J120303.5+603119). The data were taken specifically for this tutorial. The observation made use of the DDC observing personality, using dual polarization with 4 spectral windows per polarization. Each spectral window is has a bandwidth of 64 MHz, and is divided into 128 spectral channels.

This tutorial will focus on calibrating the data and creating continuum (Stokes I) images.

How to Use This CASA Guide

There are a number of possible ways to run CASA, described in more detail in Getting Started in CASA. In brief, there are at least three different ways to use CASA:

  • Interactively examining task inputs. In this mode, one types taskname to load the task, inp to examine the inputs, and go once those inputs have been set to your satisfaction. Allowed inputs are shown in blue and bad inputs are colored red. The input parameters themselves are changed one by one, e.g., selectdata=True. Screenshots of the inputs to various tasks used in the data reduction below are provided, to illustrate which parameters need to be set. More detailed help can be obtained on any task by typing help taskname. Once a task is run, the set of inputs are stored and can be retrieved via tget taskname; subsequent runs will overwrite the previous tget file.
  • Pseudo-interactively via task function calls. In this case, all of the desired inputs to a task are provided at once on the CASA command line. This tutorial is made up of such calls, which were developed by looking at the inputs for each task and deciding what needed to be changed from default values. For task function calls, only parameters that you want to be different from their defaults need to be set.
  • Non-interactively via a script. A series of task function calls can be combined together into a script, and run from within CASA via execfile('scriptname.py'). This and other CASA Tutorial Guides have been designed to be extracted into a script via the script extractor by using the method described at the Extracting_scripts_from_these_tutorials page. Should you use the script generated by the script extractor for this CASA Guide, be aware that it will require some small amount of interaction related to the plotting, occasionally suggesting that you close the graphics window and hitting return in the terminal to proceed. It is in fact unnecessary to close the graphics windows (it is suggested that you do so purely to keep your desktop uncluttered).

If you are a relative novice or just new to CASA, it is strongly recommended to work through this tutorial by cutting and pasting the task function calls provided below after you have read all the associated explanations. Work at your own pace, look at the inputs to the tasks to see what other options exist, and read the help files. Later, when you are more comfortable, you might try to extract the script, modify it for your purposes, and begin to reduce other data.

Obtaining the Data

This Guide is intended to cover the entire process one would follow for calibrating their own VLBA observation. Therefore, we will start with a FITS-IDI file rather than a Measurement Set. The FITS-IDI file for this Guide is: PROVIDE LINK TO IDIFITS FILE HERE (file size X.Y GB).

If users prefer, they may download the data from the NRAO Archive. In the archive search inputs, enter the project code "TL016" and look for the file VLBA_TL016B_tl016b_BIN0_SRC0_1_YYYMMDDTXXYYZZ.idifits NEED TO UPDATE THE FILENAME. Once you have downloaded the FITS-IDI file, it may be useful to change the filename to "TL016B.idifits".

The Observation

Before diving into the calibration, it is always a good idea to look over the observing log to make check for notes from the operators that can inform us about potential issues with the data (missing stations, bad weather, etc.). These logs are always emailed to the PI's of an observation, but you can also access them later from the NRAO's vlbiobs fileserver. To locate an observing log, first find the directory for observing month and the last two digits of the year (for the observation used in this Guide, that directory is feb22 for February 2022). Once inside the proper month+year directory, look for the project code (in this case, tl016b). Look for a file named <project code>log.vbla (tl016blog.vlba).

The observing log for this particular observation looked like this:

VERY LONG BASELINE ARRAY OBSERVING LOG
--------------------------------------
Project:        TL016B
Observer:       Linford, J.
Project type:   VLBA
Obs filename:   t;016b.vex
Date/Day:       2022FEB21/052
Ants Scheduled: SC HN NL FD LA PT KP OV BR MK

=UT-Time===Comment===============================================MF#===%AD==AMD=
           Operator is Betty Ragan                                              
     0559  Begin                                                                
     0559 %SC raining                                                           
     0559 %KP windy                                                             
     1327  End.                                                                 


Downtime Summary:
	Total downtime : 0 min
	Percentage downtime of observing: 0.0%
	Average downtime per hour : 0.0 min

    Total scheduled observing time (# Antennas): 4480 min (10)

Notes:
    * = Entries where data was affected.
    % = Entries where data may have been affected.
    & = Entries where the site tech was called out.
  WEA = Weather entries.
  MF# = Maintenance form or major downtime category associated with a problem.
  %AD = The percentage of an antenna affected by a problem.
  AMD = Total antenna-minutes downtime for a problem.
 Tsys = System Temperature (TP/SP x Tcal/2)
  ACU = Antenna Control Unit
  FRM = Focus/Rotation Mount
  RFI = Radio Frequency Interference
  VME = Site control computer
   CB = Circuit Breaker
 vclock = Program that compares site clock time to a standard.

Note that there are no major issue reported by the operators for this observation and all antennas participated for the entire time (no downtime). However, there was rain at Saint Croix (SC) and it was windy at Kitt Peak (KP). We'll need to keep that in mind as we proceed with the calibration. We should pay special attention to SC and KP as we inspect the data and the calibration solutions we generate.

NOTE: This is an exceptionally good observing log! Most observations will have at least a small amount of downtime for various reasons.

Creating the Measurement Set

Before beginning our data reduction, we must start CASA. If you have not used CASA before, some helpful tips are available on the Getting Started in CASA page. Remember to start CASA in the directory containing the data.

Once you have CASA up and running, it is time to get the data into a format that CASA can use. Unlike VLA data, a VLBA observation is only available as a FITS-IDI file and cannot be downloaded as a CASA Measurement Set. So, the first step in calibrating a VLBA observation with CASA is to create a Measurement Set from the FITS-IDI file. To do this, we will use the task importfitsidi:

# In CASA
importfitsidi(fitsidifil='TL016B.idifits', vis='tl016b.ms', constobsid=True, scanreindexgap_s=15)

The scanreindexgap_s parameter is used to reconstruct scan boundaries in those cases where sources do not change between scans. In general, it is good to set scanreindexgap_s to some non-zero number to help CASA properly organize the scan list. The recommended value is 15, but shorter values may work as well (although you probably don't want to go much shorter than about 5 seconds). If you find that the resulting MS contains too few scans, run importfitsidi again with scanreindexgap_s set to a smaller number. If your MS has too many scans, especially multiple scans on the same source when you think it should just be one scan, run importfitsidi again with scanreindexgap_s set to a larger number.

Inspecting the Data

Now that we have a Measurement Set, it is time to look over the data, identify a good reference antenna, and find a good time range to use for calibrating the single band delay.

The Observation Summary

It will be useful later to have the basic information about the observation. The task listobs will return a list of all the scans, the sources observed, which stations were used, and the frequency setup. It is possible to run listobs in two ways: printing information in the CASA logger, or saving the information to a file.

To simply display the information in the CASA logger:

#In CASA
listobs(vis='tl016b.ms')

You should see the listobs output in the CASA logger window:

PASTE THE LISTOBS OUTPUT HERE

NOTE: You can also assign the listobs output to a python dictionary (e.g., "obs_dict") by typing "obs_dict = listobs(vis='tl016b.ms')".

It is usually useful to have a copy of the listobs output in a file that you can refer to later. To save the listobs output to a file names "tl016b_listobs.txt':

#In CASA
listobs(vis='tl016b.ms', listfile='tl016b_listobs.txt')

Identifying a Good Reference Antenna

#In CASA
plotms(vis='tl016b.ms.ms', xaxis='frequency', yaxis='phase', field='4C39.25', scan='!!SCAN!!', correlation='LL', iteraxis='baseline', coloraxis='spw')

Identifying a Good Time Range for the Single Band Delay

#In CASA
plotms(vis='tl016b.ms', xaxis='frequency', yaxis='amp', field='4C39.25', antenna='!!REFANT!!', scan='!!SCAN!!', correlation='RR,LL', iteraxis='baseline', coloraxis='corr')

Flagging Data

Quack

VLBA observations often include a little bit of bad data at the beginnings of the scans, and sometimes at the ends of scans. An easy way to deal with this is to "quack" the data. Quacking is a completely optional step, and you should only do it if you see evidence for bad data at the beginnings or ends of scan.

In CASA, you can quack your data using the flagdata task and setting mode='quack'. The amount of data to be flagged is controlled by the quackinterval parameter, which sets the time interval in seconds.

To flag the first 4 seconds of each scan:

#In CASA
flagdata(vis='tl016b.ms', mode='quack', quackinterval=4.0, quackmode='beg', quackincrement=True)

To flag the last 4 seconds of each scan:

#In CASA
flagdata(vis='tl016b.ms', mode='quack', quackinterval=4.0, quackmode='endb', quackincrement=True)

For those who are interested: There is some uncertainty about the origins of the term "quack". However, discussions with people who were working at NRAO in the late 1970s indicates it has nothing to do with waterfowl. Instead, "quack" refers to an unscrupulous/incompetent physician who treats the symptoms of a disease without treating the disease itself. The original QUACK routine was written for the VLA DEC-10 computers and flagged the beginnings of scans because they often contained bad data, but nobody could figure out what was causing the bad data.

Automated Flagging

Flagging "By Hand"

Calibrating the Data

Amplitude Corrections from Autocorrelations

Determine the amplitude corrections from the autocorrelations with accor.

#In CASA
accor(vis='<tl016b.ms', caltable='tl016b.accor', solint='30s')

NOTE: This step is not required for EVN data, because the EVN correlator performs it during correlation.

Inspect the tl016b.accor solution table with plotms.

#In CASA
plotms(vis='tl016b.accor', xaxis='time', yaxis='amp', iteraxis='antenna')

Look for any large outliers.

It should be noted that the AIPS VLBA utility script VLBACCOR smooths the autocorrelation corrections by default (with a smoothing time of 30 minutes). It is possible to do this smoothing in CASA 6.3 and later using the smoothcal task.

#In CASA
smoothcal(vis='tl016b.ms, tablein='<your filename>.accor', caltable='<your filename>_smooth.accor', smoothtype='median', smoothtime=1800.0)

Remember to checked the smoothed solutions with plotms to make sure it was an improvement.

A Priori Calibration

Instrumental Delay Calibration

Check that applying the solutions resulted in improvements:

#In CASA
plotms(vis='tl016b.ms', field='4C39.25', xaxis='frequency', yaxis='phase', ydatacolumn='data', timerange='!!SAME AS SBD STEP!!', correlation='rr,ll', antenna='*&*', iteraxis='antenna' coloraxis='antenna2')

Global Fringe Fitting

Bandpass Calibration

Final Amplitude Scaling and Flux Calibration

Split Out Calibrated Data

Self-Calibration of Phase-Reference Calibrator

Tracking Improvement

Imaging the Calibrator

Phase Self-Calibration

Amplitude Self-Calibration

Apply Calibration to Science Target

Split Out Science Target

Imagine the Science Target