| Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
| Version 1.9 Build 803 |
|
Example 1:
To clip data in data.ms in fields 9 & 11, spectral window 1, for which
the RR & LL data (pols 1 & 4) are outside of the amplitude range
5-10 Jy:
fg:= flagger(msfile='data.ms') # Start flagger tool.
fg.setids(fieldid=[9, 11], # Select fields &
spectralwindowid=1); # and spectral window.
fg.setpol(pol=[1, 4] ); # Select RR & LL for testing.
fg.filter(column="DATA", # Select filter,
operation="range", # test for data outside of
comparison="Amplitude", # amplitude range, run trial
range="5.0Jy 10.0Jy", # to see how many data points
fullpol=T, # would be flagged.
trial=T);
fg.filter(column="DATA", # Flag the data now.
operation="range",
comparison="Amplitude",
range="5.0Jy 10.0Jy",
fullpol=T,
trial=F);
fg.done(); # Close flagger tool.
In this example, the setids and setpol functions select
the data that will be tested. The filter tests to see whether
the selected data (the observed DATA column) is within the specified
range, if it is not, then the data is flagged. The range here is
applicable to the RR & LL polarizations (pols 1 & 4). But, if the
RR & LL polarizations are bad, it is a good idea to flag the
cross-polarizations, RL & LR. This is done by setting FULLPOL=T to flag RL, LR data even though it wasn't tested by the
filter function. The first call to the filter function
was just a trial. The logger window will report how many data will be
flagged, e.g.:
Filtering (in range mode) would have flagged 6220 additional data points
The second call to the filter function actually flags the data.
Example 2:
To flag data from antenna = 5, spectral window = 1, field_id = 2,
within a specified timerange using the Tool Manager GUI, select:
fg.setantennas(ants=5) # Select data including antenna 5
fg.setids(spectralwindowid=1,fieldid=2) # Select spectral id and field id
fg.settimerange(starttime="24-FEB-2000/10:00:05", # Select timerange
endtime="24-FEB-2000/10:09:37");
fg.state(); # Review data selection
fg.flag(trial=T); # Trial run to see how many rows
# will be flagged
fg.flag(); # Flag it
fg.reset(); # Reset the data selection
In this example, the state function reviews the state of
the fg tool to make sure all the inputs are the way
you want them. The state of the tool will be reported in the rolldown
Tool status bar (see Fig.
)
Running the fg.flag function with TRIAL=T
produces a message in the logger window of how many rows of data will
be flagged with this operation. Setting TRIAL=F actually
flags the selected data. Finally, the fg.reset function resets
the state of the flagger tool and you can start with a clean slate.
Example 3:
To flag data from baseline 3-4, spectral window 2,
field_id 1, within
10s of a timestamp:
fg.setbaselines(ants=[3,4]) # Select data for baseline 3-4
fg.setids(spectralwindowid=2,fieldid=1) # Select spectral id and field id
fg.settime(centertime="24-FEB-2000/10:00:05", # Select time and range
delta="10s");
fg.state(); # Review data selection
fg.flag(); # Flag it
In the above examples, time-related data selection options (set by
flagger.settimerange and flagger.settime) and
the two antenna-related data selection options (set by
flagger.setantennas and flagger.setbaselines are logically OR'd. The
net time selections, net antenna selections, and all other selections
are then AND'd together. Note that the data selection persists after
the flagging operation flagger.flag is executed. To clear the
selection, execute the flagger.reset function, or execute individual
selection commands without arguments to clear only that particular
selection.
Example 4:
To flag all data on antenna 11 for the same spectral window,
field, and timestamp as for baseline 3-4 in the previous example:
fg.setbaselines(); # Clear the baseline selection fg.setantennas(ants=11); # Select antenna 11 fg.state(); # Review data selection fg.flag(); # Flag it
Example 5:
To restore or unflag data for baseline 11-15 (that was flagged above):
fg.setantennas(); # Clears antenna selection
fg.setbaselines(ants=[11,15]); # Select baseline 11-15
fg.state(); # Review data selection (note
# other selections still in
# effect)
fg.unflag(); # undo previous flags
Note that use of flagger.unflag may restore data that had been flagged
by other means (e.g., by the on-line system, or by other criteria in
previous use of flagger or msplot).
Example 6:
One can also use the flagger tool to select and flag specific
types of data. For example, it is usually desirable to flag the
auto-correlation data from the VLA if they were filled with the
cross-correlations (otherwise, the imager tool will attempt to use
it in image formation as if it were single dish data). To do this:
fg.reset(); # Reset the data selection fg.flagac(); # Flag the auto-correlations
Example 7:
It is also often the case that the VLA data near the beginning of scans is bad
(e.g. after field or frequency band changes). To flag such
data, use the flagger.quack function. For example, to remove 20
seconds of data at the beginning of scans (defined by gaps larger than
30 seconds) on field 3:
fg.reset(); # Reset the data selection
fg.setids(fieldid=3); # Limit quack to fieldid=3 only
fg.quack(scaninterval='30s', # Trial run of quack
delta='20s',
trial=T);
fg.quack(scaninterval='30s', # Quack it
delta='20s');
Where the first execution of the quack function was a trial
run to see exactly how much data would be flagged. The second run with
TRIAL=F actually 'quacked' the data.
Example 8:
To clip data in field 2 and spectral windows 1 & 2,
outside of a specified amplitude range of 1.12-1.34 Jy you would do
the following:
fg.setids(fieldid=2, spwid=[1,2]); # Select field, spw
fg.setpol(pol=[1,4]); # Select polarizations 1,4
# (e.g., RR and LL)
fg.filter(column='DATA', # Flag data if, DATA column
operation='range', # Amplitudes are outside of
comparison='Amplitude', # the range 1.12-1.34 Jy.
range=['1.12Jy','1.34Jy'],
fullpol=T, # Extend flags to pols that
fullchan=T); # weren't tested by the filter
# and flag all channels in a
# uv data point if any channels
# are outside the amp range.
fg.done(); # Finish the flagger tool.
In this example, the setids and setpol functions select
the data that will be tested. The filter tests to see whether
the selected data (the observed DATA column) is within the specified
range, if it is not, then the data is flagged. The range here is
applicable to the RR & LL polarizations (pols 1 & 4). But, if the
RR & LL polarizations are bad, it is a good idea to flag the
cross-polarizations, RL & LR. This is done by setting FULLPOL=T to flag this data even though it wasn't tested by the
filter function. The choice of FULLCHAN=T specifies
that, if this is channel data and one channel fails the test, then all
channels in that uv data point will be flagged.