Data flagging with viewer: Difference between revisions

From CASA Guides
Jump to navigationJump to search
Emomjian (talk | contribs)
No edit summary
Jsalcido (talk | contribs)
No edit summary
 
(10 intermediate revisions by 2 users not shown)
Line 5: Line 5:
== Overview ==
== Overview ==


Your data will inevitably have some bad data. Perhaps a receiver on a given antenna is acting up, or perhaps the pointing on a given antenna is poor, and these problematic data will (hopefully) appear obviously in your measurement set. It's a good idea to inspect your data carefully before calibration and imaging, and CASA offers several tools to flag bad data interactively. For loyal users of TVFLG and SPFLG in AIPS, you'll be happy to know that {{viewer}} reproduces and even enhances these functionalities.
Your data will inevitably have some bad data. Perhaps a receiver on a given antenna is acting up, or perhaps the pointing on a given antenna is poor, and these problematic data will (hopefully) appear obvious in your measurement set. It's a good idea to inspect your data carefully before calibration and imaging, and CASA offers several tools to flag bad data interactively. For loyal users of TVFLG and SPFLG in AIPS, you'll be happy to know that {{viewer}} reproduces and even enhances these functionalities.


This tutorial illustrates how to use {{viewer}} to flag poor quality data. It will use the continuum dataset [https://archive.nrao.edu/archive/ArchiveQuery?PASSWD=&QUERYTYPE=ARCHIVE&PROTOCOL=HTML&SORT_PARM=Starttime&SORT_ORDER=Asc&MAX_ROWS=NO+LIMIT&SORT_PARM2=Starttime&SORT_ORDER2=Asc&QUERY_ID=9999&QUERY_MODE=Prepare+Download&LOCKMODE=PROJECT&SITE_CODE=AOC&DBHOST=CHEWBACCA&WRITELOG=0&PROJECT_CODE=AU0079&SEGMENT=&OBSERVER=&ARCHIVE_VOLUME=&TIMERANGE1=&TIMERANGE2=&SOURCE_ID=&SRC_SEARCH_TYPE=SIMBAD+or+NED+Resolver&CALIB_TYPE=ALL+Srcs&CENTER_RA=&LONG_RANGE=&FRAME=Equatorial&CENTER_DEC=&LAT_RANGE=&EQUINOX=J2000&SRAD=1.0%27&MIN_EXPOSURE=&OBS_BANDS=L&TELESCOPE=VLA&OBS_MODE=ALL&CORR_MODE=ALL&TELESCOPE_CONFIG=A&OBS_POLAR=ALL&OBSFREQ1=&DATATYPE=ALL&OBSBW1=&ARCHFORMAT=ALL&SUBMIT=Submit+Query  AU079] from the VLA archive; this dataset is also used in the [[Data flagging with casaplotms]] tutorial.
This tutorial illustrates how to use {{viewer}} to flag poor quality data. It will use the continuum dataset [https://archive.nrao.edu/archive/ArchiveQuery?PASSWD=&QUERYTYPE=ARCHIVE&PROTOCOL=HTML&SORT_PARM=Starttime&SORT_ORDER=Asc&MAX_ROWS=NO+LIMIT&SORT_PARM2=Starttime&SORT_ORDER2=Asc&QUERY_ID=9999&QUERY_MODE=Prepare+Download&LOCKMODE=PROJECT&SITE_CODE=AOC&DBHOST=CHEWBACCA&WRITELOG=0&PROJECT_CODE=AU0079&SEGMENT=&OBSERVER=&ARCHIVE_VOLUME=&TIMERANGE1=&TIMERANGE2=&SOURCE_ID=&SRC_SEARCH_TYPE=SIMBAD+or+NED+Resolver&CALIB_TYPE=ALL+Srcs&CENTER_RA=&LONG_RANGE=&FRAME=Equatorial&CENTER_DEC=&LAT_RANGE=&EQUINOX=J2000&SRAD=1.0%27&MIN_EXPOSURE=&OBS_BANDS=L&TELESCOPE=VLA&OBS_MODE=ALL&CORR_MODE=ALL&TELESCOPE_CONFIG=A&OBS_POLAR=ALL&OBSFREQ1=&DATATYPE=ALL&OBSBW1=&ARCHFORMAT=ALL&SUBMIT=Submit+Query  AU079] from the VLA archive; download all of the files in the resulting search; this dataset is also used in the [[Data flagging with casaplotms]] tutorial.


== Loading the Measurement Set into Viewer ==
== Loading the Measurement Set into Viewer ==
Line 37: Line 37:


Another window, titled ''Data Display Options'', will also appear, allowing you to alter the display and flagging options.  
Another window, titled ''Data Display Options'', will also appear, allowing you to alter the display and flagging options.  
Note: If the ''Data Display Options'' window does not automatically appear, it can be opened via the menu command sequence of ''Data > Adjust Data Display''.
</div>
</div>


<div style="float: right; width: 50%; text-align: center;">
<div style="float: right; width: 50%; text-align: center;">
[[File:au079_ms_in_viewer_with_flags.png | 200px]]   
[[File:au079_ms_in_viewer_with_flags.png | 200px]]   
''Click to enlarge''
</div>


|- style="background-color:#eeeeee;"  
|- style="background-color:#eeeeee;"  
|  
|  
 
</div>


<div style="float: left; width: 50%; align: left; vertical-align=middle;">
<div style="float: left; width: 50%; align: left; vertical-align=middle;">
The blue highlights can be initially distracting, and they can be optionally suppressed by altering the '''Flagging Options''' in the '''Data Display Options'''. The figure at right shows the options.
The blue highlights can be initially distracting, and they can be optionally suppressed by altering the '''Flagging Options''' in the '''Data Display Options'''. The figure at right shows the options.


* Set '''Show Flagged Regions...''' to '''Masked to Background'''. This operation will effectively set the flagged regions to black.  
* Set '''Show Flagged Regions...''' to '''Masked to Background'''. This operation will effectively set the flagged regions to black. You may want to fiddle with the Scaling Power Cycles options under the basic settings tab in order to increase the brightness for easier viewing.


In anticipation of the antenna-based editing to come, it's also worth setting the antenna flag.
In anticipation of the antenna-based editing to come, it's also worth setting the antenna flag.
Line 66: Line 65:
<div style="float: right; width: 50%; text-align: center;">
<div style="float: right; width: 50%; text-align: center;">
[[File:viewerFlag_fig2.png |  200px]]   
[[File:viewerFlag_fig2.png |  200px]]   
''Click to enlarge''
<div style="float: right; width: 100%; text-align: center;">
[[File:Flagged_Regions_AU079.png | 200px]]


''Click to enlarge''
''Click to enlarge''
Line 72: Line 76:
|-  
|-  
|  
|  


<div style="float: left; width: 50%; align: left; vertical-align=middle;">
<div style="float: left; width: 50%; align: left; vertical-align=middle;">
Line 90: Line 93:
All of these options are useful to investigate aberrant data, but '''Amp Diff''' can be efficient to start with. Reasonable options are shown in the figure at right. Be sure to turn down the display maximum ('''Data Maximum''' under '''Basic Settings''') to bring out the fainter variations.
All of these options are useful to investigate aberrant data, but '''Amp Diff''' can be efficient to start with. Reasonable options are shown in the figure at right. Be sure to turn down the display maximum ('''Data Maximum''' under '''Basic Settings''') to bring out the fainter variations.


You can also select a single source, or subset of sources, to display using the '''Field IDs''' blank. After you change the '''Field IDs''' box, you'll probably need to click on the '''Apply''' button. If you don't see the button, scroll all the way down in the '''Data Display Options''' window (Note that you don't see the '''Apply''' button in the figure to the immediate right because several submenus are open, but you can see it in the figure above).
You can also select a single source, or subset of sources, to display using the '''Field IDs''' box. After you change the '''Field IDs''' box, you'll probably need to click on the '''Apply''' button. If you don't see the button, scroll all the way down in the '''Data Display Options''' window (Note that you don't see the '''Apply''' button in the figure to the immediate right because several submenus are open, but you can see it in the figure above).


</div>
</div>
Line 147: Line 150:
<div style="float: left; width: 50%; align: left;">
<div style="float: left; width: 50%; align: left;">
Time to zap those junky antenna 13 data. First, use the zoom tool [[File:viewer_zoomselect.png]], which by default is activated by the '''left mouse button''', to click and drag a box around the region of interest. '''Left double-click''' within the box to zoom. The figure at right shows the zoom selector box and the resulting zoom.  
Time to zap those junky antenna 13 data. First, use the zoom tool [[File:viewer_zoomselect.png]], which by default is activated by the '''left mouse button''', to click and drag a box around the region of interest. '''Left double-click''' within the box to zoom. The figure at right shows the zoom selector box and the resulting zoom.  
Note: please be aware that if you are using a trackball, trackpad, or other alternate form of input device, the input commands that map to the mouse buttons may not work in your case.
</div>
</div>


Line 159: Line 164:


<div style="float: left; width: 50%; align: left;">
<div style="float: left; width: 50%; align: left;">
Now, use the drawing rectangle selector tool [[File:drawingSelector.png]], which by default is activated by the '''right mouse button'''. Right-click and drag to draw a box around the data to be flagged. Since we're flagging all to a common antenna, it's better to make the box narrow in the baseline (''x'') direction to avoid accidentally flagging the neighboring antenna. Then, '''right double-click''' within the selector box to flag.
Now, use the drawing rectangle selector tool [[File:drawingSelector.png]], which by default is activated by the '''right mouse button'''. Right-click and drag to draw a box around the data to be flagged. The box can be moved by holding down the right mouse button over the box and dragging, resized by right-clicking and holding on a corner and dragging, as well as completely deleted by hovering the mouse over the box and pressing the "Esc" key on your keyboard. Since we're flagging all to a common antenna, it's better to make the box narrow in the baseline (''x'') direction to avoid accidentally flagging the neighboring antenna. Then, '''right double-click''' within the selector box to flag.  


The figure at right illustrates the data selection tool and the result of data flagging. Although only a subset of the Antenna 13 baselines were selected, all of the Antenna 13 baselines were flagged because of our choice of '''Flag / Unflag Entire Antenna''' in the '''Data Display Options - Flagging Options''' menu.
The figure at right illustrates the data selection tool and the result of data flagging. Although only a subset of the Antenna 13 baselines were selected, all of the Antenna 13 baselines were flagged because of our choice of '''Flag / Unflag Entire Antenna''' in the '''Data Display Options - Flagging Options''' menu.
Line 181: Line 186:
</div>
</div>


To flag additional data, zoom out [[File: zoomOut.png]], select correlations [[File:vcrNext.png]] as necessary, and repeat the steps outlined above.  
To flag additional data, zoom out [[File: zoomOut.png]], select correlations [[File:vcrNext.png]] as necessary, and repeat the steps outlined above. If you accidentally flag some data, simply exiting the viewer will discard the flagging edits.


It is absolutely vital to save your edits before leaving {{viewer}}. From the '''Data Display Options''' window, select '''Flagging Options''' and '''Save Edits''' (see figure at right). You are now ready for calibration and imaging!
Once you've flagged the appropriate areas, it is absolutely vital to save your edits before leaving {{viewer}}. From the '''Data Display Options''' window, select '''Flagging Options''' and '''Save Edits''' (see figure at right). You are now ready for calibration and imaging!


== Displaying Calibrated Data ==
== Displaying Calibrated Data ==

Latest revision as of 14:56, 20 July 2017

Disclaimer: Due to continuous CASA software updates, GUI images may look different on more recent versions than those shown here.


Overview

Your data will inevitably have some bad data. Perhaps a receiver on a given antenna is acting up, or perhaps the pointing on a given antenna is poor, and these problematic data will (hopefully) appear obvious in your measurement set. It's a good idea to inspect your data carefully before calibration and imaging, and CASA offers several tools to flag bad data interactively. For loyal users of TVFLG and SPFLG in AIPS, you'll be happy to know that viewer reproduces and even enhances these functionalities.

This tutorial illustrates how to use viewer to flag poor quality data. It will use the continuum dataset AU079 from the VLA archive; download all of the files in the resulting search; this dataset is also used in the Data flagging with casaplotms tutorial.

Loading the Measurement Set into Viewer

The data may be loaded into CASA using the importvla command. The following commands import the data into the measurement set au079.ms and send them to the viewer.

# from loaddata.py
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')
viewer('au079.ms') # load the data into the viewer for editing

The viewer command can also be invoked without argument, in which case a file selector GUI will appear.

Setting Up for Antenna-based Flagging

The figure at right shows the default viewer display for a measurement set. The axes are (y) time and (x) baseline, or antenna pair, enumerated by the common antenna number of the pair (like TVFLG in AIPS). Flagged data are highlighted in pale blue.

Another window, titled Data Display Options, will also appear, allowing you to alter the display and flagging options.

Note: If the Data Display Options window does not automatically appear, it can be opened via the menu command sequence of Data > Adjust Data Display.

The blue highlights can be initially distracting, and they can be optionally suppressed by altering the Flagging Options in the Data Display Options. The figure at right shows the options.

  • Set Show Flagged Regions... to Masked to Background. This operation will effectively set the flagged regions to black. You may want to fiddle with the Scaling Power Cycles options under the basic settings tab in order to increase the brightness for easier viewing.

In anticipation of the antenna-based editing to come, it's also worth setting the antenna flag.

  • Set Flag / Unflag Entire Antenna to Yes.

Now, when multiple baselines are selected, all baselines to the common antenna will be flagged.

There are also options to flag all correlations or channels, the latter being particularly helpful for spectral-line experiments.

Click to enlarge

Click to enlarge

There is a choice of data to display. Select the MS and Visibility Selection tab on the Data Display Options window; see the figure at right. The Visibility Component menu allows you to choose to display visibility data from the following list.

  • Amplitude
  • Phase
  • Real (the real part of the visibilities)
  • Imaginary (the imaginary part of the visibilities)
  • Amp Diff (amplitudes after subtracting a local, rolling time-average)
  • Amp RMS (based on a rolling time window)
  • Phase Diff (phases after subtracting a local, rolling time-average)
  • Phase RMS (based on a rolling time window)

The rolling time windows needed to calculate the Diff and RMS options are tuned using the Moving Average Size slider.

All of these options are useful to investigate aberrant data, but Amp Diff can be efficient to start with. Reasonable options are shown in the figure at right. Be sure to turn down the display maximum (Data Maximum under Basic Settings) to bring out the fainter variations.

You can also select a single source, or subset of sources, to display using the Field IDs box. After you change the Field IDs box, you'll probably need to click on the Apply button. If you don't see the button, scroll all the way down in the Data Display Options window (Note that you don't see the Apply button in the figure to the immediate right because several submenus are open, but you can see it in the figure above).

Click to enlarge


The result of these operations is illustrated in the figure at right. Data from the RR correlation are shown, but you can easily select the other correlations (RL, LR, LL) by using the blue, DVD-style control buttons below the main display.

Tip: For spectral line datasets, you'll probably also want to use the DVD-style control buttons to step through spectral channels. You can change which data dimension is affected by these control buttons with the Animation Axis menu, located under Display Axes in the Data Display Options window.


The RR data look overall pretty good. The brighter horizontal stripes mark calibrator observations; brighter sources show greater noise. Antenna 13 looks a little junky, however, especially between time marks 1000 and 2500.

Click to enlarge

Tip: For spectral line datasets, you might also like to display (y) time against (x) spectral channel (as in AIPS SPFLG). You can do this by going to Display Axes in the Data Display Options and selecting X Axis as Channel.

Antenna-Based Flagging

The following steps outline flagging with viewer.

  • Zoom in on junky-looking data using the zoom tool .
  • Use one of the drawing selectors to identify the bad data.
  • Zoom out---either incrementally with or to show the entire image with ---and repeat.
  • Important: save your edits! Under Flagging Options, use the Save Edits button.

This section of the tutorial provides a more detailed walkthrough.

Time to zap those junky antenna 13 data. First, use the zoom tool , which by default is activated by the left mouse button, to click and drag a box around the region of interest. Left double-click within the box to zoom. The figure at right shows the zoom selector box and the resulting zoom.

Note: please be aware that if you are using a trackball, trackpad, or other alternate form of input device, the input commands that map to the mouse buttons may not work in your case.

Click to enlarge

Now, use the drawing rectangle selector tool , which by default is activated by the right mouse button. Right-click and drag to draw a box around the data to be flagged. The box can be moved by holding down the right mouse button over the box and dragging, resized by right-clicking and holding on a corner and dragging, as well as completely deleted by hovering the mouse over the box and pressing the "Esc" key on your keyboard. Since we're flagging all to a common antenna, it's better to make the box narrow in the baseline (x) direction to avoid accidentally flagging the neighboring antenna. Then, right double-click within the selector box to flag.

The figure at right illustrates the data selection tool and the result of data flagging. Although only a subset of the Antenna 13 baselines were selected, all of the Antenna 13 baselines were flagged because of our choice of Flag / Unflag Entire Antenna in the Data Display Options - Flagging Options menu.

Click to enlarge

Finishing up

Click to enlarge

To flag additional data, zoom out , select correlations as necessary, and repeat the steps outlined above. If you accidentally flag some data, simply exiting the viewer will discard the flagging edits.

Once you've flagged the appropriate areas, it is absolutely vital to save your edits before leaving viewer. From the Data Display Options window, select Flagging Options and Save Edits (see figure at right). You are now ready for calibration and imaging!

Displaying Calibrated Data

You might like to double-check the data after calibration, to ensure that the calibration looks good and no new bad data has popped up. You can do this easily by selecting 'corrected' as the Visibility Type, which can be found in MS and Visibility Selection section of the Data Display Options.

Pre-upgrade VLA Tutorials
CASA Guides




Last checked on CASA Version 4.7.2