AIPS-Simple-Self-Cal

From CASA Guides
Jump to navigationJump to search

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 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".

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 (getin3name) 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 these 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. MOJAVE 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 the observation we are using took place on 16 June 2016 and contained 22 sources. However in order to make the data a managable size for a data reduction tutorial, three sources have been copied out of this dataset and the frequencies channels and integration time 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 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 take 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 the 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 visabilities 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 full description of 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 effected 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 correlator by running VLBACCOR.

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

VLBACCOR runs ACCOR which creates an soulution (SN) table then smooths the table with SNSMO 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 keep 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 (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

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 both very strong sources as bandpass calibrators.
  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 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 is flagged and turns 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 intructions:

 
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 plots these as different colors and shows the amplitude and phase for one baseline. The other boxes where the data is 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, 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 band data. That way you can flag once, telling EDITR to flag all the data to 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 antenna 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 red in 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 is an excellent way to check 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.

Note that if a model is not used (we are not using a model), FRING assumes that the source it is solving for is a point source at the phase center. None of these sources are point sources, therefore the corrections FRING found will not perfectly correct the data 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 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 both to show the steps explicitly but also because running the tasks individually allows for more control. Here the global fring 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 created CL table #7. CL table #7 now has all the calibration in it.

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 them 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 automtically 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#2.
  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).

Lets 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 overzelous.

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.

  1. default imagr
  2. getn 5
  3. cell 0.0001; imsi 1024 512 ➜ cell size of 0.1 mas; image size of 512x512.
  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 scal. Figure 11 shows the dirty map. If you want to interactively clean, 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 it 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 file, 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 either 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 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 source 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, the 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. boxfi 'MYAIP:1828_2.box
  4. 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. boxfi 'MYAIP:1828_3.box
  4. 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

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

Image again:

  1. tget imagr
  2. getn 23
  3. boxfi 'MYAIP:1828_4.box
  4. niter 10000
  5. 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 lever structure? One of the best ways is with a contour map. We will use KNTR to make such a map. Again I came up with these parameters with experimenting, you won't necessarily just know what to set these to.

  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

Note that I used verb TVWIN to set blc and trc (bottom lect corner and top right corner of the image to plot). Also I am using a for loop to set the contour levels and have set 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 'FITS:1828+487.ps
  3. go

This produces a postscript file in the $FITS 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 flagging and self-calibration. VLBARUN uses the VLBAUTIL procedures to calibrate the data with little intervention.

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. doplot 1
  12. outfi some directory to put plots and .html file for examination
  13. outtext your@email.edu
  14. vlbarun

Since I set doplot=1 and outfile the procedure will produce diagnostic plots put them in the directory set in outfile and write an html page to allow you to examine the plots easily. For an 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.