Difference between revisions of "AIPS-Simple-Self-Cal"

From CASA Guides
Jump to: navigation, search
(Created page with "<div style="text-align: justify;"> == Overview == A good resource for reducing basic VLBI data in AIPS can be found in [ftp://ftp.aoc.nrao.edu/pub/software/aips/TEXT/PUBL/COO...")
 
 
(121 intermediate revisions by 6 users not shown)
Line 2: Line 2:
 
== Overview ==
 
== Overview ==
  
A good resource for reducing basic VLBI data in AIPS can be found in [ftp://ftp.aoc.nrao.edu/pub/software/aips/TEXT/PUBL/COOKC.PS Appendix C] of the [http://www.aips.nrao.edu/cook.html AIPS Cookbook]. [ftp://ftp.aoc.nrao.edu/pub/software/aips/TEXT/PUBL/COOK9.PS Chapter 9:Reducing VLBI Data in AIPS] of the AIPS Cookbook contains much more detail, but is best used as a reference.  Details on the geodetic like calibration to improve phase referencing and astrometry can be found in [ftp://ftp.aoc.nrao.edu/pub/software/aips/TEXT/PUBL/AIPSMEM110.PS AIPS Memo 110: Strategy for Removing Tropospheric and Clock Errors using DELZN.] In short, to obtain precise positions and good image quality with phase referencing in VLBI, two things are needed; a close calibrator to the target source to minimize atmospheric differences between the target and calibrator and a good correlator model. The VLBA correlator uses a model for the troposphere computed from seasonal models as well as the best estimates of the clocks, positions of each antenna and earth orientation parameters. This major source of error produces a systematic phase difference between the calibrator and target which limits the target positional accuracy and image quality. The troposphere model error, however, can be estimated by observing about ten calibrators over the sky over a 30-minute period, and then calculated the erroneous delay. So with this tutorial you will:
+
A good resource for reducing basic VLBI data in AIPS can be found in [ftp://ftp.aoc.nrao.edu/pub/software/aips/TEXT/PUBL/COOKC.PS Appendix C] of the [http://www.aips.nrao.edu/cook.html AIPS Cookbook]. [ftp://ftp.aoc.nrao.edu/pub/software/aips/TEXT/PUBL/COOK9.PS Chapter 9:Reducing VLBI Data in AIPS] of the AIPS Cookbook contains much more detail, but is best used as a reference. So with this tutorial you will:
  
 
*Calibrate the regular data all the way through imaging.
 
*Calibrate the regular data all the way through imaging.
*Calibrate the geodetic style data through instrumental delay removal.
+
*Perform self-calibration to improve the imaging
*Compute the Multi-band Delay (MBD). The MBD is a function of a variable clock delay, and a troposphere term (zenith path delay) which has a well-defined function of elevation (called a mapping function), times an unknown constant.
 
*Use the AIPS task DELZN to fit the MBD and calculate the clock and zenith path delay error.
 
*Apply these corrections to the dataset that includes the target.
 
*Image the target and see an improvement over not doing the geodetic calibration.
 
  
This guide only give the important inputs to task. The other inputs should be default. An easy way to set all the inputs to the default in a task is to type "default ''taskname''".
+
This guide only gives the important inputs to each task. The other inputs should be default. An easy way to set all the inputs to the default in a task is to type "default ''taskname''".
  
 
== AIPS ==
 
== AIPS ==
Line 17: Line 13:
 
For a comprehensive overview of AIPS see the [http://www.aips.nrao.edu/CookHTML/CookBook.html AIPS COOKBOOK], especially [http://www.aips.nrao.edu/CookHTML/CookBookch3.html#x20-240003 Chapter 3:Basic AIPS Utilities] and [http://www.aips.nrao.edu/CookHTML/CookBookch12.html#x107-31300012 Chapter 12:AIPS for the More Sophisticated User]for the basics. [http://www.aips.nrao.edu/CookHTML/CookBookch9.html#x87-2010009 Chapter 9:Reducing VLBI Data in AIPS] is the chapter explaining VLBI data reduction, but it is rather overwhelming so [http://www.aips.nrao.edu/CookHTML/CookBookap3.html#x171-401000C Appendix C:A Step-by-Step Recipe for VLBA Data Calibration in AIPS] is recommended as a first step. However, below I summarize some useful commands (in parenthesis are the short form of the command):
 
For a comprehensive overview of AIPS see the [http://www.aips.nrao.edu/CookHTML/CookBook.html AIPS COOKBOOK], especially [http://www.aips.nrao.edu/CookHTML/CookBookch3.html#x20-240003 Chapter 3:Basic AIPS Utilities] and [http://www.aips.nrao.edu/CookHTML/CookBookch12.html#x107-31300012 Chapter 12:AIPS for the More Sophisticated User]for the basics. [http://www.aips.nrao.edu/CookHTML/CookBookch9.html#x87-2010009 Chapter 9:Reducing VLBI Data in AIPS] is the chapter explaining VLBI data reduction, but it is rather overwhelming so [http://www.aips.nrao.edu/CookHTML/CookBookap3.html#x171-401000C Appendix C:A Step-by-Step Recipe for VLBA Data Calibration in AIPS] is recommended as a first step. However, below I summarize some useful commands (in parenthesis are the short form of the command):
  
*getname (getn) ''catalog #'': get the name of catalog # and put in INNAME, INCLASS and INSEQ. Other similar: geton (get outname); get2n (get in2name); get3n (getin3name) etc..
+
*getname (getn) ''catalog #'': get the name of catalog # and put in INNAME, INCLASS and INSEQ. Other similar: geton (get outname); get2n (get in2name); get3n (get in3name) etc..
 
*input (inp) ''taskname'': show the inputs of taskname.
 
*input (inp) ''taskname'': show the inputs of taskname.
 
*tget ''taskname'': get a task and fill in the inputs of the last time the task was run, one of the most useful commands in AIPS.
 
*tget ''taskname'': get a task and fill in the inputs of the last time the task was run, one of the most useful commands in AIPS.
Line 26: Line 22:
 
*imhead (imh): Print the file header (this can be used on both uv data and images despite the name). This will list informative things like the date of observation and the number and types of tables attached to the data.
 
*imhead (imh): Print the file header (this can be used on both uv data and images despite the name). This will list informative things like the date of observation and the number and types of tables attached to the data.
  
== Getting the Data ==
+
== Getting the Data and Other Useful Files ==
To obtain the data, right click on these file names below and select "Save Link As...":
+
To obtain these files, right click on the desired file below and select "Save Link As...":
*[ftp://ftp.aoc.nrao.edu/pub/SIW/BM272HC.fits BM272HC.fits] (12 GB): Date containing target and calibrators.
+
*[ftp://ftp.aoc.nrao.edu/pub/SIW/bl193bg_3sour_avg.fits bl193bg_3sour_avg.fits] (543 MB): Data we will be reducing today.
*[ftp://ftp.aoc.nrao.edu/pub/SIW/BM272HC_geodetic.fits BM272HC_geodetic.fits] (0.3 GB): Data containing geodetic block. These are observations of many calibrators around the sky.  
+
*[ftp://ftp.aoc.nrao.edu/pub/SIW/1828_1.box 1828_1.box]: Box file for imaging.
 +
*[ftp://ftp.aoc.nrao.edu/pub/SIW/1828_2.box 1828_2.box]: Box file for imaging.
 +
*[ftp://ftp.aoc.nrao.edu/pub/SIW/1828_3.box 1828_3.box]: Box file for imaging.
 +
*[ftp://ftp.aoc.nrao.edu/pub/SIW/1828_4.box 1828_4.box]: Box file for imaging.
 +
 
 +
Files you might want to get in case something goes wrong with the primary calibration or if you just want to try the imaging and self-calibration:
 +
*[ftp://ftp.aoc.nrao.edu/pub/SIW/0851+202.SPLIT.1 0851+202.SPLIT.1] (6.3 MB): Calibrated data for source 0851+202.
 +
*[ftp://ftp.aoc.nrao.edu/pub/SIW/1828+487.SPLIT.1 1828+487.SPLIT.1] (7.8 MB): Calibrated data for source 1828+487.
 +
*[ftp://ftp.aoc.nrao.edu/pub/SIW/2200+420.SPLIT.1 2200+420.SPLIT.1] (6.8 MB): Calibrated data for source 2200+420.
  
 
If that doesn't work you can also ftp the data using anonymous ftp:
 
If that doesn't work you can also ftp the data using anonymous ftp:
Line 35: Line 39:
 
*login as anonymous
 
*login as anonymous
 
*cd pub/SIW
 
*cd pub/SIW
*mget *.fits
+
*get bl193bg_3sour_avg.fits
 +
*mget *.box
 +
and optionally
 +
*mget *.SPLIT.1
  
The geodetic blocks are in a different file from the target because they have very different frequency setups. The geodetic block require to have widely spaced frequencies with a single polarization in order to measure the multi-band delay (MBD). The target dataset is dual polarization (important since the source is circularly polarized) and frequencies that are continuous. '''MAKE SURE YOU ARE RUNNING THE CORRECT TASK ON THE CORRECT DATASET!'''
+
The best place to put these files is in your $FITS area. This is an AIPS data area that should already have an environmental variable set up for it.
  
 
== About the Data ==
 
== About the Data ==
  
This is an observation of water masers in star-forming region IRAS 00420+5530 and involves phase referencing. The sources in the the BM272HC.fits dataset are as follows:
+
This is part of an observation from the [http://www.physics.purdue.edu/MOJAVE/index.html MOJAVE] survey, which is a large project that uses the VLBA to monitor Active Galactic Nuclei at 15 GHz in total and polarized flux.  This project has been monitoring AGN for over a decade.  The observation we are using took place on 16 June 2016 and contained 22 sources.  However, in order to make the data a manageable size for a data reduction tutorial, three sources have been copied out of the dataset and the frequency channels and sample times have both been averaged by a factor of two. The sources in the the bl193bg_3sour_avg.fits dataset are as follows:
 
 
*AFGL2591 - phase calibrator/target (maser source for which the position is desired)
 
*J2007+4029, 20330+40003, 20327+40396, 20324+40574 - calibrators that are phase referenced to AFGL2591 (note that only J2007+4029 and 20330+40003 are detected).
 
*3C345A, 3C454.3A - Bright, well known quasars, used as fringe finders and bandpass calibrators
 
  
The BM272HC_geodetic.fits dataset contains numerous sources (all known quasars) observed all over the sky but the specifics are unimportant.
+
*0851+202 - BL Lac object, bright source with not a lot of structure, used as bandpass calibrator, aka OJ287.  [http://www.physics.purdue.edu/astro/MOJAVE/sourcepages/0851+202.shtml MOJAVE source page]
 +
*1828+487 - Quasar, bright source with a very extended defuse jet, aka 3C380. [http://www.physics.purdue.edu/astro/MOJAVE/sourcepages/1828+487.shtml MOJAVE source page]
 +
*2200+420 - The original BL Lac object, bright source with extended curved jet, aka BL Lac.  [http://www.physics.purdue.edu/astro/MOJAVE/sourcepages/2200+420.shtml MOJAVE source page]
  
This data was published by [http://www.aanda.org/articles/aa/full_html/2012/03/aa18211-11/aa18211-11.html Rygl et. al]
+
We thank the MOJAVE team for maintaining the MOJAVE database and Matt Lister (Purdue) in particular for advice on the best data to select [http://adsabs.harvard.edu/abs/2009AJ....138.1874L (Lister et al., 2009, AJ, 137, 3718)].
  
 
== Starting AIPS and Loading the Data ==
 
== Starting AIPS and Loading the Data ==
Line 55: Line 60:
 
=== Starting AIPS ===
 
=== Starting AIPS ===
  
Start AIPS by typing '''aips''' or possibly '''aips tv=local:0.0''' in a terminal window. Depending on your AIPS installation, you might be prompted to pick a printer, then you will be asked for an AIPS number, if you are not sharing disks with anyone pick any number other than 1.  Remember that number because the data you load and work on will be under that number.  ''It would be best for this tutorial for you to use a clean AIPS number, in other words, an AIPS number that you have not used for anything else and has no data loaded into it.''
+
Start AIPS by typing '''aips''' or possibly '''aips tv=local:0.0''' in a terminal window. Depending on your AIPS installation, you might be prompted to pick a printer, then you will be asked for an AIPS number, if you are not sharing disks with anyone pick any number other than 1.  Remember that number because the data you load and work on will be under that number.  ''It would be best for this tutorial for you to use a clean AIPS number, in other words, an AIPS number that you have not used for anything else and that has no data loaded into it.''
 +
 
 +
After AIPS has started type:
 +
* dowait=1
 +
 
 +
This means that AIPS will not allow you to run more than one task at a time.  I usually run with dowait=-1; but for this tutorial and for beginners it is better to set dowait=1.
  
 
=== Loading Data Into AIPS ===
 
=== Loading Data Into AIPS ===
  
Load the data with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?FITLD '''FITLD'''].  Note that I am forcing an outname, outclass and outseq, we are doing it here so it will be easy to take about specific files.
+
Load the data with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?FITLD '''FITLD'''].  Note that I am forcing an outname, outclass and outseq, we are doing it here so it will be easy to talk about specific files.
  
* First load the target and calibrators
+
First load the target and calibrators
 
# default fitld
 
# default fitld
 
# clint 0.25  ➜ set CL table interval to 15 seconds.
 
# clint 0.25  ➜ set CL table interval to 15 seconds.
# datain 'FITS:BM272HC.fits  ➜ Two things to note: 1) this assumes that the data is in the $FITS directory, you can use a full directory path (e.g., datain '/home/mydata/BM272HC.fits) or another environmental variable if the data is elsewhere; 2) The lack of a close ' is not a typo, you must leave off the closing ' or AIPS will capitalize the everything within the ' ' and you will get an error because FITLD will not be able to find the data.
+
# datain 'MYAIP:bl193bg_3sour_avg.fits  ➜ Two things to note: 1) this assumes that the data is in the $MYAIP directory, you can use a full directory path (e.g., datain '/home/mydata/bl193bg_3sour_avg.fits) or another environmental variable if the data is elsewhere; 2) The lack of a close ' is not a typo, you must leave off the closing ' or AIPS will capitalize everything within the ' ' and you will get an error because FITLD will not be able to find the data.
# outname 'bm272hc'
+
# outname 'bl193bg'
 
# outclass 'uvdata'
 
# outclass 'uvdata'
 
# outseq 1
 
# outseq 1
Line 72: Line 82:
 
# go
 
# go
  
* Now load the geodetic block, this is a good place to talk about global inputs.  Once you set an input it will stay set ''for all tasks'' until you change it.  So notice below we do not set clint, outclass, outseq or outdisk, this is because we want the same values as above and they are already set.
+
Lets look at our uv data catalog
# datain 'FITS:BM272HC_geodetic.fits  ➜ again remember to leave off the close '.
+
* uc
# outname 'BM272HC GEO'
 
# go
 
 
 
*Lets look at our uv data catalog
 
# uc
 
 
You should get something that looks similar to (with a different Usid and Last access):
 
You should get something that looks similar to (with a different Usid and Last access):
 
<pre>
 
<pre>
 
AIPS 1: Catalog on disk  1
 
AIPS 1: Catalog on disk  1
 
AIPS 1:  Cat  Usid Mapname      Class  Seq  Pt    Last access    Stat
 
AIPS 1:  Cat  Usid Mapname      Class  Seq  Pt    Last access    Stat
AIPS 1:    1 1709 BM272HC     .UVDATA.    1 UV 07-APR-17 15:35:37
+
AIPS 1:    1   194 BL193BG     .UVDATA.    1 UV 29-JUN-17 19:39:03
AIPS 1:    2  1709 BM272HC GEO .UVDATA.    1 UV 07-APR-17 15:36:29
 
 
</pre>
 
</pre>
Note each file has a catalog number (Cat), BM272HC.UVDATA.1 is catalog number 1 and BM272HC GEO.UVDATA.1 is catalog number 2.  These catalog numbers can be, and usually are, used to fill in IN and OUTNAMES etc., using getn, geton etc..
 
  
== Reducing the phase referencing data (BM272HC.UVDATA.1) ==
+
Note the data file, BL193BG.UVDATA.1, has a catalog number (Cat) which in this case 1.  Catalog numbers can be, and usually are, used to fill in IN and OUTNAMES etc., using getn, geton etc..
 +
 
 +
== Reducing the data ==
  
 
=== Preliminary Data Evaluation ===  
 
=== Preliminary Data Evaluation ===  
  
Look at the structure of the data with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?LISTR'''LISTR''']. This will give you a listing of the scans as well as the source and frequency structure in the observation.
+
Look at the structure of the data with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?LISTR'''LISTR''']. This will give you a listing of the scans as well as the sources and frequency structure in the observation.  Note that even though this dataset contains only three sources, the SU (source) table still contains all the sources in the original dataset, so LISTR will list all the sources and show 0 visibilities for the sources with no data.
  
 
# default listr
 
# default listr
# getn '''BM272HC.UVDATA.1 file'''; in other words ''getn 1''
+
# getn '''BL193BG.UVDATA.1 file'''; in other words ''getn 1''
 
# optype 'scan'
 
# optype 'scan'
 
# docrt 1
 
# docrt 1
Line 101: Line 106:
 
# go
 
# go
  
=== Data Reduction Procedure for BM272HC ===  
+
This will give you a listing of the scans and frequencies in the observation.
 +
 
 +
=== Data Reduction Procedure ===  
  
Load in the VLBA data reduction procedures: see [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBAUTIL EXPLAIN VLBAUTIL] for full description of procedures.  
+
Load in the VLBA data reduction procedures: see [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBAUTIL EXPLAIN VLBAUTIL] for a full description of the numerous procedures.  
  
 
Procedures are run by just typing their name, rather than using "go".
 
Procedures are run by just typing their name, rather than using "go".
Line 111: Line 118:
 
If you get a BLEW CORE or other similar error message, you have filled your procedure memory (VLBAUTIL is very large and loading it three times will do this). To fix it type "restore 0" then reload VLBAUTIL  
 
If you get a BLEW CORE or other similar error message, you have filled your procedure memory (VLBAUTIL is very large and loading it three times will do this). To fix it type "restore 0" then reload VLBAUTIL  
  
=== Calibrate Ionospheric Delay ===
+
=== Calibrate Ionospheric Delay and Fix Earth Orientation Parameters ===
 
 
Fix ionosphere contribution to the dispersive delay by running [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBATECR '''VLBATECR'''].
 
  
# default vlbatecr
+
Data observed at 8 GHz or lower frequencies may be effected by the dispersive delay caused by the ionosphere. This will distort images and is especially bad at very low frequencies.  An ionospheric correction based on maps of the electron content of the ionosphere can be performed with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBATECR '''VLBATECR'''].  ''BL193BG is observed at 15 GHz so no ionospheric correction is needed.''
# getn 1
 
# inp
 
# vlbatecr ➜ to run VLBATECR
 
  
=== Fix Earth Orientation Parameters ===
+
Data using phase referencing can be affected by imprecise Earth Orientation Parameters (EOPs) used in correlation.  Therefore all phase referenced data should have its EOPs corrected.  This can be done with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBAEOPS '''VLBAEOPS''']. ''BL193BG does not use phase referencing so no EOP correction is needed.''
 
 
Fix earth orientation parameters by running [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBAEOPS '''VLBAEOPS'''].
 
 
 
# default vlbaeops
 
# getn 1
 
# inp
 
# vlbaeops
 
  
 
=== Apply Digital Sampling Correction to VLBA data ===
 
=== Apply Digital Sampling Correction to VLBA data ===
  
Correct sampler threshold errors from correlator by running [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBACCOR '''VLBACCOR'''].
+
Correct sampler threshold errors from the correlator by running [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBACCOR '''VLBACCOR'''].
  
 
# default vlbaccor
 
# default vlbaccor
Line 137: Line 132:
 
# inp
 
# inp
 
# vlbaccor
 
# vlbaccor
 +
 +
VLBACCOR runs [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?ACCOR '''ACCOR'''] which creates a solution (SN) table, then smooths the table with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?SNSMO '''SNSMO'''], and then runs [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?CLCAL '''CLCAL'''] to apply the solutions to the calibration (CL) table.  When VLBACCOR is finished you should get messages like those below that tell you what SN table and CL table are created.  It is a good idea to save these messages.
 +
 +
<pre>
 +
AIPS 1: 'SN #1 CONTAINS SAMPLER CORRECTIONS'
 +
AIPS 1: 'CL #2 ADDS SAMPLER CORRECTIONS'
 +
</pre>
  
 
=== Plot Cross Power Spectrum ===
 
=== Plot Cross Power Spectrum ===
  
[[Image:POSSMbeforeMPCL.png|250px|thumb|right|'''Figure 1''' <br /> Plot of amplitudes (bottom) and phases (top) for source 3C345A .]]
+
[[Image:0851_possm1.png|250px|thumb|right|'''Figure 1''' <br /> Plot of amplitudes (bottom) and phases (top) for source 0851+202.]]
  
Now lets take a look at the fringe finders by running [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBACRPL '''VLBACRPL''']. VLBACRPL runs [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?POSSM '''POSSM'''] and displays the spectrum of each baseline (to Fort Davis (antenna 2)), with the amplitude on the bottom and the phases on the top.
+
Now lets take a look at the fringe finders by running [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBACRPL '''VLBACRPL''']. VLBACRPL runs [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?POSSM '''POSSM'''] and displays the spectrum of each baseline (to Fort Davis which is antenna 2), with the amplitude on the bottom and the phases on the top.
  
 
# default vlbacrpl
 
# default vlbacrpl
Line 151: Line 153:
 
# solint -1
 
# solint -1
 
# dotv 1
 
# dotv 1
# source '3C345A' '3C454.3A'
+
# source '0851+202'
 
# inp
 
# inp
 
# vlbacrpl  
 
# vlbacrpl  
  
As you can see from Figure 1, 3C345A has very strong fringes. So we will use it as the calibrator to set the instrumental delays.  Also look at your terminal for instructions on how to control POSSM:
+
As you can see from Figure 1, 0851+202 has very strong fringes. So we will use it as the calibrator to set the instrumental delays.  Also look at your terminal for instructions on how to control POSSM:
  
 
<pre>
 
<pre>
Line 166: Line 168:
 
=== Determine Delay Corrections ===
 
=== Determine Delay Corrections ===
  
Find and remove instrumental delay by running [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBAMPCL '''VLBAMPCL'''].
+
Find and remove instrumental delay by running [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBAPCOR '''VLBAPCOR'''].
  
[[Image:POSSMafterMPCL.png|250px|thumb|right|'''Figure 2''' <br /> Plots for source 3C345A which show the amplitude (bottom panel) and corrected phases (top panel), for each IF in both polarizations.]]
+
[[Image:0851_possm2.png|250px|thumb|right|'''Figure 2''' <br /> Plots for source 0851+202 which show the amplitude (bottom panel) and corrected phases (top panel), for each IF in both polarizations.]]
  
#default vlbampcl
+
#default vlbapcor
 
#getn 1
 
#getn 1
#calsour '3C345A' ➜ strongest source.
+
#calsour '0851+202' '
#timer 0 07 35 28 0 17 37 09 ➜ scan with good fringes we found in POSSM plots.
+
#timer 0 19 26 33 0 19 36 38 ➜ scan with good fringes on all telescopes we found in POSSM plots.
#refant 2  ➜ choose reference antenna from in the middle of array, FD (antenna 2) is a good choice.
+
#refant 2  ➜ choose reference antenna from in the middle of array, antenna 2 or FD (Fort Davis, TX) is a good choice.
#gainu 0  ➜ apply highest CL table. Please do an "imh" here to make sure the highest CL table is really 4.
+
#gainu 0  ➜ apply highest CL table.
 
#inp
 
#inp
#vlbampcl
+
#vlbapcor
  
At this point you should check on the calibration:
+
(Note that the second quote sign ' after the source name causes all other values of CALSOUR to be blank.)  At this point you should check on the calibration:
  
*First check you have no failed solutions. At the end of the [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?FRING '''FRING'''] run it should tell you how many "good" and "failed" solutions it has found.  The output from '''FRING''' will look something like this:
+
*VLBAPCOR runs PCCOR which used the pulse cals to correct the intrumental phases and then runs CLCAL to apply the solutions to the CL (calbration table).  The output from '''VLBAPCOR''' will look something like this:
 
<pre>
 
<pre>
FRING1: Writing SN table   2
+
AIPS 1: 'RUN PCCOR'
FRING1: Time=   0/ 07 36 19, Polarization = 1
+
PCCOR1: Task PCCOR  (release of 31DEC17) begins
FRING1: Time=   0/ 07 36 19, Polarization = 2
+
PCCOR1: Writing to SN table   2
FRING1: Found      80 good solutions
+
PCCOR1: Appears to have ended successfully
FRING1: Adjusting solutions to a common reference antenna
+
PCCOR1: localhos 31DEC17 TST: Cpu=     0.9  Real=      2  IO=        93
 +
AIPS 1: Resumes
 +
AIPS 1: 'RUN CLCAL'
 +
CLCAL1: Task CLCAL  (release of 31DEC17) begins
 +
CLCAL1: Using interpolation mode SELF
 +
CLCAL1: Copied CL file from vol/cno/vers  1  183  2 to  1  183  3
 +
CLCAL1: CALSEL: Making room for new CL data by
 +
CLCAL1: Deleting CL table no.    3
 +
CLCAL1: Processing SN table    2
 +
CLCAL1: SNMRG: Merging SN table
 +
CLCAL1: SNMRG: Write    2974 merged records from    2974 input records
 +
CLCAL1: SN2CL: Applying SN tables to CL table  2, writing CL table  3
 +
CLCAL1: Appears to have ended successfully
 +
CLCAL1: localhos 31DEC17 TST: Cpu=     0.3  Real=      1  IO=       138
 +
AIPS 1: Resumes
 +
AIPS 1: 'SN #2 CONTAINS PCAL INSTR. PHASE CORRECTIONS'
 +
AIPS 1: 'CL #3 ADDS INSTR. PHASE CORRECTIONS'
 
</pre>
 
</pre>
 +
Again, it is a good idea to make note of the last two lines that tell you which tables contain which corrections.  Most VLBAUTIL calibration scripts produce such messages.
  
For this step there ''must be no failed solutions''. Failed solutions in this step means that whichever antenna the failed solution was on is deleted from your data. For this data, because there are 10 antennas, 2 polarizations and 4 spectral windows (IFs), there should be "80 good solutions".
 
 
 
*check solutions in POSSM, the jumps in phase between the IFs should be gone. The phases may also be flattened.
 
*check solutions in POSSM, the jumps in phase between the IFs should be gone. The phases may also be flattened.
 
*# tget possm  ➜ to "get" all the inputs from the last run (it was run when we ran the procedure '''VLBACRPL''').
 
*# tget possm  ➜ to "get" all the inputs from the last run (it was run when we ran the procedure '''VLBACRPL''').
*# gainu 5
+
*# gainu 3
 
*# inp
 
*# inp
 
*# go
 
*# go
  
As you can see from Figure 2, the phases for 3C345A have been flattened and the phase jumps between the IFs are gone. For other sources farther away in time the phases may be different from 0 but there will still be no phase jumps.
+
As you can see from Figure 2, the phases for 0851+202 have been flattened and the phase jumps between the IFs are gone. For other sources farther away in time the phases may be different from 0 but there will still be no phase jumps.
  
 
=== Create BP Table and Calibrate Bandpass Shape ===
 
=== Create BP Table and Calibrate Bandpass Shape ===
  
[[Image:BPASSR.png|250px|thumb|right|'''Figure 3''' <br /> Plot of bandpass for source 3C345A .]]
+
[[Image:BPASS.png|250px|thumb|right|'''Figure 3''' <br /> Plot of bandpass for source '0851+202' .]]
  
 
Calibrate bandpass shape with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBABPSS '''VLBABPSS'''].
 
Calibrate bandpass shape with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBABPSS '''VLBABPSS'''].
Line 208: Line 225:
 
# default vlbabpss
 
# default vlbabpss
 
# getn 1
 
# getn 1
# calsour '3C345A' '3C454.3A'  ➜ use both very strong sources as bandpass calibrators.
+
# calsour '0851+202' '  ➜ use a strong source as the bandpass calibrator.
 
# refant 2
 
# refant 2
 
# inp
 
# inp
 
# vlbabpss
 
# vlbabpss
 +
 +
VLBABPSS will create a bandpass (BP) table:
 +
<pre>
 +
AIPS 1: 'BP #1 BANDPASS TABLE'
 +
</pre>
  
 
Now check the bandpass solutions with '''POSSM'''.  
 
Now check the bandpass solutions with '''POSSM'''.  
Line 233: Line 255:
 
# inp
 
# inp
 
# vlbaamp
 
# vlbaamp
 +
 +
Again, the procedure should finish with the following lines:
 +
<pre>
 +
AIPS 1: 'SN #3 CONTAINS SAMPLER CORRECTIONS'
 +
AIPS 1: 'SN #4 CONTAINS GAIN CORRECTIONS'
 +
AIPS 1: 'CL #4 ADDS SAMPLER CORRECTIONS'
 +
AIPS 1: 'CL #5 ADDS GAIN CORRECTIONS'
 +
</pre>
 +
which should be noted.
  
 
=== Examine Amplitude Calibration ===
 
=== Examine Amplitude Calibration ===
  
[[Image:SNPLTamp.png|250px|thumb|right|'''Figure 4''' <br /> Plot of amplitude gains vs. time with the different colors representing the different IF polarizations.]]
+
[[Image:SNPLT.png|250px|thumb|right|'''Figure 4''' <br /> Plot of amplitude gains vs. time with the different colors representing the different IF polarizations.]]
  
 
Examine amplitude calibration by running [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?SNPLT '''SNPLT'''].
 
Examine amplitude calibration by running [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?SNPLT '''SNPLT'''].
Line 253: Line 284:
 
# go
 
# go
  
Figure 4 shows the amplitude gains change over time as the sources rise and set, with higher gains at lower elevations. Because 3C345 and 3C454.3 are so strong, they will increase the gains. The different IFs and polarizations (RR and LL in this case) are shown as different colors.
+
Figure 4 shows that the amplitude gains change over time as the sources rise and set, with higher gains at lower elevations. The different IFs and polarizations (RR and LL in this case) are shown as different colors.
  
 
=== Correct Phases for Parallactic Angles ===
 
=== Correct Phases for Parallactic Angles ===
 
Correct phases for parallactic angle effects with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBAPANG '''VLBAPANG'''].
 
Correct phases for parallactic angle effects with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBAPANG '''VLBAPANG'''].
  
[[Image:EDITRbefore.png|250px|thumb|right|'''Figure 5''' <br /> EDITR plot showing a high data point for baselines 01-10 that we will need to flag.]]
+
[[Image:EDITR2.png|250px|thumb|right|'''Figure 5''' <br /> EDITR display showing all the baselines to antenna 10 for 2200+420.  You can see for all the baselines the amplitude is low for the first scan and for baseline 01-10 the phases for this scan look like noise. We want to flag this data.]]
  
 
# default vlbapang
 
# default vlbapang
Line 264: Line 295:
 
# inp
 
# inp
 
# vlbapang
 
# vlbapang
 +
 +
<pre>
 +
AIPS 1: 'CL #6 ADDS PARALLACTIC ANGLE CORRECTIONS'
 +
</pre>
  
 
=== Manually Edit Data ===
 
=== Manually Edit Data ===
  
[[Image:EDITRflagtime.png|250px|thumb|right|'''Figure 6''' <br /> EDITR plot showing the cutoff area for the FLAG ABOVE option. Every data point above the cutoff line will be flagged.]]
 
  
[[Image:EDITRaftreplot.png|250px|thumb|right|'''Figure 7''' <br /> A "REPLOT" of baseline 01-10, after flagging of the high data point and re-scaling.]]
+
[[Image:EDITR3.png|250px|thumb|right|'''Figure 6''' <br /> To flag this data we click FLAG TIME RANGE and hit B, and a blue box appears in the 01-10 box on the bottom.]]
 +
 
 +
[[Image:EDITR4.png|250px|thumb|right|'''Figure 7''' <br /> After moving the sides of the box to encompass the data that need to be flagged, hit C and the data are flagged and turn red.]]
 +
 
  
 
Edit the data using [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?EDITR '''EDITR'''] on each source separately.
 
Edit the data using [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?EDITR '''EDITR'''] on each source separately.
Line 280: Line 317:
 
# doband 1
 
# doband 1
 
# bpver 1
 
# bpver 1
# flagver 1
 
# outfgver 1
 
 
# antuse 1 2 3 4 5 6 7 8 9 10 ➜ to plot all the baselines to one antenna at the same time.
 
# antuse 1 2 3 4 5 6 7 8 9 10 ➜ to plot all the baselines to one antenna at the same time.
  
 
Run on one source at a time:
 
Run on one source at a time:
*AFGL2591:
+
*0851+202:
*#source <nowiki>'AFGL2591''</nowiki>
+
*#source <nowiki>'0851+202''</nowiki>
 
*#inp
 
*#inp
 
*#go
 
*#go
  
Again look in you terminal window for intructions:
+
Again look in you terminal window for instructions:
 
<pre>  
 
<pre>  
 
EDITR1: Press buttons A, B, or C to choose an operation
 
EDITR1: Press buttons A, B, or C to choose an operation
Line 296: Line 331:
 
</pre>
 
</pre>
  
Note that the data looks great but there are a few high points we'll want to flag. The data we want to flag is found on baseline 01-10 as seen in Figure 5. Click "NEXT BASELINE" found on the menu to the righ and press "B" until baseline 01-10 is plotted in the edit window at the bottom of the display . We will now flag the high points with flagging options found on the left menu. Click "FLAG ABOVE" and hit B. Your mouse cursor should shift to the edit window. In the terminal window you will now see instructions for FLAG ABOVE:
+
EDITR plots both amplitudes and phases verses time, so this is a good way to just look at your data.  For the inputs we chose, all the polarizations and IFs are plotted on top of each other.  The two boxes on the bottom plot these as different colors and show the amplitude and phase for one baseline.  The other boxes, where the data are shown in green, are the other baselines to that single antenna.  It is especially useful to look at the data this way because problems tend to be antenna based so all the baselines to an antenna will be effected.  It you see potentially problematic data (especially high or low amplitudes or with bad phases (note that weak sources will have incoherent phases)), then you should wait to flag until you can see all the baselines to the other antenna in the baseline pair with the bad data. That way you can flag once, telling EDITR to flag all the data for one antenna (this is the default in EDITR, but can be changed). The data for this source looks great. Click "NEXT ANTENNA" found on the menu to the right and press "B" until you have looked at all the baselines on all the antennas for this source.  At this point the data has been amplitude calibrated but the source amplitude changes from scan to scan, do you know the reason for this?
 +
 
 +
Now plot the other sources and inspect.
 +
 
 +
*1828+487:
 +
*#source <nowiki>'1828+487''</nowiki>
 +
*#go
 +
 
 +
1828+487 also looks pretty good, although there are some ratty amplitudes and phase on the last scan on baselines to antenna 10. We will just leave these for now because the final fringe fit and self-calibration might fix it.
 +
 
 +
*2200+420:
 +
*#source <nowiki>'2200+420''</nowiki>
 +
*#go
 +
 
 +
As you can see in Figure 5 this source the first scan on the baselines to antenna 10 looks bad.  The amplitude is very low and the phases are noise. To flag this data click FLAG TIME RANGE and hit B (Figure 6), and a blue box appears in the 01-10 box on the bottom. By hitting A and moving the cursor move the sides of the box to encompass the data which needs to be flagged; then hit C.  The data will be flagged on all the baselines to the antenna and will turn white in the lower colored parts and red in the upper comparison parts of the display (Figure 7).
 +
 
 +
=== Fringe Fit the Data ===
 +
 
 +
Perform a global fringe fit with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?FRING '''FRING''']. The following steps through imaging are not strictly necessary since we will have to redo them once the geodetic calibration is done, but they are an excellent way to check that the calibration up to this point is correct.
 +
 
 +
# default fring
 +
# getn 1
 +
# calsour '0851+202', '1828+487', '2200+420' ➜ do a global fringe fit on all sources.
 +
# refant 2
 +
# search 2 9 5 4 1 3 7 8  ➜ list of antennas to search if a solution is hard to find.
 +
# solint 0.25
 +
# doband 1
 +
# bpver 1
 +
# aparm(6) 2  ➜ print some information on solutions.
 +
# aparm(9) 1  ➜ do exhaustive baseline search.
 +
# docal 1; gainu 0
 +
# inp
 +
# go
 +
 
 +
You should look at the number of good and failed solutions:
 
<pre>
 
<pre>
EDITR1: Hit buttons A or B to flag high fluxes and continue
+
FRING1: Found    97646 good solutions
EDITR1: Hit button C to flag high fluxes and return to menu
+
FRING1: Failed on    1042 solutions
EDITR1: Hit button D to return to menu with no more flagging
+
FRING1: Adjusting solutions to a common reference antenna
 
</pre>
 
</pre>
 +
You should get something similar, but not necessarily exactly the same numbers of good and failed solutions. A small percentage of failed solutions are fine at this point.  FRING will have created SN table number 5.
  
Choose where to place your cutoff line as seen in Figure 6. Every data point above this line will be flagged. Press "C" to flag the high fluxes and return to the menu. The data points should now be highlighted red. To view the results of the flagging, we can generate a new plot by clicking "REPLOT" and pressing B. The plot will update without the high data points as seen in Figure 7. On the left menu, click on "EXIT" then press B. This will write the flags to a new flagging table (FG) which we can later apply to the data.
+
Since we did not use a source model, FRING assumes that the calibration source is a point source at the phase center.  None of these sources are point sources. Therefore the corrections FRING finds will not correct the data perfectly and, once we apply all the calibration, it will be necessary to do self-calibration with source models to get the best images. Also note that I said "at the phase center" so, no matter what the the true position of your target, this fringe fit will move the brightest spot of the source to the phase center (the position of the target in the correlation).
  
Now plot the other sources and inspect.
+
=== Apply FRING solutions ===
  
*20330+40003:
+
Note that the previous step and this step can be done in the single procedure [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBAFRNG '''VLBAFRNG'''].  It is broken up here just to show both the steps explicitly, but also because running the tasks individually allows for more control.  Here the global fringe fit which was done in the last step is interpolated and applied to the all the calibration that has gone before with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?CLCAL '''CLCAL'''].
*#source <nowiki>'20330+40003''</nowiki>
 
*#go
 
  
*J2007+4029:
+
# default clcal
*#source <nowiki>'J2007+4029''</nowiki>
+
# getn 1
*#go
+
# gainv 6  ➜ CL table with all the calibration.
 +
# gainu 7  ➜ CL table to write next step of calibration in.
 +
# snver 5  ➜ global fringe fit solutions from FRING
 +
# interpol 'SELF'  ➜ use 2PT interpolation.
 +
# refant 2
 +
# sour '0851+202', '1828+487', '2200+420' ➜ sources to which to apply calibration.
 +
# calsour sour  ➜ set calibrator sources to the same sources in parameter sources
 +
# inp
 +
# go
  
EDITR plots both amplitudes and phases, so this is a good way to just look at your data. If you plot the phases on all the baselines, note that you can see coherent phases on J2007+4029, but not the other two sources. AFGL2591 has strong masers that fringe, but '''EDITR''' is plotting all the channels averaged.
+
So SN table #5 will be applied to CL table #6 and create CL table #7 which now includes all the calibration.
  
 
=== Backing up Your Calibration ===
 
=== Backing up Your Calibration ===
  
We will want to save the calibration up to this point with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?TASAV '''TASAV''']. TASAV makes a new file with all your calibration tables, this is very useful because it contains everything you need to recalibrate your data in a very compact and portable form. It is also a good idea to do this before you do anything you are unsure about or will change important tables (AN, SU) in ways that are hard to change them back. In the next step we are changing the SU table.
+
We will want to save the calibration up to this point with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?TASAV '''TASAV''']. TASAV makes a new file with all your calibration tables. This is very useful because it contains everything you need to recalibrate your data in a very compact and portable form. It is also a good idea to do this before you do anything you are unsure about or will change important tables (AN, SU) in ways that are hard to change back.  
  
 
# default tasav
 
# default tasav
Line 328: Line 404:
  
 
Lets look at our catalog again:
 
Lets look at our catalog again:
#uc
+
*uc
 
You should get something that look similar to:
 
You should get something that look similar to:
 
<pre>
 
<pre>
 
AIPS 1: Catalog on disk  1
 
AIPS 1: Catalog on disk  1
 
AIPS 1:  Cat  Usid Mapname      Class  Seq  Pt    Last access    Stat
 
AIPS 1:  Cat  Usid Mapname      Class  Seq  Pt    Last access    Stat
AIPS 1:    1 1099 BM272HC     .UVDATA.    1 UV 07-APR-17 16:19:59
+
AIPS 1:    1   193 BL193BG     .UVAVG .    1 UV 01-JUL-17 14:28:24
AIPS 1:    2 1099 BM272HC GEO .UVDATA.    1 UV 07-APR-17 15:36:29
+
AIPS 1:    2   193 BL193BG     .TASAV .    1 UV 27-JUN-17 11:52:14
AIPS 1:    3  1099 BM272HC     .TASAV .    1 UV 07-APR-17 16:19:59
 
 
</pre>
 
</pre>
Note that you now have a third catalog entry which TASAV automtically named BM272HC.TASAV.1.  This uv data file has 1 visibility and all the tables attached to BM272HC.UVDATA.1.  Lets look at the TASAVed file.:
+
Note that you now have a second catalog entry which TASAV automatically named BL193BG.TASAV.1.  This uv data file has 1 visibility and all the tables attached to BM272HC.UVDATA.1.  Lets look at the TASAVed file.:
#getn 3
+
#getn 2
 
#imh
 
#imh
 
You should get something that looks like:
 
You should get something that looks like:
 
<pre>
 
<pre>
AIPS 1: Image=MULTI    (UV)        Filename=BM272HC     .TASAV .  1
+
AIPS 1: Image=MULTI    (UV)        Filename=BL193BG     .TASAV .  1
AIPS 1: Telescope=VLBA              Receiver=
+
AIPS 1: Telescope=VLBA              Receiver=VLBA
AIPS 1: Observer=BM272              User #= 1099
+
AIPS 1: Observer=BL193BG            User #= 193
AIPS 1: Observ. date=13-MAY-2009     Map date=14-APR-2017
+
AIPS 1: Observ. date=16-JUN-2016     Map date=27-JUN-2017
 
AIPS 1: # visibilities        1    Sort order  TB
 
AIPS 1: # visibilities        1    Sort order  TB
 
AIPS 1: Rand axes: UU-L-SIN  VV-L-SIN  WW-L-SIN  TIME1  SUBARRAY
 
AIPS 1: Rand axes: UU-L-SIN  VV-L-SIN  WW-L-SIN  TIME1  SUBARRAY
AIPS 1:            SOURCE  FREQSEL INTTIM  GATEID  CORR-ID  ANTENNA1
+
AIPS 1:            SOURCE  REMOVED INTTIM  GATEID  CORR-ID  ANTENNA1
 
AIPS 1:            ANTENNA2
 
AIPS 1:            ANTENNA2
 
AIPS 1: ----------------------------------------------------------------
 
AIPS 1: ----------------------------------------------------------------
Line 354: Line 429:
 
AIPS 1: COMPLEX      3  1.0000000E+00      1.00  1.0000000E+00    0.00
 
AIPS 1: COMPLEX      3  1.0000000E+00      1.00  1.0000000E+00    0.00
 
AIPS 1: STOKES      2  -1.0000000E+00      1.00 -1.0000000E+00    0.00
 
AIPS 1: STOKES      2  -1.0000000E+00      1.00 -1.0000000E+00    0.00
AIPS 1: FREQ       256   2.2217920E+10       1.00  3.1250000E+04   0.00
+
AIPS 1: FREQ       32   1.5240375E+10     17.00  1.0000000E+06   0.00
AIPS 1: IF          4   1.0000000E+00      1.00  1.0000000E+00    0.00
+
AIPS 1: IF          8   1.0000000E+00      1.00  1.0000000E+00    0.00
AIPS 1: RA          1    00 00 00.000      1.00      0.000000   0.00
+
AIPS 1: RA          1    00 00 00.000      1.00      3600.000   0.00
AIPS 1: DEC          1    00 00 00.000      1.00      0.000000   0.00
+
AIPS 1: DEC          1    00 00 00.000      1.00      3600.000   0.00
 
AIPS 1: ----------------------------------------------------------------
 
AIPS 1: ----------------------------------------------------------------
 
AIPS 1: Coordinate equinox 2000.00
 
AIPS 1: Coordinate equinox 2000.00
 
AIPS 1: Maximum version number of extension files of type HI is  1
 
AIPS 1: Maximum version number of extension files of type HI is  1
 +
AIPS 1: Maximum version number of extension files of type AT is  1
 +
AIPS 1: Maximum version number of extension files of type CT is  1
 
AIPS 1: Maximum version number of extension files of type FQ is  1
 
AIPS 1: Maximum version number of extension files of type FQ is  1
AIPS 1: Maximum version number of extension files of type CT is  1
 
AIPS 1: Maximum version number of extension files of type OB is  1
 
 
AIPS 1: Maximum version number of extension files of type AN is  1
 
AIPS 1: Maximum version number of extension files of type AN is  1
AIPS 1: Maximum version number of extension files of type CL is  8
+
AIPS 1: Maximum version number of extension files of type CL is  7
 
AIPS 1: Maximum version number of extension files of type CQ is  1
 
AIPS 1: Maximum version number of extension files of type CQ is  1
 
AIPS 1: Maximum version number of extension files of type GC is  1
 
AIPS 1: Maximum version number of extension files of type GC is  1
Line 374: Line 449:
 
AIPS 1: Maximum version number of extension files of type TY is  1
 
AIPS 1: Maximum version number of extension files of type TY is  1
 
AIPS 1: Maximum version number of extension files of type WX is  1
 
AIPS 1: Maximum version number of extension files of type WX is  1
AIPS 1: Maximum version number of extension files of type SN is  4
+
AIPS 1: Maximum version number of extension files of type SN is  5
 
AIPS 1: Maximum version number of extension files of type BP is  1
 
AIPS 1: Maximum version number of extension files of type BP is  1
 
AIPS 1: Maximum version number of extension files of type FG is  1
 
AIPS 1: Maximum version number of extension files of type FG is  1
 
</pre>
 
</pre>
Note that there are 8 calibration (CL) tables and 4 solution (SN) tables.  As well as numerous other tables with information about you data (history (HI), frequency (FQ), antenna (AN), system temperature (TY), bandpass (BP), flag (FG)...).
+
Note that there is 1 visibility but 7 calibration (CL) tables and 5 solution (SN) tables.  As well as numerous other tables with information about you data (history (HI), frequency (FQ), antenna (AN), system temperature (TY), bandpass (BP), flag (FG)...).
  
=== Apply Correction to CL Table ===
+
=== Apply Calibration and SPLIT the Data ===
  
We will now shift the position of AFGL2591 with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?CLCOR '''CLCOR''']. The observed/correlated position of AFGL2591 was quite wrong and shifting a large distance in the image plane is imprecise, therefore it is important to shift the uv-data with either '''CLCOR''' or [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?UVFIX '''UVFIX''']. Normally you would reduce and image the data to find the shift.
+
Apply calibration and make single source data sets with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?SPLIT '''SPLIT''']. I like to work with single source files, it's less confusing, especially when self-caling and imaging.
  
# default clcor
+
# default split
 
# getn 1
 
# getn 1
# sour 'AFGL2591''
+
# freqid 0
# gainver 8
+
# docal 1; gainu 7  ➜ apply calibration; from CL#7.
# gainuse 9
+
# sour '0851+202', '1828+487', '2200+420'
# opcode 'antp'
+
# doband 1; bpver 1
# clcorprm(5)= 0.009 Correction in RA direction in seconds of arc.
+
# aparm 2 0 0 0 1 1 aparm(1)=2 tells SPLIT to average all the channels in each IF, reducing the size of the data significantly.
# clcorprm(6)=-0.129 ➜ Correction in Dec direction in seconds of arc.
 
 
# inp
 
# inp
# go  
+
# go
  
'''Note:''' If you do something wrong in this step, just doing the same shift in reverse will not undo the shift to astrometric accuracy due to the complications of precession. This is why we did the '''TASAV''' step. To undo the shift, delete the ''CL'' table that was created by '''CLCOR''' and the ''SU'' table using [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?EXTDEST '''EXTDEST''']. Then copy the ''SU'' table from the TASAVed file with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?TACOP '''TACOP'''].
+
This will produce three files named sourcename.SPLIT.1, again type '''uc''' to look at the catalog.
 
 
=== Apply Calibrations ===
 
Apply all calibration up to this point and copy out IF#3 with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?SPLAT '''SPLAT''']. The masers are in the 3rd IF and we will be fringe fitting on that maser so we should get rid of the other IFs. We could have gotten rid of the other 3 IFs earlier, but I kept them around for two reasons, 1) I wanted you to see what more than one IF looked like in displays and editing since most of the data you will receive will be more than on IF; and 2) it is a good idea to apply the calibration after the position shift and before global fringe fitting (and adding the zenith delay correction).
 
 
 
# default splat
 
# getn 1
 
# bif 3; eif 3
 
# docal 1
 
# gainu 9
 
# doband 1
 
# bpver 1
 
# inp
 
# go
 
 
 
'''For the next 4 steps you will be running the AIPS tasks on the dataset out of SPLAT. Lets look at the catalog again.'''
 
# uc
 
 
<pre>
 
<pre>
 
AIPS 1: Catalog on disk  1
 
AIPS 1: Catalog on disk  1
 
AIPS 1:  Cat  Usid Mapname      Class  Seq  Pt    Last access    Stat
 
AIPS 1:  Cat  Usid Mapname      Class  Seq  Pt    Last access    Stat
AIPS 1:    1 1099 BM272HC     .UVDATA.    1 UV 07-APR-17 16:19:59
+
AIPS 1:    1   193 BL193BG     .UVAVG .    1 UV 01-JUL-17 14:28:24
AIPS 1:    2 1099 BM272HC GEO .UVDATA.    1 UV 07-APR-17 15:36:29
+
AIPS 1:    2   193 BL193BG    .TASAV .    1 UV 03-JUL-17 15:01:55
AIPS 1:    3 1099 BM272HC    .TASAV .    1 UV 07-APR-17 16:19:59
+
AIPS 1:    3   193 2200+420    .SPLIT .    1 UV 03-JUL-17 15:12:12
AIPS 1:    4 1099 BM272HC     .SPLAT .    1 UV 07-APR-17 17:46:29
+
AIPS 1:    4   193 0851+202    .SPLIT .    1 UV 03-JUL-17 15:14:41
 +
AIPS 1:     5  193 1828+487    .SPLIT .    1 UV 03-JUL-17 15:15:29
 
</pre>
 
</pre>
BM272HC.SPLAT.1 is catalog number 4.  Also if you see a gap in the catalog numbers, say BM272HC.SPLAT.1 was catalog number 5, then type [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?RECAT '''recat'''], and it will remove any gaps.
 
  
=== Plot Power Spectra  ===
+
=== OPTIONAL: Getting the Calibrated Data ===
  
[[Image:POSSMselectschan.png|250px|thumb|right|'''Figure 8''' <br /> A plot showing the maser in channel 145.]]
+
'''''THIS STEP IS OPTIONAL: If everything went well in the above steps there is no need to get the calibrated data.'''''
  
Select channel for global fringe fit with '''POSSM'''.
+
However If something went wrong with the calibration or if you want to start with the imaging and self-calibration then download the following files and put them in your $FITS area:
 +
*[ftp://ftp.aoc.nrao.edu/pub/SIW/0851+202.SPLIT.1 0851+202.SPLIT.1] (6.3 MB): Calibrated data for source 0851+202.
 +
*[ftp://ftp.aoc.nrao.edu/pub/SIW/1828+487.SPLIT.1 1828+487.SPLIT.1] (7.8 MB): Calibrated data for source 1828+487.
 +
*[ftp://ftp.aoc.nrao.edu/pub/SIW/2200+420.SPLIT.1 2200+420.SPLIT.1] (6.8 MB): Calibrated data for source 2200+420.
  
# tget possm
+
Then load the data with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?FITLD '''FITLD''']:
# getn 4
+
# default fitld
# sour 'AFGL2591''
+
# datain 'MYAIP:0851+202.SPLIT.1
# base 2 0
+
# outdisk 1
# gainu 0
 
# solint -1
 
# doband -1
 
# aparm 0, 1, 0, 0, -180, 180, 0, 0, 1
 
# dotv 1
 
# nplots 1
 
# bchan 100; echan 180
 
# inp
 
# go
 
 
 
We really only need to look at one spectrum for this, so you can hit "D" right away or go through a few plots to see how the spectrum changes a bit from baseline to baseline.
 
 
 
Figure 8 shows that the maser is strongest in channel 145.
 
 
 
=== Fringe Fit the Data ===
 
 
 
Perform a global fringe fit with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?FRING '''FRING''']. The following steps through imaging are not strictly necessary since we will have to redo them once the geodetic calibration is done, but is an excellent way to check the calibration up to this point is correct.
 
 
 
# default fring
 
# getn 4
 
# calsour 'AFGL2591'' ➜ do a global fringe fit on maser.
 
# bchan 145;echan 145
 
# refant 2
 
# search 2 9 5 4 1 3 7 8  ➜ list of antennas to search if a solution is hard to find.
 
# aparm(9) 1 ➜ do exhaustive baseline search.
 
# docal 1; gainu 0
 
 
# inp
 
# inp
 
# go
 
# go
  
You should look at the number of good and failed solutions:
+
and repeat for 1828+487.SPLIT.1 and 2200+420.SPLIT.1.
<pre>
 
FRING1: Found    4506 good solutions
 
FRING1: Failed on      34 solutions
 
FRING1: Adjusting solutions to a common reference antenna
 
</pre>
 
You should get something similar but not necessarily exactly the same numbers of good and failed solutions. A small percentage of failed solutions are fine at this point.
 
  
Hint: We will have to do this exact same step after doing the zenith delay calibration so it is helpful to save the inputs to '''FRING'''. This can be done with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VNUM '''vnum'''] and [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VPUT '''vput'''].
+
'''Note that these data do not include self-calibration but does include flagging.'''
  
# vnum 1; vput fring
+
=== Flagging 1828+487 ===
 +
[[Image:WIPER1.png|250px|thumb|right|'''Figure 8''' <br /> WIPER plot of amplitude vs UV distance.]]
 +
[[Image:WIPER2.png|250px|thumb|right|'''Figure 9''' <br /> WIPER plot with high amp points flagged (in blue).]]
 +
[[Image:WIPER3.png|250px|thumb|right|'''Figure 10''' <br /> WIPER plot with low amp points flagged (in blue).]]
  
=== Apply FRING solutions from AFGL2591 to Calibrators ===
+
Let's do some more flagging before we get into imaging.  A nice graphical flagging task that is especially useful after SPLITing is [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?WIPER '''WIPER'''].  WIPER defaults to plot amplitude vs uv distance:
  
Note that this is "phase referencing", you are getting phases on one source and applying them to another, nearby source.  However the way we are doing it here is a little backwards, in most situations your target it too faint to use in FRING and you run FRING on one of the calibrators and apply those phases to your target.  Here we are using the target maser in FRING because it is stronger and applying it to the calibrators because we care about positions. In this case any shift in the position of the calibrators will indicate that AFGL2591 has moved. Interpolate the fringe solutions with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?CLCAL '''CLCAL'''].
+
# default wiper
 
+
# getn 5
# default clcal
+
# imsi 512
# getn 4
 
# gainv 1  ➜ CL table with all the calibration.
 
# gainu 2  ➜ CL table to write next step of calibration in.
 
# snver 1  ➜ smoothed table out of SNSMO, contains final fringe fit.
 
# interpol '2PT'  ➜ use 2PT interpolation.
 
# refant 2
 
# sour 'AFGL2591' '20330+40003' 'J2007+4029'  ➜ sources to which to apply calibration.
 
# calsour 'AFGL2591''  ➜ phase calibrator, phases will be applied from AFGL2591 to itself, 20330+40003 and J2007+4029.
 
 
# inp
 
# inp
 
# go
 
# go
  
This is another spot where '''vnum''' and '''vput''' will be useful:
+
Ick! Look at those high points (Figure 8).  Flag those by clicking on FLAG AREA, setting a box hitting the "A" key then hitting the "C" key when done, the flaged points will turn blue as in Figure 9.  Now click EXIT and hit "A". Immediately type "go" to run WIPER again. This is more like it (Figure 10), but there are some low points, flag those with FLAG AREA but don't be too overzealous.
 
 
# vnum 1; vput clcal
 
 
 
=== Apply Calibration and SPLIT the Data ===
 
 
 
Apply calibration and make single source data sets with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?SPLIT '''SPLIT''']. I like to work with single source files, it's less confusing, especially when self-caling and imaging.
 
  
# default split
+
Now you have 2 flag (FG) tables attached to the data, one for each run of WIPER. FG table 2 has all the flags in it.
# getn 4
 
# freqid 0
 
# docal 1; gainu ➜ apply calibration; from CL#2.
 
# sour 'AFGL2591' '20330+40003' 'J2007+4029'  ➜ split out target and phase calibrators.
 
# inp
 
# go
 
  
This will produce three files named sourcename.SPLIT.1, again type '''uc''' to look at the catalog.
+
=== Imaging and Self-Cal of 1828+487 ===
<pre>
 
AIPS 1: Catalog on disk  1
 
AIPS 1:  Cat  Usid Mapname      Class  Seq  Pt    Last access    Stat
 
AIPS 1:    1  1099 BM272HC    .UVDATA.    1 UV 07-APR-17 20:18:29
 
AIPS 1:    2  1099 BM272HC GEO .UVDATA.    1 UV 07-APR-17 15:36:29
 
AIPS 1:    3  1099 BM272HC    .TASAV .    1 UV 07-APR-17 16:22:12
 
AIPS 1:    4  1099 BM272HC    .SPLAT .    1 UV 07-APR-17 20:18:29
 
AIPS 1:    5  1099 AFGL2591    .SPLIT .    1 UV 07-APR-17 20:18:11
 
AIPS 1:    6  1099 J2007+4029  .SPLIT .    1 UV 07-APR-17 20:18:17
 
AIPS 1:    7  1099 20330+40003 .SPLIT .    1 UV 07-APR-17 20:18:29
 
</pre>
 
  
=== Create Image of AFGL 2591 ===
+
[[Image:IMAGR1.png|250px|thumb|right|'''Figure 11''' <br /> Dirty map of 1828+487.]]
 +
[[Image:IMAGR2.png|250px|thumb|right|'''Figure 12''' <br /> Residual map of 1828+487.]]
 +
[[Image:IMAGR3.png|250px|thumb|right|'''Figure 13''' <br /> Image of 1828+487 after first run of IMAGR.]]
  
[[Image:SQASH.png|250px|thumb|right|'''Figure 9''' <br /> A radio image of the maser AFGL 2591.]]
+
Lets start by imaging 1828+487 with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?IMAGR '''IMAGR'''].  Either use the clean box files provided (make sure they are in the $MYAIP directory) or do interactive boxing.  Using the supplied box file is easier. Also lets make sure that dowait=1 by typing:
 +
* dowait=1
  
Image AFGL 2591 with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?IMAGR '''IMAGR'''].
+
Note that I came up with the parameters below especially the IMSIZE, ROBUST, RASH and DECSH by imaging and experimenting.
 +
Task [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?SETFC '''SETFC'''] can be used to recommend CELLSIZE and IMSIZE if you specify a desired field of view.  The shifts were chosen, for this source only, to center the object including its jet within the image.
 +
It is recommended that you use the supplied box files.  They reflect both the very obvious emission in the field and additional information from the MOJAVE project.
  
 
# default imagr
 
# default imagr
 
# getn 5
 
# getn 5
# bchan 125; echan 150; nchav 1; ➜ image channels 127-150.
+
# cell 0.0001; imsi 1024 512 ➜ cell size of 0.1 mas; image size of 1024x512.
# cell 3e-5; imsi 1024  ➜ cell size of 0.03 mas; image size of 1024x1024.
+
# rash -0.0125 0
# dotv 1; niter 1000 ➜ do interactive clean; with 1000 iterations.
+
# decsh 0.0125 0
# im2parm 10 6 9 0.5  ➜ autoboxing, only do 10 boxes per major cycle; find islands with > 6*rms; box is accepted if peak > 9*rms; box is accepted if its peak brightness is >0.5*max residual.
+
# dotv 1
 +
# robust 5 ➜ Do natural weighting.  This source has a big diffuse jet, therefore sensitivity and more weight on the short spacings is more important than high resolution.
 +
# niter 5000 ➜ do interactive clean; with 5000 iterations, you will probably "stop cleaning" before hitting 5000 on the first iteration of imaging.
 +
# boxfile 'MYAIP:1828_1.box
 
# inp
 
# inp
 
# go
 
# go
 +
# recat
  
'''HINT:''' The first few channels will not have any masers, just hit "STOP CLEANING" (and "A" to select, again look in terminal for instructions) until you see some emission. Hit TVPSEUDO then "D" immediately to get color rather than grey scale. If you want to interactively clean, then click CONTINUE CLEAN (and "A"); if you want to add boxes use REBOX ("A"); when you are happy wit the cleaning you can go to the next channel by clicking STOP CLEANING ("A").  You can turn off interactive clean by clicking TURN OFF DOTV ("A").  Once IMAGR is done you can do a mcat (mc for short) to look at the maps in your catalog:
 
#mc
 
<pre>
 
AIPS 1: Catalog on disk  1
 
AIPS 1:  Cat  Usid Mapname      Class  Seq  Pt    Last access    Stat
 
AIPS 1:    8  1099 AFGL2591    .IBM001.    1 MA 14-APR-17 10:58:28
 
AIPS 1:    9  1099 AFGL2591    .ICL001.    1 MA 14-APR-17 10:58:28
 
</pre>
 
Note that you have made two file, a "dirty beam" (the IBM001 file) and a cleaned map (ICL001).
 
  
Look at cube with AFGL2591 [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?TVMOVIE '''TVMOVIE'''] (getn 9; tvmovie) and use [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?SQASH '''SQASH'''] (default sqash; getn 9; bdrop 3; dparm 1 0;go) to collapse cube and then use [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?TVLOD '''TVLOD'''] to look at the '''SQASH''' image. Figure 9 shows the end results after '''SQASH'''.  SQASH will produce another map in you catalog:
+
Hit TVPSEUDO then "B" immediately to get color rather than grey scale. Figure 11 shows the dirty map. If you want to clean interactively, then click CONTINUE CLEAN (and "A"); after a few rounds of cleaning (about 300 clean components which the messages from IMAGR tell you) the residuals will look like Figure 12. You can see in Figure 12 there is not much else to clean inside the clean boxes although there is some flux outside the clean boxes. This isn't significant enough to box at this point, so click STOP CLEANING ("A").  IMAGR will return the cleaned map, Figure 13, as you can see there are artifacts in the map.
#mc
+
 
 +
Once IMAGR is done you run [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?RECAT '''RECAT'''], which compresses the catalog so there are no empty spaces.  This is not strictly necessary, but to follow this tutorial and have the GETN work, we have to be sure that the catalog numbers are consistent.  Now do a [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?MCAT '''mcat'''] (mc for short) to look at the maps in your catalog:
 +
*mc
 
<pre>
 
<pre>
 
AIPS 1: Catalog on disk  1
 
AIPS 1: Catalog on disk  1
 
AIPS 1:  Cat  Usid Mapname      Class  Seq  Pt    Last access    Stat
 
AIPS 1:  Cat  Usid Mapname      Class  Seq  Pt    Last access    Stat
AIPS 1:    8  1099 AFGL2591   .IBM001.    1 MA 14-APR-17 10:58:28
+
AIPS 1:    6  195 1828+487   .IBM001.    1 MA 04-JUL-17 10:33:14
AIPS 1:    9  1099 AFGL2591   .ICL001.    1 MA 14-APR-17 11:02:50
+
AIPS 1:    7  195 1828+487   .ICL001.    1 MA 04-JUL-17 10:33:14
AIPS 1:    10  1099 AFGL2591    .SQASH .    1 MA 14-APR-17 11:02:50
 
 
</pre>
 
</pre>
 +
Note that you have made two files, a "dirty beam" (the IBM001 file) and a cleaned map (ICL001).
  
To look at it use [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?TVLOD '''TVLOD'''] (getn 10; tvin; tvlo).  Use [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?TVPSEUDO '''TVPSEUDO'''] to put it into color (tvps).  You can either use your mouse to manipulate the colors, again look at your terminal for instructions.  Hit "D" once it looks the way you want.
+
To look at the image use [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?TVLOD '''TVLOD'''] (getn 6; tvin; tvlo).  Use [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?TVPSEUDO '''TVPSEUDO'''] to put it into color (tvps).  You can use your mouse to manipulate the colors; again look at your terminal for instructions.  Hit "D" once it looks the way you want. Figure 11 shows the image with the stretch set so the noise level is obvious. 
 
 
=== Create More Images ===
 
  
Image J2007+4029 and/or 20330+40003 with '''IMAGR''' to make sure phase referencing worked.
+
Lets measure the rms in the cleaned image with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?IMEAN '''IMEAN''']:
  
# default imagr
+
# default imean
# getn 6 or 7
+
# getn 7
# bchan 0; echan 0; nchav 256; ➜ average all channels.
 
# cell 3e-5;imsi 2048  ➜ larger image size because sources might not be at center of field.
 
# im2parm 10 6 9 0.5 ➜ autoboxing again
 
# dotv 1; niter 1000  ➜ do interactive clean; with 1000 iterations.
 
# inp
 
 
# go
 
# go
  
Here I would check that the autobox looks OK (It should just be around the the obvious emission) and then hit TURN OFF DOTV ("A").  Figure 10 shows the end result of running '''IMAGR'''.
+
The rms for this image using IMEAN's histogram fitting in units of Janskys/beam is:
 
 
[[Image:IMAGEJ2007before.png|250px|thumb|right|'''Figure 10''' <br /> A radio image of J2007+4029.]]
 
 
 
Now do an mcat to see the maps we have created:
 
#mc
 
 
<pre>
 
<pre>
AIPS 1: Catalog on disk  1
+
IMEAN1: Mean=-1.0708E-04 Rms= 2.2822E-03 **** from histogram
AIPS 1:  Cat  Usid Mapname      Class  Seq  Pt    Last access    Stat
 
AIPS 1:    8  1099 AFGL2591    .IBM001.    1 MA 14-APR-17 10:58:28
 
AIPS 1:    9  1099 AFGL2591    .ICL001.    1 MA 14-APR-17 11:02:50
 
AIPS 1:    10  1099 AFGL2591    .SQASH .   1 MA 14-APR-17 11:04:16
 
AIPS 1:    11  1099 J2007+4029  .IBM001.    1 MA 14-APR-17 11:14:05
 
AIPS 1:    12 1099 J2007+4029  .ICL001.    1 MA 14-APR-17 11:14:05
 
 
</pre>
 
</pre>
 +
IMEAN also gives you other statistics about the image such as the maximum and total flux.
  
Then getn 12; tvin; tvlo; tvps.
+
So the image isn't the best, the noise is much higher than desirable, and there are hints of lower level structure but they are not much higher than the noise.  So it looks like self-calibration would be beneficial.  At some level self-cal is an art rather than a science, and there are various different philosophies concerning how to best do self-cal.  I tend to be conservative, partially because VLBA data has fewer baselines and therefore it is easier to go off in a bad direction with the self-cal.  However, these are fairly strong sources so it will be harder to make big mistakes in the self-calibration.  Self-cal is done by the task [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?CALIB '''CALIB'''].  Generally phase-only self-cal should be done first, then amplitude and phase.  Also we will be using clean component models (i.e., the image we just made) for the self-calibration.
  
== Reducing geodetic-style data (BM272HC GEO.UVDATA.1) ==
+
# default calib
 
+
# getn 5
Instructions geodetic-like calibration to improve astrometry (and phase referencing).
+
# get2n 7 use clean components from this map as a model for the self-cal
 
 
We start with the same steps 4-8 as above on the geodetic data. Its name should be something like "BM272HC GEO.UVDATA.1" if you followed the naming I suggested in the '''FITLD''' step above.
 
 
 
 
 
=== Calibrate Ionospheric Delay ===
 
 
 
Fix ionosphere contribution to the dispersive delay by running '''VLBATECR'''.
 
 
 
# default vlbatecr
 
# getn 2
 
# inp
 
# vlbatecr  to run VLBATECR
 
 
 
=== Fix Earth Orientation Parameters ===
 
 
 
Fix earth orientation parameters by running '''VLBAEOPS'''.
 
 
 
# default vlbaeops
 
# getn 2
 
# inp
 
# vlbaeops
 
 
 
=== Apply Digital Sampling Correction to VLBA data ===
 
 
 
Correct sampler threshold errors from correlator by running '''VLBACCOR'''.
 
 
 
# default vlbaccor
 
# getn 2
 
# inp
 
# vlbaccor
 
 
 
=== Plot Cross Power Spectrum ===
 
 
 
[[Image:POSSMgeobeforepc.png|250px|thumb|right|'''Figure 11''' <br /> Cross power spectrum plot of 1743-035 showing strong fringes.]]
 
 
 
Now find a scan that has good fringes on all the baselines by running '''VLBACRPL'''. VLBACRPL runs '''POSSM''' and displays the spectrum of each baseline (to Fort Davis (antenna 2)), with the amplitude on the bottom and the phases on the top.
 
 
 
# default vlbacrpl
 
# getn 2
 
# stokes 'half'
 
 
# refant 2
 
# refant 2
# gainuse 4
+
# solint 1 ➜ 1 minute solution interval
# solint -1
+
# solty 'l1r' ➜ type of method for solution (see EXPLAIN CALIB for more details)
# dotv 1
+
# solmo 'P' ➜ solve for phases only
# source ' '
 
 
# inp
 
# inp
# vlbacrpl
+
# go
 +
# recat
  
Hit "B" a few times to go through the scansAlthough there are several sources/scans to choose from, I choose 1743-035, which has strong fringes on all baselines as seen in Figure 11.
+
You will get messages that look like this:
 
+
<pre>
=== Determine Delay Corrections ===
+
CALIB1: Task CALIB  (release of 31DEC17) begins
 +
CALIB1: Using 1828+487 . SPLIT . 1  Disk= 1 Usid= 195
 +
CALIB1: L1 Solution type
 +
CALIB1: UVGET: Using flag table version  2 to edit data
 +
CALIB1: Create 1828+487    .CALIB .  1 (UV)  on disk  1  cno    8
 +
CALIB1: Selecting and editing the data
 +
CALIB1: Using Clean Component self-cal source model
 +
CALIB1: FACSET: 1.375524 Jy found from 209 components
 +
CALIB1: Divide data by model - first compute model by summing
 +
CALIB1: QINIT: did a GET  of      5120 Kwords, OFF          5241849
 +
CALIB1: ALGMEM field    1 Ipol gridded model subtraction chns    1-    8
 +
CALIB1: ALGMEM: at visibility number          1
 +
CALIB1: ALGMEM:  1024 - 0 cells, with      23349 Pts
 +
CALIB1: Field    1 used    209 CCs
 +
CALIB1: Determining solutions using full vector averaging
 +
CALIB1: Writing SN table    1
 +
CALIB1: Found        7380 good solutions
 +
CALIB1:                  7 solutions had no data
 +
CALIB1: Average closure rms =  0.03470 +-  0.00913
 +
CALIB1: Fraction of times having data >  2.5 rms from solution
 +
CALIB1: 0.24661 of the times had  2 -  4 percent outside  2.5 times rms
 +
CALIB1: 0.09842 of the times had  4 -  6 percent outside  2.5 times rms
 +
CALIB1: 0.06674 of the times had  6 -  8 percent outside  2.5 times rms
 +
CALIB1: 0.08258 of the times had  8 - 10 percent outside  2.5 times rms
 +
CALIB1: 0.07579 of the times had 10 - 12 percent outside  2.5 times rms
 +
CALIB1: 0.06900 of the times had 12 - 14 percent outside  2.5 times rms
 +
CALIB1: 0.04186 of the times had 14 - 16 percent outside  2.5 times rms
 +
CALIB1: 0.02602 of the times had 16 - 18 percent outside  2.5 times rms
 +
CALIB1: 0.01810 of the times had 18 - 20 percent outside  2.5 times rms
 +
CALIB1: 0.01131 of the times had 22 - 24 percent outside  2.5 times rms
 +
CALIB1: 0.00113 of the times had 26 - 28 percent outside  2.5 times rms
 +
CALIB1: Applying solutions to data
 +
CALIB1:            Previously flagged  Flagged by gain        Kept
 +
CALIB1: Partially                  341                  0      341
 +
CALIB1: Fully                        0                  0    23008
 +
CALIB1: Copied WX file from vol/cno/vers  1    5  1 to 1    8  1
 +
CALIB1: Copied AN file from vol/cno/vers  1    5  1 to 1    8  1
 +
CALIB1: Copied FG file from vol/cno/vers  1    5  1 to  1    8  1
 +
CALIB1: Copied FG file from vol/cno/vers  1    5  2 to  1    8  2
 +
CALIB1: Appears to have ended successfully
 +
</pre>
  
[[Image:POSSMgeoaftermpcl.png|250px|thumb|right|'''Figure 12''' <br /> Cross power spectrum plot of 1743-035 showing phase corrections.]]
+
There are several things you should note in these messages:
 +
* CALIB creates a new UV file called 1828+487.CALIB.1 at catalog number 8
 +
* CALIB also writes an SN table attached to the input data file
 +
* CALIB found 7380 good solutions, 7 had no data and did not fail on any
 +
* CALIB didn't flag any new data.  Since this is such a strong source CALIB probably will not flag any of the data.  However for weaker sources this is a concern, a bad model and a weak source could mean that some portion of your input data is flagged by CALIB, meaning you can take your imaging to strange places if you are not careful.
  
Find and remove instrumental delay by running '''VLBAMPCL'''.
+
Now we image the corrected data.  We can either use the file that CALIB created ''or'' the original file applying the SN table that CALIB attached to it. Just for brevity we will use the file CALIB created:
  
# default vlbampcl
+
# tget imagr
# getn 2
+
# getn 8
# calsour '1743-035''
+
# boxfi 'MYAIP:1828_2.box
# timer 0 7 15 8 0 7 16 01 ➜ scan with good fringes we found in POSSM plots.
 
# refant 2  ➜ choose reference antenna from in the middle of array, FD (antenna 2) is a good choice.
 
# gainu 4  ➜ apply highest CL table. Please do an imh here to make sure the highest CL table is really 4.
 
 
# inp
 
# inp
# vlbampcl
+
# go; recat
  
At this point you should check on the calibration:
+
After about 1500 clean components the map looks sufficiently clean.  While doing the interactive clean the residuals did look better than in the first imaging but lets do IMEAN again (tget imean; getn 10; go) to confirm the rms is getting lower.  The noise is now ~1.3E-03 Jy/beam, so a significant drop, but we can probably still do better.  So more self-cal, with a shorter solution interval:
  
*First check you have no failed solutions. At the end of the '''FRING''' run it should tell you how many "good" and "failed" solutions it has found. For this step there must be no failed solutions, failed solutions in this step mean that whatever antenna the failed solution was on is deleted from your data. For this data there should be "80 good solutions".
+
# tget calib
 +
# get2n 10
 +
# solint 0.5
 +
# go; recat
  
*check solutions in '''POSSM''', the jumps in phase between the IFs should be gone. The phases may also be flattened.
+
Now we have:
*# tget possm➜ to "get" all the inputs from the last run (it was run when we ran the procedure '''VLBACRPL''').
+
<pre>
*# gainu 5
+
CALIB1: Writing SN table    2
*# inp
+
CALIB1: Found        14749 good solutions
*# go
+
CALIB1:                12 solutions had no data
 +
</pre>
  
Again hit "B" a few times.  As you can see from Figure 12, the phase jumps between the IF's are gone. Some sources will show a general phase slope across all the IF's. This is the multi-band delay that we will measure and fit for the zenith delay.
+
Image again:
 +
# tget imagr
 +
# getn 11
 +
# go; recat
  
=== Determine Multi-Band Delay ===
+
IMEAN again:
 +
# tget imean
 +
# getn 13
 +
# go
  
Determine multi-band delay (MBD) by running '''FRING'''. This will take a few minutes.
+
Now the rms is about 1.1E-3 Jy/beam, so a little lower than last time but a much smaller drop. Lets try a much smaller solution interval.
  
# default fring
+
# tget calib
# getn 2
+
# get2n 13
# refant 2
+
# solint 0.1
# docal 1; gainu 5
+
# go; recat
# aparm(5)=2 ➜ solve form the MBD.
 
# inp
 
# go
 
  
There will be a lot of failed solutions (~20%) here and that is O.K.. :
+
Now we have:
 
<pre>
 
<pre>
FRING1: Found     3448 good solutions
+
CALIB1: Writing SN table    3
FRING1: Failed on     736 solutions
+
CALIB1: Found       53090 good solutions
FRING1: Adjusting solutions to a common reference antenna
+
CALIB1: Failed on       72 solutions
FRING1: Appears to have ended successfully
+
CALIB1:                 92 solutions had no data
 
</pre>
 
</pre>
 +
So CALIB failed on a tiny fraction of solutions and flagged a tiny fraction of the data.  This is OK, it just means that with this solution interval we are on the edge of not having enough sensitivity to get good solutions.
  
=== Plot the Multi-Band Delay ===
+
Image again:
 +
# tget imagr
 +
# getn 14
 +
# boxfi 'MYAIP:1828_3.box
 +
# go; recat
  
[[Image:SNPLTmdel.png|250px|thumb|right|'''Figure 13''' <br /> Multi-Band delay plot showing offset points that will need to be flagged.]]
+
IMEAN again:
 +
# tget imean
 +
# getn 16
 +
# go
  
Check MBD with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?SNPLT '''SNPLT'''].
+
Now the rms is about 8.8E-4 Jy/beam, another significant drop, either the low solint or the extra box is making things better, probably both. So lets do one more phase only self cal with this solution interval before going to amplitude and phase.
  
# default snplt
+
# tget calib
# getn 2
+
# get2n 16
# inext 'sn'; invers 3
+
# go; recat
# nplots 10
 
# dotv 1
 
# opty 'mdel'➜ plot MBD.
 
# xaxis 2➜ plot verses elevation.
 
# tvin; go ➜ clear TV and run task
 
  
It is important that the MBD be correct because the fitting in [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?DELZN '''DELZN'''] can easily go wonky.  
+
Now we have:
 +
<pre>
 +
CALIB1: Writing SN table    4
 +
CALIB1: Found        53093 good solutions
 +
CALIB1: Failed on      69 solutions
 +
CALIB1:                92 solutions had no data
 +
</pre>
 +
Note that it failed on fewer solutions that last time, another indication that the additional box added to the cleaning allowed for model that fit the data better.
  
Figure 13 shows the resulting plot generated by SNPLT. Note that most MBD are between a fraction and a few ns. Large ones are probably wrong and should be clipped. There also should be a general trend from low to high elevations, although this is not always clear in the plot. The most obvious classic case is for SC as seen in Figure 13. Make note of the obviously bad points, one at BR (-3 ns), one at NL (-6 ns), two at PT (-3 ns), and one at SC (about 19 ns).
+
Image again:
 
+
# tget imagr
=== Flag Offset Data Points ===
+
# getn 17
 
+
# go; recat
Edit the MBD with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?SNEDT '''SNEDT''']. SNEDT will only plot versus time, which is why we noted the bad points above.
 
  
# default snedt
+
IMEAN again:
# getn 2
+
# tget imean
# inext 'sn'; invers 3
+
# getn 19
# antuse 1 2 3 4 5 6 7 8 9 10
 
# dodelay 2
 
 
# go
 
# go
  
Flag the points noted above. After having removed the bad points and exiting, a new solutions table (SN #4) should have been created.
+
Now the rms is about 8.5E-4 Jy/beam, so another small drop.
  
=== Inspect the Corrected Multi-Band Delays ===
+
Lets move to amplitude self cal.  You might have noticed that for the runs of CALIB we went back to the original data rather than the self-caled data.  This is one of those philosophies of self-cal I mentioned earlier, you could have used the the output file from CALIB and done smaller increments of self-cal, I prefer to go back to the original data and just improve the model.  I do this because here is less chance of getting an incorrect model stuck in the data with this method.  However once we move to amplitude self-cal we want to use the data with the best calibrated phases so we will start with the last file out of CALIB.
  
Check MBD again with '''SNPLT'''.
+
# tget calib
 +
# getn 17
 +
# get2n 19
 +
# solint 1
 +
# solmo 'a&p'
 +
# go; recat
  
# tget snplt
+
Now we have:
# invers 4
+
<pre>
# tvin
+
CALIB1: Writing SN table    1
# go
+
CALIB1: RPOL, IF= 1 The average gain over these antennas is  9.897E-01
 +
CALIB1: RPOL, IF= 2 The average gain over these antennas is  1.001E+00
 +
CALIB1: RPOL, IF= 3 The average gain over these antennas is  1.007E+00
 +
CALIB1: RPOL, IF= 4 The average gain over these antennas is  1.008E+00
 +
CALIB1: RPOL, IF= 5 The average gain over these antennas is  1.007E+00
 +
CALIB1: RPOL, IF= 6 The average gain over these antennas is  1.003E+00
 +
CALIB1: RPOL, IF= 7 The average gain over these antennas is  1.012E+00
 +
CALIB1: RPOL, IF= 8 The average gain over these antennas is  1.003E+00
 +
CALIB1: LPOL, IF= 1 The average gain over these antennas is  1.002E+00
 +
CALIB1: LPOL, IF= 2 The average gain over these antennas is  1.003E+00
 +
CALIB1: LPOL, IF= 3 The average gain over these antennas is  1.012E+00
 +
CALIB1: LPOL, IF= 4 The average gain over these antennas is  1.009E+00
 +
CALIB1: LPOL, IF= 5 The average gain over these antennas is  1.000E+00
 +
CALIB1: LPOL, IF= 6 The average gain over these antennas is  1.010E+00
 +
CALIB1: LPOL, IF= 7 The average gain over these antennas is  1.020E+00
 +
CALIB1: LPOL, IF= 8 The average gain over these antennas is  1.016E+00
 +
CALIB1: Found        7380 good solutions
 +
CALIB1:                  7 solutions had no data
 +
</pre>
 +
Similar messages to the phase only except it now tells you how it is adjusting the amplitudes in each IF/polarization.
  
Looks OK, maybe some more flagging needed (SC with a data point at -4 ns), but lets see how [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?DELZN '''DELZN'''] does.
+
Image again:
 +
# tget imagr
 +
# getn 20
 +
# boxfi 'MYAIP:1828_4.box
 +
# go; recat
  
[[Image:PL1_DELZN.png|250px|thumb|right|'''Figure 14''' <br /> Polynomial fit plot (PL 1) for the Brewster VLBA antenna, which is generated by running DELZN.]]
+
You may have noticed that I am avoiding boxed the bright stuff around the core, because it is around the brightest thing in the map I am worried it is just sidelobes that have not been cleaned properly, at this point I am contemplating boxing it. Also next time we run IMAGR I will increase the number of iterations, 5000 seems like barely enough.
  
*Solve for zenith and clock delays with DELZN.
+
IMEAN again:
# default delzn
+
# tget imean
# getn 2
+
# getn 22
# snver 4➜ SN table with edited MBD
 
# gainv 5➜ CL table to copy and correct.
 
# aparm 0 3 2 1 1 10➜ plot zenith atmos. delay; use 3 polynomial terms to fit atmosphere; use 2 polynomial terms to fit clock; create CL table; correct both atmosphere and clock; use 10 iterations of robust fitting.
 
# opty 'mdel'➜ fit MBD.
 
# outfi 'FITS:delzn.clor ➜ file to read in with '''CLCOR'''; note if you leave off the closing ' the outfi retains the case.
 
# dotv -1➜ don't plot to TV, only make PL files.
 
# inp
 
 
# go
 
# go
  
The generated plot files can be viewed with TVPL.
+
Now the rms is about 2.8E-4 Jy/beam, a big drop.
  
*Plot generated PL files with TVPL
+
Since we have a lot more structures in the model we should do more self-cal.
# default tvpl
 
# getn 2
 
# for plver= 1 to 9; go tvpl; tvps; end
 
  
The plots should get displayed on the AIPSTV display (Figure 14). Hit "D" to scroll through the plots.
+
# tget calib
 +
# get2n 22
 +
# go; recat
  
'''DELZN''' makes plots that I don't find particularly useful to evaluate the quality of the fit. The best way to evaluate this (other than applying it to the astrometric data and see if it improves things) is to apply the CL table that '''DELZN''' produces to the GEO data and see if it flattens the MBD across all the IF's.
+
Now we have:
 +
<pre>
 +
CALIB1: Writing SN table    2
 +
CALIB1: RPOL, IF= 1 The average gain over these antennas is  9.909E-01
 +
CALIB1: RPOL, IF= 2 The average gain over these antennas is  1.003E+00
 +
CALIB1: RPOL, IF= 3 The average gain over these antennas is  1.008E+00
 +
CALIB1: RPOL, IF= 4 The average gain over these antennas is  1.009E+00
 +
CALIB1: RPOL, IF= 5 The average gain over these antennas is  1.008E+00
 +
CALIB1: RPOL, IF= 6 The average gain over these antennas is  1.004E+00
 +
CALIB1: RPOL, IF= 7 The average gain over these antennas is  1.013E+00
 +
CALIB1: RPOL, IF= 8 The average gain over these antennas is  1.004E+00
 +
CALIB1: LPOL, IF= 1 The average gain over these antennas is  1.003E+00
 +
CALIB1: LPOL, IF= 2 The average gain over these antennas is  1.004E+00
 +
CALIB1: LPOL, IF= 3 The average gain over these antennas is  1.013E+00
 +
CALIB1: LPOL, IF= 4 The average gain over these antennas is  1.010E+00
 +
CALIB1: LPOL, IF= 5 The average gain over these antennas is  1.001E+00
 +
CALIB1: LPOL, IF= 6 The average gain over these antennas is  1.011E+00
 +
CALIB1: LPOL, IF= 7 The average gain over these antennas is 1.021E+00
 +
CALIB1: LPOL, IF= 8 The average gain over these antennas is  1.017E+00
 +
CALIB1: Found        7380 good solutions
 +
CALIB1:                  7 solutions had no data
 +
</pre>
  
* Plot GEO data with CL table 5, and compare it to CL table 6 which was generated by DELZN
+
Image again:
# tget possm
+
# tget imagr
# getn 2
+
# getn 23
# gainuse 5
+
# niter 10000
# go
+
# go; recat
 
 
After scrolling through the plots by pressing "B", or exiting with "D", generate plots with CL 6.
 
  
# gainuse 6
+
IMEAN again:
 +
# tget imean
 +
# getn 25
 
# go
 
# go
  
In order to clearly see the phase improvements, scroll to 1751+093, for time 11:10:42-11:12:15 (CL 5), and compare the phases to the same source when applying CL 6. As you can see in Figure 15b, the results look quite good after applying CL 6.
+
Now the rms is about 1.7E-4 Jy/beam, a big drop, CALIB liked the new model with all that extra part of the jet boxed, which is a good sign.  Also in the residuals the emission around the core is much fainter, so it looks like it was good we did not box it. More self-cal can be one, but a majority of the improvement has been accomplished.
  
{|style="margin: 0 auto;"
+
=== Making a Contour Map ===
| [[Image:POSSM_1751_093.CL5.png|380px|thumb|right|'''Figure 15a''' <br />POSSM plot showing source 1751+093 after applying CL table 5, which shows a slight phase slope across IF's.]]
+
[[Image:KNTR1.png|250px|thumb|right|'''Figure 14''' <br /> Contour map of 1828+487 after self calibration.]]
| [[Image:POSSM_1751_093.CL6.png|380px|thumb|right|'''Figure 15b''' <br />POSSM plot showing source 1751+093 after applying CL table 6, which shows improved flattened phases across all IF's.]]
+
[[Image:KNTR2.png|250px|thumb|right|'''Figure 15''' <br /> Countour map of 1828+487 before self calibration. ]]
|}
 
  
Now we transfer these solutions to the target dataset.
+
What is the best way to look at the images, particularly with all this low level structure?  One of the best ways is with a contour map.  We will use [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?KNTR '''KNTR'''] to make such a map.  I came up with the following parameters after some experimentation.
  
This is where it gets a little complicated (although not much). Now we must apply the solutions to the data with the target in it, with all the calibration except the final fringe fit. The calibrated data you have has the final fringe fit in it, so we can compare the DELZNed and non-DELZNed data. Use "imh" on the TARGET (SPLATed) data to see how many CL tables there are. We want to apply the '''DELZN''' solution to the CL table immediately before the final fringe fit we performed to that data.
+
# default kntr
 
+
# getn 25
=== Apply Delay Corrections ===
+
# dovect -1
 
+
# dotv 1
Apply the zenith delay correction with [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?CLCOR '''CLCOR'''].
+
# ofmfile 'ryphlame'
 
+
# clev 5e-4
# default clcor
+
# blc 295 35
# getn 4
+
# trc 721 419
# opco 'atmo'➜ read in a file of atmospheric and clock delay corrections and apply them to the given CL table.
+
# pixra -0.0002 0.05
# gainv 1; gainu 0➜ input CL#1; generate a new CL table (CL 3).
+
# functy 'l2'
# infile 'FITS:delzn.clor➜ file with corrections we created earlier with the GEO data.
+
# levs(1)=-1
 +
# for i=2 to 30; levs(i)=2**((i-2)/2.); end
 
# inp
 
# inp
# go
+
# tvin; go
 +
# recat
  
'''CLCOR''' will say it has created CL table #3. Use this for further calibration, i.e. skip CL#2.
+
Note that I used verb [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?TVWINDOW '''TVWIN'''] to set blc and trc (bottom left corner and top right corner of the image to plot). Also I am using a for loop to set the contour levels in a logarithmic fashion. I have set the contour level multiplier (clev) and the pixel range (pixra) so that we can see some of the noise.  I am also using an ofm file for the background.  To see all the ofm files that come with AIPS type "OFMDIR"; ofmfile 'rainbow' is closest to tvpseudo. Figure 14 shows what the figure looks like on the TV.
  
=== Fringe Fit Data ===
+
Just for fun run KNTR with the same inputs on the image of 1828+487 before all the self-calibration.  Figure 15 shows what you get, the vast improvement made by the self calibration is obvious.
  
Do global fringe fit with '''FRING'''. This is where vput/vget come in handy, if you didn't do the vput, then repeat step previous FRING done on BM272HC.SPLAT.1 but change the gainuse parameter as shown below.
+
To make a hard copy of this figure set DOTV to -1 and run KNTR, KNTR will produce a PL (plot) table.  Then run [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?LWPLA '''LWPLA'''] to make a postscript of that PL table.
# vnum 1; vget fring
 
# gainu 3
 
# inp
 
# go
 
  
=== Apply Calibrations ===
+
# default lwpla
 +
# getn 25; outfi 'MYAIP:1828+487.ps
 +
# go
  
Apply calibration to tables with '''CLCAL'''. Again either use vnum/vget or repeat CLCAL step from above changing parameters as shown below.
+
This produces a postscript file in the $MYAIP directory.
# vnum 1; vget clcal
 
# snver 2
 
# gainv 3
 
# gainu 4
 
# inp
 
# go
 
  
=== Split the Data ===
+
=== Create More Images ===
 +
[[Image:OJ287.png|250px|thumb|right|'''Figure 16''' <br /> Contour map of 0851+202 (OJ287) after self calibration.  This is a version of the image that uses LWPLA to make a hardcopy after KNTR.]]
 +
[[Image:BLLAC.png|250px|thumb|right|'''Figure 17''' <br /> Contour map of 2200+420 (BL Lac) after self calibration.  This is a version of the image that uses LWPLA to make a hardcopy after KNTR.]]
  
Apply calibration to data with '''SPLIT'''. Here we can use tget because SPLIT has not been used since the last time we ran it on this data. Again repeat step 20 if you can't do this.
+
Image 2200+420 and/or 0851+202 with '''IMAGR'''.
  
# tget split
+
# tget imagr
# gainu 4 ➜ apply CL#4 to the data
+
# getn 3 or 4
# outcl 'delzn'
+
# rash 0
 +
# decsh 0
 +
# imsi 512
 
# inp
 
# inp
# go  
+
# go
  
=== Image J2007+4029 ===
+
You can follow similar steps with WIPER and self-calibration on these sources.
  
 +
== Doing All the Calibration (Except the Self-Calibration) With a Pipeline ==
  
Image J2007+4029 with '''IMAGR'''.
+
Inside AIPS there is a procedure [http://www.aips.nrao.edu/cgi-bin/ZXHLP2.PL?VLBARUN '''VLBARUN'''] which will do all the calibration steps above except for the interactive flagging and self-calibration.  VLBARUN uses the VLBAUTIL procedures to calibrate the data with little intervention.  In the 31DEC19 release of AIPS, it also offers the option of adding known flags through a text file and doing auto-editing via task RFLAG.
  
# tget imagr
+
Just to be safe type RESTORE 0, which will remove all the procedures from the AIPS "memory". It is also best if VLBARUN is run in a pristine environment, to do this restart AIPS (just type "restart" from inside AIPS) and use a different AIPS number.  Then load the two sets of procedures:
# cell 3e-5
 
# imsi 512
 
# dotv 1
 
# niter 1000
 
# im2parm 10 6 9 0.5
 
# bchan 0; echan 0
 
# nchav 256
 
# inp
 
# go
 
  
Compare this image to the one made without the correction (Figure 16a).
+
# run vlbautil
 +
# run vlbarun
  
{|style="margin: 0 auto;"
+
Next set up the VLBARUN inputs, here I assume you want VLBARUN load the data, but VLBARUN can also be be run on data that is already loaded :
| [[Image:J2007_4029_IMAGR_UnCorr.png|380px|thumb|right|'''Figure 16a''' <br />IMAGR screenshot showing source J2007+4029 before applying DELZN delay corrections and before applying fringe fitted calibrations.]]
+
# default vlbarun
| [[Image:J2007_4029_IMAGR_Corr.png|380px|thumb|right|'''Figure 16b''' <br />IMAGR screenshot showing source J2007+4029 after applying DELZN delay corrections and applying fringe fitted calibrations. Peak flux has increased and position has been corrected.]]
+
# datain 'FITS:bl193bg_3sour_avg.fits
|}
+
# outname 'bl195bg'
 +
# outdisk 1
 +
# indisk outdisk
 +
# opty 'cont'
 +
# clint 0.25
 +
# calsour '0851+202' '1828+487' '2200+420'
 +
# solint 0.25
 +
# factor 2
 +
# doflag 1
 +
# doplot 1
 +
# outfi ''some directory below which to put plots and .html file for examination''
 +
# outtext ''your@email.edu''
 +
# vlbarun
  
As you can see, the image after the correction (Figure 16b) has a lower noise level and a source with a higher peak. Bad phases spread the flux around the image and make the noise level higher and source flux lower as well as shifting the position of the source.  
+
Since I set doplot=1 and outfile the procedure will produce diagnostic plots putting them in a dated directory below the directory set in outfile and write an html page to allow you to examine the plots easily.  The message file is also stored in this directory. For a (new) example of the output for this data see [http://www.aips.nrao.edu/VLBARUN/19JUN171505/vlbarun.html vlbarun.html], the main difference is that VLBARUN ran VLBAEOPS, which we skipped so there is one more CL table.  FLAGR was also run so there are not so many bad samples in the UVPLTs of the calibrated data.
  
</div>
 
  
 
<!--
 
<!--

Latest revision as of 16:37, 17 June 2019

Overview

A good resource for reducing basic VLBI data in AIPS can be found in Appendix C of the AIPS Cookbook. Chapter 9:Reducing VLBI Data in AIPS of the AIPS Cookbook contains much more detail, but is best used as a reference. So with this tutorial you will:

  • Calibrate the regular data all the way through imaging.
  • Perform self-calibration to improve the imaging

This guide only gives the important inputs to each task. The other inputs should be default. An easy way to set all the inputs to the default in a task is to type "default taskname".

AIPS

For a comprehensive overview of AIPS see the AIPS COOKBOOK, especially Chapter 3:Basic AIPS Utilities and Chapter 12:AIPS for the More Sophisticated Userfor the basics. Chapter 9:Reducing VLBI Data in AIPS is the chapter explaining VLBI data reduction, but it is rather overwhelming so Appendix C:A Step-by-Step Recipe for VLBA Data Calibration in AIPS is recommended as a first step. However, below I summarize some useful commands (in parenthesis are the short form of the command):

  • getname (getn) catalog #: get the name of catalog # and put in INNAME, INCLASS and INSEQ. Other similar: geton (get outname); get2n (get in2name); get3n (get in3name) etc..
  • input (inp) taskname: show the inputs of taskname.
  • tget taskname: get a task and fill in the inputs of the last time the task was run, one of the most useful commands in AIPS.
  • ucat (uc): list uvdata catalog.
  • mcat (mc): list map catalog.
  • tvlod (tvlo): load a map onto the TV.
  • tvinit (tvin): initialize and clear TV.
  • imhead (imh): Print the file header (this can be used on both uv data and images despite the name). This will list informative things like the date of observation and the number and types of tables attached to the data.

Getting the Data and Other Useful Files

To obtain these files, right click on the desired file below and select "Save Link As...":

Files you might want to get in case something goes wrong with the primary calibration or if you just want to try the imaging and self-calibration:

If that doesn't work you can also ftp the data using anonymous ftp:

  • ftp ftp.aoc.nrao.edu
  • login as anonymous
  • cd pub/SIW
  • get bl193bg_3sour_avg.fits
  • mget *.box

and optionally

  • mget *.SPLIT.1

The best place to put these files is in your $FITS area. This is an AIPS data area that should already have an environmental variable set up for it.

About the Data

This is part of an observation from the MOJAVE survey, which is a large project that uses the VLBA to monitor Active Galactic Nuclei at 15 GHz in total and polarized flux. This project has been monitoring AGN for over a decade. The observation we are using took place on 16 June 2016 and contained 22 sources. However, in order to make the data a manageable size for a data reduction tutorial, three sources have been copied out of the dataset and the frequency channels and sample times have both been averaged by a factor of two. The sources in the the bl193bg_3sour_avg.fits dataset are as follows:

  • 0851+202 - BL Lac object, bright source with not a lot of structure, used as bandpass calibrator, aka OJ287. MOJAVE source page
  • 1828+487 - Quasar, bright source with a very extended defuse jet, aka 3C380. MOJAVE source page
  • 2200+420 - The original BL Lac object, bright source with extended curved jet, aka BL Lac. MOJAVE source page

We thank the MOJAVE team for maintaining the MOJAVE database and Matt Lister (Purdue) in particular for advice on the best data to select (Lister et al., 2009, AJ, 137, 3718).

Starting AIPS and Loading the Data

Starting AIPS

Start AIPS by typing aips or possibly aips tv=local:0.0 in a terminal window. Depending on your AIPS installation, you might be prompted to pick a printer, then you will be asked for an AIPS number, if you are not sharing disks with anyone pick any number other than 1. Remember that number because the data you load and work on will be under that number. It would be best for this tutorial for you to use a clean AIPS number, in other words, an AIPS number that you have not used for anything else and that has no data loaded into it.

After AIPS has started type:

  • dowait=1

This means that AIPS will not allow you to run more than one task at a time. I usually run with dowait=-1; but for this tutorial and for beginners it is better to set dowait=1.

Loading Data Into AIPS

Load the data with FITLD. Note that I am forcing an outname, outclass and outseq, we are doing it here so it will be easy to talk about specific files.

First load the target and calibrators

  1. default fitld
  2. clint 0.25 ➜ set CL table interval to 15 seconds.
  3. datain 'MYAIP:bl193bg_3sour_avg.fits ➜ Two things to note: 1) this assumes that the data is in the $MYAIP directory, you can use a full directory path (e.g., datain '/home/mydata/bl193bg_3sour_avg.fits) or another environmental variable if the data is elsewhere; 2) The lack of a close ' is not a typo, you must leave off the closing ' or AIPS will capitalize everything within the ' ' and you will get an error because FITLD will not be able to find the data.
  4. outname 'bl193bg'
  5. outclass 'uvdata'
  6. outseq 1
  7. outdisk 1
  8. inp ➜ check the inputs
  9. go

Lets look at our uv data catalog

  • uc

You should get something that looks similar to (with a different Usid and Last access):

AIPS 1: Catalog on disk  1
AIPS 1:   Cat  Usid Mapname      Class   Seq  Pt    Last access     Stat
AIPS 1:     1   194 BL193BG     .UVDATA.    1 UV 29-JUN-17 19:39:03

Note the data file, BL193BG.UVDATA.1, has a catalog number (Cat) which in this case 1. Catalog numbers can be, and usually are, used to fill in IN and OUTNAMES etc., using getn, geton etc..

Reducing the data

Preliminary Data Evaluation

Look at the structure of the data with LISTR. This will give you a listing of the scans as well as the sources and frequency structure in the observation. Note that even though this dataset contains only three sources, the SU (source) table still contains all the sources in the original dataset, so LISTR will list all the sources and show 0 visibilities for the sources with no data.

  1. default listr
  2. getn BL193BG.UVDATA.1 file; in other words getn 1
  3. optype 'scan'
  4. docrt 1
  5. inp
  6. go

This will give you a listing of the scans and frequencies in the observation.

Data Reduction Procedure

Load in the VLBA data reduction procedures: see EXPLAIN VLBAUTIL for a full description of the numerous procedures.

Procedures are run by just typing their name, rather than using "go".

  1. run vlbautil

If you get a BLEW CORE or other similar error message, you have filled your procedure memory (VLBAUTIL is very large and loading it three times will do this). To fix it type "restore 0" then reload VLBAUTIL

Calibrate Ionospheric Delay and Fix Earth Orientation Parameters

Data observed at 8 GHz or lower frequencies may be effected by the dispersive delay caused by the ionosphere. This will distort images and is especially bad at very low frequencies. An ionospheric correction based on maps of the electron content of the ionosphere can be performed with VLBATECR. BL193BG is observed at 15 GHz so no ionospheric correction is needed.

Data using phase referencing can be affected by imprecise Earth Orientation Parameters (EOPs) used in correlation. Therefore all phase referenced data should have its EOPs corrected. This can be done with VLBAEOPS. BL193BG does not use phase referencing so no EOP correction is needed.

Apply Digital Sampling Correction to VLBA data

Correct sampler threshold errors from the correlator by running VLBACCOR.

  1. default vlbaccor
  2. getn 1
  3. inp
  4. vlbaccor

VLBACCOR runs ACCOR which creates a solution (SN) table, then smooths the table with SNSMO, and then runs CLCAL to apply the solutions to the calibration (CL) table. When VLBACCOR is finished you should get messages like those below that tell you what SN table and CL table are created. It is a good idea to save these messages.

AIPS 1: 'SN #1 CONTAINS SAMPLER CORRECTIONS'
AIPS 1: 'CL #2 ADDS SAMPLER CORRECTIONS'

Plot Cross Power Spectrum

Figure 1
Plot of amplitudes (bottom) and phases (top) for source 0851+202.

Now lets take a look at the fringe finders by running VLBACRPL. VLBACRPL runs POSSM and displays the spectrum of each baseline (to Fort Davis which is antenna 2), with the amplitude on the bottom and the phases on the top.

  1. default vlbacrpl
  2. getn 1
  3. stokes 'half'
  4. refant 2
  5. gainuse 0
  6. solint -1
  7. dotv 1
  8. source '0851+202'
  9. inp
  10. vlbacrpl

As you can see from Figure 1, 0851+202 has very strong fringes. So we will use it as the calibrator to set the instrumental delays. Also look at your terminal for instructions on how to control POSSM:

POSSM1: Waiting 30 seconds:
POSSM1:    Hit TV button A to pause indefinitely.  Hit button
POSSM1:    B or C to continue sooner, button D to stop plotting

So hit A if you want to look at a plot longer than the 30 seconds, B or C to go to the next plot, D to exit.

Determine Delay Corrections

Find and remove instrumental delay by running VLBAPCOR.

Figure 2
Plots for source 0851+202 which show the amplitude (bottom panel) and corrected phases (top panel), for each IF in both polarizations.
  1. default vlbapcor
  2. getn 1
  3. calsour '0851+202' '
  4. timer 0 19 26 33 0 19 36 38 ➜ scan with good fringes on all telescopes we found in POSSM plots.
  5. refant 2 ➜ choose reference antenna from in the middle of array, antenna 2 or FD (Fort Davis, TX) is a good choice.
  6. gainu 0 ➜ apply highest CL table.
  7. inp
  8. vlbapcor

(Note that the second quote sign ' after the source name causes all other values of CALSOUR to be blank.) At this point you should check on the calibration:

  • VLBAPCOR runs PCCOR which used the pulse cals to correct the intrumental phases and then runs CLCAL to apply the solutions to the CL (calbration table). The output from VLBAPCOR will look something like this:
AIPS 1: 'RUN PCCOR'
PCCOR1: Task PCCOR  (release of 31DEC17) begins
PCCOR1: Writing to SN table   2
PCCOR1: Appears to have ended successfully
PCCOR1: localhos 31DEC17 TST: Cpu=      0.9  Real=      2  IO=        93
AIPS 1: Resumes
AIPS 1: 'RUN CLCAL'
CLCAL1: Task CLCAL  (release of 31DEC17) begins
CLCAL1: Using interpolation mode SELF
CLCAL1: Copied CL file from vol/cno/vers  1  183   2 to  1  183   3
CLCAL1: CALSEL: Making room for new CL data by
CLCAL1: Deleting CL table no.    3
CLCAL1: Processing SN table    2
CLCAL1: SNMRG: Merging SN table
CLCAL1: SNMRG: Write    2974 merged records from    2974 input records
CLCAL1: SN2CL: Applying SN tables to CL table   2, writing CL table  3
CLCAL1: Appears to have ended successfully
CLCAL1: localhos 31DEC17 TST: Cpu=      0.3  Real=      1  IO=       138
AIPS 1: Resumes
AIPS 1: 'SN #2 CONTAINS PCAL INSTR. PHASE CORRECTIONS'
AIPS 1: 'CL #3 ADDS INSTR. PHASE CORRECTIONS'

Again, it is a good idea to make note of the last two lines that tell you which tables contain which corrections. Most VLBAUTIL calibration scripts produce such messages.

  • check solutions in POSSM, the jumps in phase between the IFs should be gone. The phases may also be flattened.
    1. tget possm ➜ to "get" all the inputs from the last run (it was run when we ran the procedure VLBACRPL).
    2. gainu 3
    3. inp
    4. go

As you can see from Figure 2, the phases for 0851+202 have been flattened and the phase jumps between the IFs are gone. For other sources farther away in time the phases may be different from 0 but there will still be no phase jumps.

Create BP Table and Calibrate Bandpass Shape

Figure 3
Plot of bandpass for source '0851+202' .

Calibrate bandpass shape with VLBABPSS.

  1. default vlbabpss
  2. getn 1
  3. calsour '0851+202' ' ➜ use a strong source as the bandpass calibrator.
  4. refant 2
  5. inp
  6. vlbabpss

VLBABPSS will create a bandpass (BP) table:

AIPS 1: 'BP #1 BANDPASS TABLE'

Now check the bandpass solutions with POSSM.

  1. tget possm
  2. baseline=0
  3. aparm=0
  4. aparm(8)=2
  5. aparm(9)=1
  6. bpver=1; doband=1
  7. go

Figure 3 shows the plots generated by POSSM. The solutions should look like a reasonable fit of the bandpass shape.

Apply Amplitude Corrections

Perform amplitude calibration by running VLBAAMP.

  1. default vlbaamp
  2. getn 1
  3. inp
  4. vlbaamp

Again, the procedure should finish with the following lines:

AIPS 1: 'SN #3 CONTAINS SAMPLER CORRECTIONS'
AIPS 1: 'SN #4 CONTAINS GAIN CORRECTIONS'
AIPS 1: 'CL #4 ADDS SAMPLER CORRECTIONS'
AIPS 1: 'CL #5 ADDS GAIN CORRECTIONS'

which should be noted.

Examine Amplitude Calibration

Figure 4
Plot of amplitude gains vs. time with the different colors representing the different IF polarizations.

Examine amplitude calibration by running SNPLT.

  1. default snplt
  2. getn 1
  3. dotv 1
  4. inext 'cl'
  5. invers 0
  6. opty 'amp' ➜ Plot amplitudes.
  7. nplots 10
  8. opco 'alsi' ➜ Plot all IFs and Stokes.
  9. do3col 1 ➜ Use 3-color symbols.
  10. inp
  11. tvin ➜ tvinitialize clears the tv before plotting. Otherwise you will get a mess as the table is plotted over the bandpass plot from before.
  12. go

Figure 4 shows that the amplitude gains change over time as the sources rise and set, with higher gains at lower elevations. The different IFs and polarizations (RR and LL in this case) are shown as different colors.

Correct Phases for Parallactic Angles

Correct phases for parallactic angle effects with VLBAPANG.

Figure 5
EDITR display showing all the baselines to antenna 10 for 2200+420. You can see for all the baselines the amplitude is low for the first scan and for baseline 01-10 the phases for this scan look like noise. We want to flag this data.
  1. default vlbapang
  2. getn 1
  3. inp
  4. vlbapang
AIPS 1: 'CL #6 ADDS PARALLACTIC ANGLE CORRECTIONS'

Manually Edit Data

Figure 6
To flag this data we click FLAG TIME RANGE and hit B, and a blue box appears in the 01-10 box on the bottom.
Figure 7
After moving the sides of the box to encompass the data that need to be flagged, hit C and the data are flagged and turn red.


Edit the data using EDITR on each source separately.

  1. default editr
  2. getn 1
  3. docal 1; gainuse 0 ➜ calibrate data with highest CL table.
  4. crowded 1 ➜ to plot all polarization and IFs on top of each other.
  5. do3col 1
  6. doband 1
  7. bpver 1
  8. antuse 1 2 3 4 5 6 7 8 9 10 ➜ to plot all the baselines to one antenna at the same time.

Run on one source at a time:

  • 0851+202:
    1. source '0851+202''
    2. inp
    3. go

Again look in you terminal window for instructions:

 
EDITR1: Press buttons A, B, or C to choose an operation
EDITR1: Press button D for on-line help

EDITR plots both amplitudes and phases verses time, so this is a good way to just look at your data. For the inputs we chose, all the polarizations and IFs are plotted on top of each other. The two boxes on the bottom plot these as different colors and show the amplitude and phase for one baseline. The other boxes, where the data are shown in green, are the other baselines to that single antenna. It is especially useful to look at the data this way because problems tend to be antenna based so all the baselines to an antenna will be effected. It you see potentially problematic data (especially high or low amplitudes or with bad phases (note that weak sources will have incoherent phases)), then you should wait to flag until you can see all the baselines to the other antenna in the baseline pair with the bad data. That way you can flag once, telling EDITR to flag all the data for one antenna (this is the default in EDITR, but can be changed). The data for this source looks great. Click "NEXT ANTENNA" found on the menu to the right and press "B" until you have looked at all the baselines on all the antennas for this source. At this point the data has been amplitude calibrated but the source amplitude changes from scan to scan, do you know the reason for this?

Now plot the other sources and inspect.

  • 1828+487:
    1. source '1828+487''
    2. go

1828+487 also looks pretty good, although there are some ratty amplitudes and phase on the last scan on baselines to antenna 10. We will just leave these for now because the final fringe fit and self-calibration might fix it.

  • 2200+420:
    1. source '2200+420''
    2. go

As you can see in Figure 5 this source the first scan on the baselines to antenna 10 looks bad. The amplitude is very low and the phases are noise. To flag this data click FLAG TIME RANGE and hit B (Figure 6), and a blue box appears in the 01-10 box on the bottom. By hitting A and moving the cursor move the sides of the box to encompass the data which needs to be flagged; then hit C. The data will be flagged on all the baselines to the antenna and will turn white in the lower colored parts and red in the upper comparison parts of the display (Figure 7).

Fringe Fit the Data

Perform a global fringe fit with FRING. The following steps through imaging are not strictly necessary since we will have to redo them once the geodetic calibration is done, but they are an excellent way to check that the calibration up to this point is correct.

  1. default fring
  2. getn 1
  3. calsour '0851+202', '1828+487', '2200+420' ➜ do a global fringe fit on all sources.
  4. refant 2
  5. search 2 9 5 4 1 3 7 8 ➜ list of antennas to search if a solution is hard to find.
  6. solint 0.25
  7. doband 1
  8. bpver 1
  9. aparm(6) 2 ➜ print some information on solutions.
  10. aparm(9) 1 ➜ do exhaustive baseline search.
  11. docal 1; gainu 0
  12. inp
  13. go

You should look at the number of good and failed solutions:

FRING1: Found    97646 good solutions
FRING1: Failed on     1042 solutions
FRING1: Adjusting solutions to a common reference antenna

You should get something similar, but not necessarily exactly the same numbers of good and failed solutions. A small percentage of failed solutions are fine at this point. FRING will have created SN table number 5.

Since we did not use a source model, FRING assumes that the calibration source is a point source at the phase center. None of these sources are point sources. Therefore the corrections FRING finds will not correct the data perfectly and, once we apply all the calibration, it will be necessary to do self-calibration with source models to get the best images. Also note that I said "at the phase center" so, no matter what the the true position of your target, this fringe fit will move the brightest spot of the source to the phase center (the position of the target in the correlation).

Apply FRING solutions

Note that the previous step and this step can be done in the single procedure VLBAFRNG. It is broken up here just to show both the steps explicitly, but also because running the tasks individually allows for more control. Here the global fringe fit which was done in the last step is interpolated and applied to the all the calibration that has gone before with CLCAL.

  1. default clcal
  2. getn 1
  3. gainv 6 ➜ CL table with all the calibration.
  4. gainu 7 ➜ CL table to write next step of calibration in.
  5. snver 5 ➜ global fringe fit solutions from FRING
  6. interpol 'SELF' ➜ use 2PT interpolation.
  7. refant 2
  8. sour '0851+202', '1828+487', '2200+420' ➜ sources to which to apply calibration.
  9. calsour sour ➜ set calibrator sources to the same sources in parameter sources
  10. inp
  11. go

So SN table #5 will be applied to CL table #6 and create CL table #7 which now includes all the calibration.

Backing up Your Calibration

We will want to save the calibration up to this point with TASAV. TASAV makes a new file with all your calibration tables. This is very useful because it contains everything you need to recalibrate your data in a very compact and portable form. It is also a good idea to do this before you do anything you are unsure about or will change important tables (AN, SU) in ways that are hard to change back.

  1. default tasav
  2. getn 1
  3. outdisk 1
  4. inp
  5. go

Lets look at our catalog again:

  • uc

You should get something that look similar to:

AIPS 1: Catalog on disk  1
AIPS 1:   Cat  Usid Mapname      Class   Seq  Pt    Last access     Stat
AIPS 1:     1   193 BL193BG     .UVAVG .    1 UV 01-JUL-17 14:28:24
AIPS 1:     2   193 BL193BG     .TASAV .    1 UV 27-JUN-17 11:52:14

Note that you now have a second catalog entry which TASAV automatically named BL193BG.TASAV.1. This uv data file has 1 visibility and all the tables attached to BM272HC.UVDATA.1. Lets look at the TASAVed file.:

  1. getn 2
  2. imh

You should get something that looks like:

AIPS 1: Image=MULTI     (UV)         Filename=BL193BG     .TASAV .   1
AIPS 1: Telescope=VLBA               Receiver=VLBA
AIPS 1: Observer=BL193BG             User #=  193
AIPS 1: Observ. date=16-JUN-2016     Map date=27-JUN-2017
AIPS 1: # visibilities         1     Sort order  TB
AIPS 1: Rand axes: UU-L-SIN  VV-L-SIN  WW-L-SIN  TIME1  SUBARRAY
AIPS 1:            SOURCE  REMOVED  INTTIM  GATEID  CORR-ID  ANTENNA1
AIPS 1:            ANTENNA2
AIPS 1: ----------------------------------------------------------------
AIPS 1: Type    Pixels   Coord value     at Pixel     Coord incr   Rotat
AIPS 1: COMPLEX      3   1.0000000E+00       1.00  1.0000000E+00    0.00
AIPS 1: STOKES       2  -1.0000000E+00       1.00 -1.0000000E+00    0.00
AIPS 1: FREQ        32   1.5240375E+10      17.00  1.0000000E+06    0.00
AIPS 1: IF           8   1.0000000E+00       1.00  1.0000000E+00    0.00
AIPS 1: RA           1    00 00 00.000       1.00       3600.000    0.00
AIPS 1: DEC          1    00 00 00.000       1.00       3600.000    0.00
AIPS 1: ----------------------------------------------------------------
AIPS 1: Coordinate equinox 2000.00
AIPS 1: Maximum version number of extension files of type HI is   1
AIPS 1: Maximum version number of extension files of type AT is   1
AIPS 1: Maximum version number of extension files of type CT is   1
AIPS 1: Maximum version number of extension files of type FQ is   1
AIPS 1: Maximum version number of extension files of type AN is   1
AIPS 1: Maximum version number of extension files of type CL is   7
AIPS 1: Maximum version number of extension files of type CQ is   1
AIPS 1: Maximum version number of extension files of type GC is   1
AIPS 1: Maximum version number of extension files of type IM is   1
AIPS 1: Maximum version number of extension files of type MC is   1
AIPS 1: Maximum version number of extension files of type PC is   1
AIPS 1: Maximum version number of extension files of type SU is   1
AIPS 1: Maximum version number of extension files of type TY is   1
AIPS 1: Maximum version number of extension files of type WX is   1
AIPS 1: Maximum version number of extension files of type SN is   5
AIPS 1: Maximum version number of extension files of type BP is   1
AIPS 1: Maximum version number of extension files of type FG is   1

Note that there is 1 visibility but 7 calibration (CL) tables and 5 solution (SN) tables. As well as numerous other tables with information about you data (history (HI), frequency (FQ), antenna (AN), system temperature (TY), bandpass (BP), flag (FG)...).

Apply Calibration and SPLIT the Data

Apply calibration and make single source data sets with SPLIT. I like to work with single source files, it's less confusing, especially when self-caling and imaging.

  1. default split
  2. getn 1
  3. freqid 0
  4. docal 1; gainu 7 ➜ apply calibration; from CL#7.
  5. sour '0851+202', '1828+487', '2200+420'
  6. doband 1; bpver 1
  7. aparm 2 0 0 0 1 1 ➜ aparm(1)=2 tells SPLIT to average all the channels in each IF, reducing the size of the data significantly.
  8. inp
  9. go

This will produce three files named sourcename.SPLIT.1, again type uc to look at the catalog.

AIPS 1: Catalog on disk  1
AIPS 1:   Cat  Usid Mapname      Class   Seq  Pt    Last access     Stat
AIPS 1:     1   193 BL193BG     .UVAVG .    1 UV 01-JUL-17 14:28:24
AIPS 1:     2   193 BL193BG     .TASAV .    1 UV 03-JUL-17 15:01:55
AIPS 1:     3   193 2200+420    .SPLIT .    1 UV 03-JUL-17 15:12:12
AIPS 1:     4   193 0851+202    .SPLIT .    1 UV 03-JUL-17 15:14:41
AIPS 1:     5   193 1828+487    .SPLIT .    1 UV 03-JUL-17 15:15:29

OPTIONAL: Getting the Calibrated Data

THIS STEP IS OPTIONAL: If everything went well in the above steps there is no need to get the calibrated data.

However If something went wrong with the calibration or if you want to start with the imaging and self-calibration then download the following files and put them in your $FITS area:

Then load the data with FITLD:

  1. default fitld
  2. datain 'MYAIP:0851+202.SPLIT.1
  3. outdisk 1
  4. inp
  5. go

and repeat for 1828+487.SPLIT.1 and 2200+420.SPLIT.1.

Note that these data do not include self-calibration but does include flagging.

Flagging 1828+487

Figure 8
WIPER plot of amplitude vs UV distance.
Figure 9
WIPER plot with high amp points flagged (in blue).
Figure 10
WIPER plot with low amp points flagged (in blue).

Let's do some more flagging before we get into imaging. A nice graphical flagging task that is especially useful after SPLITing is WIPER. WIPER defaults to plot amplitude vs uv distance:

  1. default wiper
  2. getn 5
  3. imsi 512
  4. inp
  5. go

Ick! Look at those high points (Figure 8). Flag those by clicking on FLAG AREA, setting a box hitting the "A" key then hitting the "C" key when done, the flaged points will turn blue as in Figure 9. Now click EXIT and hit "A". Immediately type "go" to run WIPER again. This is more like it (Figure 10), but there are some low points, flag those with FLAG AREA but don't be too overzealous.

Now you have 2 flag (FG) tables attached to the data, one for each run of WIPER. FG table 2 has all the flags in it.

Imaging and Self-Cal of 1828+487

Figure 11
Dirty map of 1828+487.
Figure 12
Residual map of 1828+487.
Figure 13
Image of 1828+487 after first run of IMAGR.

Lets start by imaging 1828+487 with IMAGR. Either use the clean box files provided (make sure they are in the $MYAIP directory) or do interactive boxing. Using the supplied box file is easier. Also lets make sure that dowait=1 by typing:

  • dowait=1

Note that I came up with the parameters below especially the IMSIZE, ROBUST, RASH and DECSH by imaging and experimenting. Task SETFC can be used to recommend CELLSIZE and IMSIZE if you specify a desired field of view. The shifts were chosen, for this source only, to center the object including its jet within the image. It is recommended that you use the supplied box files. They reflect both the very obvious emission in the field and additional information from the MOJAVE project.

  1. default imagr
  2. getn 5
  3. cell 0.0001; imsi 1024 512 ➜ cell size of 0.1 mas; image size of 1024x512.
  4. rash -0.0125 0
  5. decsh 0.0125 0
  6. dotv 1
  7. robust 5 ➜ Do natural weighting. This source has a big diffuse jet, therefore sensitivity and more weight on the short spacings is more important than high resolution.
  8. niter 5000 ➜ do interactive clean; with 5000 iterations, you will probably "stop cleaning" before hitting 5000 on the first iteration of imaging.
  9. boxfile 'MYAIP:1828_1.box
  10. inp
  11. go
  12. recat


Hit TVPSEUDO then "B" immediately to get color rather than grey scale. Figure 11 shows the dirty map. If you want to clean interactively, then click CONTINUE CLEAN (and "A"); after a few rounds of cleaning (about 300 clean components which the messages from IMAGR tell you) the residuals will look like Figure 12. You can see in Figure 12 there is not much else to clean inside the clean boxes although there is some flux outside the clean boxes. This isn't significant enough to box at this point, so click STOP CLEANING ("A"). IMAGR will return the cleaned map, Figure 13, as you can see there are artifacts in the map.

Once IMAGR is done you run RECAT, which compresses the catalog so there are no empty spaces. This is not strictly necessary, but to follow this tutorial and have the GETN work, we have to be sure that the catalog numbers are consistent. Now do a mcat (mc for short) to look at the maps in your catalog:

  • mc
AIPS 1: Catalog on disk  1
AIPS 1:   Cat  Usid Mapname      Class   Seq  Pt    Last access     Stat
AIPS 1:     6   195 1828+487    .IBM001.    1 MA 04-JUL-17 10:33:14
AIPS 1:     7   195 1828+487    .ICL001.    1 MA 04-JUL-17 10:33:14

Note that you have made two files, a "dirty beam" (the IBM001 file) and a cleaned map (ICL001).

To look at the image use TVLOD (getn 6; tvin; tvlo). Use TVPSEUDO to put it into color (tvps). You can use your mouse to manipulate the colors; again look at your terminal for instructions. Hit "D" once it looks the way you want. Figure 11 shows the image with the stretch set so the noise level is obvious.

Lets measure the rms in the cleaned image with IMEAN:

  1. default imean
  2. getn 7
  3. go

The rms for this image using IMEAN's histogram fitting in units of Janskys/beam is:

IMEAN1: Mean=-1.0708E-04 Rms= 2.2822E-03  **** from histogram

IMEAN also gives you other statistics about the image such as the maximum and total flux.

So the image isn't the best, the noise is much higher than desirable, and there are hints of lower level structure but they are not much higher than the noise. So it looks like self-calibration would be beneficial. At some level self-cal is an art rather than a science, and there are various different philosophies concerning how to best do self-cal. I tend to be conservative, partially because VLBA data has fewer baselines and therefore it is easier to go off in a bad direction with the self-cal. However, these are fairly strong sources so it will be harder to make big mistakes in the self-calibration. Self-cal is done by the task CALIB. Generally phase-only self-cal should be done first, then amplitude and phase. Also we will be using clean component models (i.e., the image we just made) for the self-calibration.

  1. default calib
  2. getn 5
  3. get2n 7 ➜ use clean components from this map as a model for the self-cal
  4. refant 2
  5. solint 1 ➜ 1 minute solution interval
  6. solty 'l1r' ➜ type of method for solution (see EXPLAIN CALIB for more details)
  7. solmo 'P' ➜ solve for phases only
  8. inp
  9. go
  10. recat

You will get messages that look like this:

CALIB1: Task CALIB  (release of 31DEC17) begins
CALIB1: Using 1828+487 . SPLIT . 1  Disk= 1 Usid= 195
CALIB1: L1 Solution type
CALIB1: UVGET: Using flag table version   2 to edit data
CALIB1: Create 1828+487    .CALIB .   1 (UV)  on disk  1  cno    8
CALIB1: Selecting and editing the data
CALIB1: Using Clean Component self-cal source model
CALIB1: FACSET: 1.375524 Jy found from 209 components
CALIB1: Divide data by model - first compute model by summing
CALIB1: QINIT: did a GET  of      5120 Kwords, OFF          5241849
CALIB1: ALGMEM field    1 Ipol gridded model subtraction chns    1-    8
CALIB1: ALGMEM: at visibility number           1
CALIB1: ALGMEM:  1024 - 0 cells, with       23349 Pts
CALIB1: Field    1 used     209 CCs
CALIB1: Determining solutions using full vector averaging
CALIB1: Writing SN table    1
CALIB1: Found         7380 good solutions
CALIB1:                  7 solutions had no data
CALIB1: Average closure rms =  0.03470 +-  0.00913
CALIB1: Fraction of times having data >  2.5 rms from solution
CALIB1: 0.24661 of the times had  2 -  4 percent outside  2.5 times rms
CALIB1: 0.09842 of the times had  4 -  6 percent outside  2.5 times rms
CALIB1: 0.06674 of the times had  6 -  8 percent outside  2.5 times rms
CALIB1: 0.08258 of the times had  8 - 10 percent outside  2.5 times rms
CALIB1: 0.07579 of the times had 10 - 12 percent outside  2.5 times rms
CALIB1: 0.06900 of the times had 12 - 14 percent outside  2.5 times rms
CALIB1: 0.04186 of the times had 14 - 16 percent outside  2.5 times rms
CALIB1: 0.02602 of the times had 16 - 18 percent outside  2.5 times rms
CALIB1: 0.01810 of the times had 18 - 20 percent outside  2.5 times rms
CALIB1: 0.01131 of the times had 22 - 24 percent outside  2.5 times rms
CALIB1: 0.00113 of the times had 26 - 28 percent outside  2.5 times rms
CALIB1: Applying solutions to data
CALIB1:            Previously flagged   Flagged by gain         Kept
CALIB1: Partially                  341                   0       341
CALIB1: Fully                        0                   0     23008
CALIB1: Copied WX file from vol/cno/vers  1    5   1 to  1    8   1
CALIB1: Copied AN file from vol/cno/vers  1    5   1 to  1    8   1
CALIB1: Copied FG file from vol/cno/vers  1    5   1 to  1    8   1
CALIB1: Copied FG file from vol/cno/vers  1    5   2 to  1    8   2
CALIB1: Appears to have ended successfully

There are several things you should note in these messages:

  • CALIB creates a new UV file called 1828+487.CALIB.1 at catalog number 8
  • CALIB also writes an SN table attached to the input data file
  • CALIB found 7380 good solutions, 7 had no data and did not fail on any
  • CALIB didn't flag any new data. Since this is such a strong source CALIB probably will not flag any of the data. However for weaker sources this is a concern, a bad model and a weak source could mean that some portion of your input data is flagged by CALIB, meaning you can take your imaging to strange places if you are not careful.

Now we image the corrected data. We can either use the file that CALIB created or the original file applying the SN table that CALIB attached to it. Just for brevity we will use the file CALIB created:

  1. tget imagr
  2. getn 8
  3. boxfi 'MYAIP:1828_2.box
  4. inp
  5. go; recat

After about 1500 clean components the map looks sufficiently clean. While doing the interactive clean the residuals did look better than in the first imaging but lets do IMEAN again (tget imean; getn 10; go) to confirm the rms is getting lower. The noise is now ~1.3E-03 Jy/beam, so a significant drop, but we can probably still do better. So more self-cal, with a shorter solution interval:

  1. tget calib
  2. get2n 10
  3. solint 0.5
  4. go; recat

Now we have:

CALIB1: Writing SN table    2
CALIB1: Found        14749 good solutions
CALIB1:                 12 solutions had no data

Image again:

  1. tget imagr
  2. getn 11
  3. go; recat

IMEAN again:

  1. tget imean
  2. getn 13
  3. go

Now the rms is about 1.1E-3 Jy/beam, so a little lower than last time but a much smaller drop. Lets try a much smaller solution interval.

  1. tget calib
  2. get2n 13
  3. solint 0.1
  4. go; recat

Now we have:

CALIB1: Writing SN table    3
CALIB1: Found        53090 good solutions
CALIB1: Failed on       72 solutions
CALIB1:                 92 solutions had no data

So CALIB failed on a tiny fraction of solutions and flagged a tiny fraction of the data. This is OK, it just means that with this solution interval we are on the edge of not having enough sensitivity to get good solutions.

Image again:

  1. tget imagr
  2. getn 14
  3. boxfi 'MYAIP:1828_3.box
  4. go; recat

IMEAN again:

  1. tget imean
  2. getn 16
  3. go

Now the rms is about 8.8E-4 Jy/beam, another significant drop, either the low solint or the extra box is making things better, probably both. So lets do one more phase only self cal with this solution interval before going to amplitude and phase.

  1. tget calib
  2. get2n 16
  3. go; recat

Now we have:

CALIB1: Writing SN table    4
CALIB1: Found        53093 good solutions
CALIB1: Failed on       69 solutions
CALIB1:                 92 solutions had no data

Note that it failed on fewer solutions that last time, another indication that the additional box added to the cleaning allowed for model that fit the data better.

Image again:

  1. tget imagr
  2. getn 17
  3. go; recat

IMEAN again:

  1. tget imean
  2. getn 19
  3. go

Now the rms is about 8.5E-4 Jy/beam, so another small drop.

Lets move to amplitude self cal. You might have noticed that for the runs of CALIB we went back to the original data rather than the self-caled data. This is one of those philosophies of self-cal I mentioned earlier, you could have used the the output file from CALIB and done smaller increments of self-cal, I prefer to go back to the original data and just improve the model. I do this because here is less chance of getting an incorrect model stuck in the data with this method. However once we move to amplitude self-cal we want to use the data with the best calibrated phases so we will start with the last file out of CALIB.

  1. tget calib
  2. getn 17
  3. get2n 19
  4. solint 1
  5. solmo 'a&p'
  6. go; recat

Now we have:

CALIB1: Writing SN table    1
CALIB1: RPOL, IF= 1 The average gain over these antennas is  9.897E-01
CALIB1: RPOL, IF= 2 The average gain over these antennas is  1.001E+00
CALIB1: RPOL, IF= 3 The average gain over these antennas is  1.007E+00
CALIB1: RPOL, IF= 4 The average gain over these antennas is  1.008E+00
CALIB1: RPOL, IF= 5 The average gain over these antennas is  1.007E+00
CALIB1: RPOL, IF= 6 The average gain over these antennas is  1.003E+00
CALIB1: RPOL, IF= 7 The average gain over these antennas is  1.012E+00
CALIB1: RPOL, IF= 8 The average gain over these antennas is  1.003E+00
CALIB1: LPOL, IF= 1 The average gain over these antennas is  1.002E+00
CALIB1: LPOL, IF= 2 The average gain over these antennas is  1.003E+00
CALIB1: LPOL, IF= 3 The average gain over these antennas is  1.012E+00
CALIB1: LPOL, IF= 4 The average gain over these antennas is  1.009E+00
CALIB1: LPOL, IF= 5 The average gain over these antennas is  1.000E+00
CALIB1: LPOL, IF= 6 The average gain over these antennas is  1.010E+00
CALIB1: LPOL, IF= 7 The average gain over these antennas is  1.020E+00
CALIB1: LPOL, IF= 8 The average gain over these antennas is  1.016E+00
CALIB1: Found         7380 good solutions
CALIB1:                  7 solutions had no data

Similar messages to the phase only except it now tells you how it is adjusting the amplitudes in each IF/polarization.

Image again:

  1. tget imagr
  2. getn 20
  3. boxfi 'MYAIP:1828_4.box
  4. go; recat

You may have noticed that I am avoiding boxed the bright stuff around the core, because it is around the brightest thing in the map I am worried it is just sidelobes that have not been cleaned properly, at this point I am contemplating boxing it. Also next time we run IMAGR I will increase the number of iterations, 5000 seems like barely enough.

IMEAN again:

  1. tget imean
  2. getn 22
  3. go

Now the rms is about 2.8E-4 Jy/beam, a big drop.

Since we have a lot more structures in the model we should do more self-cal.

  1. tget calib
  2. get2n 22
  3. go; recat

Now we have:

CALIB1: Writing SN table    2
CALIB1: RPOL, IF= 1 The average gain over these antennas is  9.909E-01
CALIB1: RPOL, IF= 2 The average gain over these antennas is  1.003E+00
CALIB1: RPOL, IF= 3 The average gain over these antennas is  1.008E+00
CALIB1: RPOL, IF= 4 The average gain over these antennas is  1.009E+00
CALIB1: RPOL, IF= 5 The average gain over these antennas is  1.008E+00
CALIB1: RPOL, IF= 6 The average gain over these antennas is  1.004E+00
CALIB1: RPOL, IF= 7 The average gain over these antennas is  1.013E+00
CALIB1: RPOL, IF= 8 The average gain over these antennas is  1.004E+00
CALIB1: LPOL, IF= 1 The average gain over these antennas is  1.003E+00
CALIB1: LPOL, IF= 2 The average gain over these antennas is  1.004E+00
CALIB1: LPOL, IF= 3 The average gain over these antennas is  1.013E+00
CALIB1: LPOL, IF= 4 The average gain over these antennas is  1.010E+00
CALIB1: LPOL, IF= 5 The average gain over these antennas is  1.001E+00
CALIB1: LPOL, IF= 6 The average gain over these antennas is  1.011E+00
CALIB1: LPOL, IF= 7 The average gain over these antennas is  1.021E+00
CALIB1: LPOL, IF= 8 The average gain over these antennas is  1.017E+00
CALIB1: Found         7380 good solutions
CALIB1:                  7 solutions had no data

Image again:

  1. tget imagr
  2. getn 23
  3. niter 10000
  4. go; recat

IMEAN again:

  1. tget imean
  2. getn 25
  3. go

Now the rms is about 1.7E-4 Jy/beam, a big drop, CALIB liked the new model with all that extra part of the jet boxed, which is a good sign. Also in the residuals the emission around the core is much fainter, so it looks like it was good we did not box it. More self-cal can be one, but a majority of the improvement has been accomplished.

Making a Contour Map

Figure 14
Contour map of 1828+487 after self calibration.
Figure 15
Countour map of 1828+487 before self calibration.

What is the best way to look at the images, particularly with all this low level structure? One of the best ways is with a contour map. We will use KNTR to make such a map. I came up with the following parameters after some experimentation.

  1. default kntr
  2. getn 25
  3. dovect -1
  4. dotv 1
  5. ofmfile 'ryphlame'
  6. clev 5e-4
  7. blc 295 35
  8. trc 721 419
  9. pixra -0.0002 0.05
  10. functy 'l2'
  11. levs(1)=-1
  12. for i=2 to 30; levs(i)=2**((i-2)/2.); end
  13. inp
  14. tvin; go
  15. recat

Note that I used verb TVWIN to set blc and trc (bottom left corner and top right corner of the image to plot). Also I am using a for loop to set the contour levels in a logarithmic fashion. I have set the contour level multiplier (clev) and the pixel range (pixra) so that we can see some of the noise. I am also using an ofm file for the background. To see all the ofm files that come with AIPS type "OFMDIR"; ofmfile 'rainbow' is closest to tvpseudo. Figure 14 shows what the figure looks like on the TV.

Just for fun run KNTR with the same inputs on the image of 1828+487 before all the self-calibration. Figure 15 shows what you get, the vast improvement made by the self calibration is obvious.

To make a hard copy of this figure set DOTV to -1 and run KNTR, KNTR will produce a PL (plot) table. Then run LWPLA to make a postscript of that PL table.

  1. default lwpla
  2. getn 25; outfi 'MYAIP:1828+487.ps
  3. go

This produces a postscript file in the $MYAIP directory.

Create More Images

Figure 16
Contour map of 0851+202 (OJ287) after self calibration. This is a version of the image that uses LWPLA to make a hardcopy after KNTR.
Figure 17
Contour map of 2200+420 (BL Lac) after self calibration. This is a version of the image that uses LWPLA to make a hardcopy after KNTR.

Image 2200+420 and/or 0851+202 with IMAGR.

  1. tget imagr
  2. getn 3 or 4
  3. rash 0
  4. decsh 0
  5. imsi 512
  6. inp
  7. go

You can follow similar steps with WIPER and self-calibration on these sources.

Doing All the Calibration (Except the Self-Calibration) With a Pipeline

Inside AIPS there is a procedure VLBARUN which will do all the calibration steps above except for the interactive flagging and self-calibration. VLBARUN uses the VLBAUTIL procedures to calibrate the data with little intervention. In the 31DEC19 release of AIPS, it also offers the option of adding known flags through a text file and doing auto-editing via task RFLAG.

Just to be safe type RESTORE 0, which will remove all the procedures from the AIPS "memory". It is also best if VLBARUN is run in a pristine environment, to do this restart AIPS (just type "restart" from inside AIPS) and use a different AIPS number. Then load the two sets of procedures:

  1. run vlbautil
  2. run vlbarun

Next set up the VLBARUN inputs, here I assume you want VLBARUN load the data, but VLBARUN can also be be run on data that is already loaded :

  1. default vlbarun
  2. datain 'FITS:bl193bg_3sour_avg.fits
  3. outname 'bl195bg'
  4. outdisk 1
  5. indisk outdisk
  6. opty 'cont'
  7. clint 0.25
  8. calsour '0851+202' '1828+487' '2200+420'
  9. solint 0.25
  10. factor 2
  11. doflag 1
  12. doplot 1
  13. outfi some directory below which to put plots and .html file for examination
  14. outtext your@email.edu
  15. vlbarun

Since I set doplot=1 and outfile the procedure will produce diagnostic plots putting them in a dated directory below the directory set in outfile and write an html page to allow you to examine the plots easily. The message file is also stored in this directory. For a (new) example of the output for this data see vlbarun.html, the main difference is that VLBARUN ran VLBAEOPS, which we skipped so there is one more CL table. FLAGR was also run so there are not so many bad samples in the UVPLTs of the calibrated data.