Data flagging with plotms

From CASA Guides
Jump to navigationJump to search

Casaplotms is (currently) a standalone tool to inspect and edit measurement sets. This tutorial demonstrates how to use casaplotms to edit a multisource continuum data set: VLA program AU079, which consists of L-band (20 cm) continuum observations of galaxies and calibrator sources. It is the same data set used in the Imaging Flanking Fields tutorial, as well as the Data flagging with viewer tutorial.

Loading the Measurement Set into Casaplotms

As described in the Imaging Flanking Fields tutorial, the data may be loaded into CASA using the importvla command. The following commands import the data into the measurement set au079.ms and exit CASA to the command line.

# import the glob command for filename searching with wildcards
from glob import glob

# Define the list of files for reading. Use glob to perform wildcard matching with VLA archive filenames.
fileList = glob('AU079_*.xp?')

importvla(archivefiles=fileList,vis='au079.ms')
exit()

Now start up casaplotms from the command line.

# in bash
casaplotms

This command brings up the PlotMS window, shown with annotations at right. The window comprises three panels: the control panel (outlined in blue), the graphics panel (green), and the tools panel (red). The control panel controls the selection of data for display and the graphing parameters (axis selection, axis limits, and so on). The graphics panel is the display panel for two-dimensional (x, y) projections of the data. The tools panel provides commands to interact with the graphics panel.

The control panel further breaks down into a series of tabs, annotated as Top Tabs and Side Tabs, which contain related plotting and editing control parameters. This tutorial employs only the Plots tab among the Top Tabs and the following Side Tabs.

  • MS, which controls the selection of the measurement set proper and the selection of data within the measurement set.
  • Axes, which controls the selection of data and plotting parameters for the (x, y) graph.
  • Plot, which affects the style of plotting symbols, whether or not flagged data points are shown, and axis labels.
  • Flagging, which controls how flagging commands are extended (as of 1 Dec 2009, these flagging extensions are very limited but will likely improve as casaplotms continues development).

In this tutorial, interactive commands in the PlotMS window will be summarized as (Tab)Command,, where (Tab) represents the Side Tab where the command is found, and Command is the appropriate GUI interaction (button press, text field, checkbox, etc.).

Use the (MS)Browse button, or enter the full pathname, to navigate to and select the measurement set (here, au079.ms).

Casaplotms-1a.png

Click to enlarge


Identifying Bad Data by Discrepant Amplitudes

Have a first look at the data by hitting the (MS)Plot button. By default, the axes will be visibility amplitude vs. time. The x-axis labeling is a little garbled in this development version of the software, but straightaway there appear some wildly discrepant data. For a typical decimeter-wave continuum data set, sources and calibrators are expected to show visibility amplitudes of a few Jy or less; visibilities with amplitudes in the 100s of Jy range are likely bogus. Here's how to flag them.

Casaplotms-add-01.png

Click to enlarge

There's a simple pattern to flagging in casaplotms.

  • Highlight the data to be flagged using the Mark Regions MarkRegionsButton.png tool.
  • Flag the data in the highlighted region using the Flag FlagThoseData.png tool.

The figure at right shows a highlighted region selected using the Mark Regions tool. After flagging, those data will be removed from the display unless (Plot)Flagged Points Symbol is set.

Casaplotms-3.png

Click to enlarge

The figure at right shows a close-up of the data that remain. The y-axis scale was reduced to the range (0, 100 Jy) by using the (Axes)Range controls.

Notice that you can set more than one region with the Mark Regions tool before flagging.

Casaplotms-4.png

Click to enlarge

Tip: The automatic scaling of the data axes are cached and so are unaffected by flagging. To rescale (semi-) automatically, change the 
(Axes)X Axis to some other arbitrary projection (say, Scan), (Axes)Plot, and then reset (Axes)X Axis to its original state
(say, Time).

After zapping those obviously high visibilities, things become a little more challenging. The figure at right shows a close up of the remaining visibilities between 0 and 1 Jy flux density.

There probably remain bad data there, but it's hard to tell on the crowded plot. At this point it's better to examine individual sources within this multisource measurement set.

Casaplotms-5.png

Click to enlarge

Examining Individual Sources within a Measurement Set

Use the following settings to look specifically at the first source of the measurement set.

  • (MS)Field = 0
  • (Axes)Y Axis Range = Automatic
  • (Plot)Unflagged Plots Symbol to Custom, 4 px (make the data points larger for clarity)
  • (Axes)Plot

Notice that the Plot button is available from more than one tab.

The figure at right shows the result. The bad data have been highlighted using the Mark Regions tool.

Casaplotms-add-02.png

Click to enlarge


The figure at right shows the remaining data for the first source (field = 0) after flagging the obviously discrepant points. Things look deceptively OK, but in fact there remains bad data from one antenna. The antenna contributed poor data for the entirety of the observation of this source, and, since the problem is not isolated in time, it is difficult to see the problem.

Casaplotms-add-02.png

Click to enlarge


Here are the same data reprojected onto baseline separations, (Axes)X Axis = UVDist_L (projected baseline separations in units of the observing wavelength). The misbehaving antenna shows up as spikes in these snapshot observations, because each antenna pair with that antenna corresponds to only a narrow range of baseline separations. (A longer observation would produce broader spikes, because the projected baseline separations would vary with the rotation of the earth under the source.)

The idea now would be to highlight a subset of the discrepant data as shown in the figure and extend the flags to the common antenna of these baselines.

Casaplotms-add-04.png

Click to enlarge

Antenna-Based Flagging

--Jack Gallimore 14:38, 1 December 2009 (UTC)