Source directory /data/lofarschool/data/exercise-61
Contact person James Miller-Jones (/John Swinbank)

The user should have completed Exercise 60, which ended with plotting amplitude against uv-distance for a given baseline. This Exercise is a follow-on to demonstrate interactive data flagging using CASA.


  • Working CASA installation
  • Knowledge of Python
  • Completion of Exercise 60

The goal of this exercise is to demonstrate the use of CASA to interactively flag LOFAR data. While LOFAR data will generally be flagged using automated algorithms, this demonstrates an option for refining the flagging if the user were to wish to go back and recalibrate the data manually.

  • instructions.txt contains a listing of commands to be typed or cut/pasted into the CASA prompt, and explanation of what to do and what to expect at each step
  • The outputs directory contains an example of an output listing from the CASA logger
  • README contains links to further documentation about CASA

First of all, start up CASA

$ /app/Casa/x86_64/bin/casapy

Plot up amplitude against uv-distance for a single baseline, as done at the end of Exercise 60. tget would save both time and keystrokes if you are in the same directory as that in which you carried out Exercise 60, such that a plotxy.last file exists. However, if you have changed directory, this will not work, so all the inputs will need to be entered from scratch.

CASA <2>: msfile='../Exercise-60/L4086_sSB10.MS'
CASA <3>: default(plotxy)
CASA <4>: vis = msfile 
CASA <5>: xaxis = 'uvdist'
CASA <6>: yaxis = 'amp'
CASA <7>: datacolumn = 'data'
CASA <8>: selectdata=T
CASA <9>: correlation = 'XX YY'
CASA <10>: multicolor = 'both'
CASA <11>: width = '1' # average all channels
CASA <12>: spw='0:1'
CASA <13>: timerange='2007/10/20/12:00:00~2007/10/20/21:00:00'
CASA <14>: antenna='1&12'
CASA <15>: go
---------> go()
Executing:  plotxy()
INFO2 Number of points being plotted : 2146
Total process time 9.92 sec.
Total wall clock time 10.12 sec.

This time, we have plotted both the XX and YY correlations, in two different colours.

Hit the 'Mark Region' button, and with the left mouse button, click and drag to highlight some visibilities that offend you. These will now appear to be hatched out. However, following a last-minute appeal by the visibilities in question, you change your mind and opt for clemency. Hit the ESC key to deselect those visibilities. They will no longer be flagged. Move on and find some other targets for flagging. Once you are satisfied, hit the “Flag” button.

If at this point, you change your mind, reselect the area with the left mouse button, and hit the “Unflag” button. As if by magic, the visibilities reappear.

When you are done, hit the “Quit” button.

Next, use the flagmanager task to save a copy of the flags you just made to a file. This task allows the listing, saving, restoring and deletion of flag version files.

vis = '../Exercise-60/L4086_sSB10.MS'
mode = 'save'
versionname = 'xyflags'
comment = 'Plotxy flags'
merge = 'replace'

To check the available flag file versions, we now use the list option:

CASA <23>: default('flagmanager')
CASA <24>: vis=msfile
CASA <25>: mode = 'list'
CASA <26>: flagmanager()
MS : /export/data_3/jmiller/cs1/L4086_sSB10.MS
main : working copy in main table
See logger for flag versions for this file

outputs/flagging_logger.pdf shows an example of the output from the logger.

  • Last modified: 2017-03-08 15:27
  • by