casa
$Rev:20696$
|
TestFlagger: high-performance automated flagging. More...
#include <TestFlagger.h>
Public Member Functions | |
TestFlagger () | |
default constructor | |
~TestFlagger () | |
destructor | |
void | done () |
reset everything | |
bool | open (String msname, Double ntime) |
configure the tool, open the MS | |
bool | selectData (Record selrec) |
parse the data selection | |
bool | selectData (String field, String spw, String array, String feed, String scan, String antenna, String uvrange, String timerange, String correlation, String intent, String observation="") |
bool | parseAgentParameters (Record agent_params) |
parse the parameters of the agent | |
String | getExpressionFunction (String expression) |
bool | isExpressionPolarizationAll (String expression) |
bool | initAgents () |
initialize the agents list | |
Record | run (Bool writeflags, Bool sequential=true) |
Run the tool and write the flags to the MS. | |
bool | printFlagSelections () |
Flag backup methods. | |
bool | saveFlagVersion (String versionname, String comment, String merge) |
bool | restoreFlagVersion (Vector< String > versionname, String merge) |
bool | deleteFlagVersion (Vector< String > versionname) |
bool | getFlagVersionList (Vector< String > &verlist) |
bool | parseManualParameters (String field, String spw, String array, String feed, String scan, String antenna, String uvrange, String timerange, String correlation, String intent, String observation, Bool autocorr, Bool apply) |
Agent's specific parsing methods (for convenience only) Parse parameters for manual. | |
bool | parseClipParameters (String field, String spw, String array, String feed, String scan, String antenna, String uvrange, String timerange, String correlation, String intent, String observation, String datacolumn, Vector< Double > clipminmax, Bool clipoutside, Bool channelavg, Bool clipzeros, Bool apply) |
Parse parameters for clip. | |
bool | parseQuackParameters (String field, String spw, String array, String feed, String scan, String antenna, String uvrange, String timerange, String correlation, String intent, String observation, String quackmode, Double quackinterval, Bool quackincrement, Bool apply) |
Parse parameters for quack. | |
bool | parseElevationParameters (String field, String spw, String array, String feed, String scan, String antenna, String uvrange, String timerange, String correlation, String intent, String observation, Double lowerlimit, Double upperlimit, Bool apply) |
Parse parameters for elevation. | |
bool | parseTfcropParameters (String field, String spw, String array, String feed, String scan, String antenna, String uvrange, String timerange, String correlation, String intent, String observation, Double ntime, Bool combinescans, String datacolumn, Double timecutoff, Double freqcutoff, String timefit, String freqfit, Int maxnpieces, String flagdimension, String usewindowstats, Int halfwin, Bool apply) |
Parse parameters for tfcrop. | |
bool | parseExtendParameters (String field, String spw, String array, String feed, String scan, String antenna, String uvrange, String timerange, String correlation, String intent, String observation, Double ntime, Bool combinescans, Bool extendpols, Double growtime, Double growfreq, Bool growaround, Bool flagneartime, Bool flagnearfreq, Bool apply) |
Parse parameters for extend. | |
bool | parseSummaryParameters (String field, String spw, String array, String feed, String scan, String antenna, String uvrange, String timerange, String correlation, String intent, String observation, Bool spwchan, Bool spwcorr, Bool basecnt) |
Parse parameters for summary. | |
Protected Attributes | |
String | msname_p |
variables used to initialize the FlagDataHandler | |
uShort | iterationApproach_p |
Double | timeInterval_p |
String | spw_p |
members to parse to selectData | |
String | scan_p |
String | field_p |
String | antenna_p |
String | timerange_p |
String | correlation_p |
String | intent_p |
String | feed_p |
String | array_p |
String | uvrange_p |
String | observation_p |
Record | dataselection_p |
String | mode_p |
agent's members | |
Record | agentParams_p |
FlagAgentSummary * | summaryAgent_p |
Bool | combinescans_p |
Bool | mixed_p |
True if there are apply and unapply parameters in the list. | |
FlagAgentDisplay * | displayAgent_p |
Display agent parameters. | |
FlagDataHandler * | fdh_p |
variables for initAgents | |
std::vector< Record > | agents_config_list_p |
std::vector< Record > | agents_config_list_copy_p |
FlagAgentList | agents_list_p |
Static Protected Attributes | |
static LogIO | os |
Private Member Functions | |
TestFlagger (const TestFlagger &) | |
TestFlagger & | operator= (const TestFlagger &) |
void | getMax (Double value) |
Maximum between two numbers. | |
bool | isModeValid (String mode) |
Check if mode is valid against a list of known modes. | |
Private Attributes | |
LogSink | logSink_p |
Sink used to store history. | |
Double | max_p |
Store the temporary maximum value. | |
Bool | timeset_p |
Helper members. | |
Bool | iterset_p |
Static Private Attributes | |
static const bool | dbg |
Debug message flag. |
TestFlagger: high-performance automated flagging.
TestFlagger performs automated flagging operations on a measurement set. The class is constructed from an MS. After that, the run method may be used to run any number of flagging agents.
// The following is a typical way of using this class and its methods to perform flagging. // Open the MS or a calibration file and attach it to the tool. This will create an object of the // FlagDataHandler (fdh) type. The constructor of the fdh takes three arguments, // the MS or CAL table, the iteration approach to use and the time interval. Only the MS // is mandatory to use. By default it will use the FlagDataHandler::SUB_INTEGRATION iteration // approach and 0.0 seconds as the time interval. TestFlagger *tf = new TestFlagger(); tf->open('my.ms') // Select the data where to flag. If left blank, the whole MS will be selected. This step // will use the MS Selection class. There are two methods to perform the selection. One takes // a Record of the parameters, the other takes the individual parameters as arguments. // 1) First method: String spw = "0:1~10"; String scan = "1"; Record selection = Record(); selection.define("spw", spw); selection.define("scan", scan); tf->selectData(selection); // 2) Second method: tf->selectData(spw=spw, scan=scan); // Now it is time to build a list of the agents that we want to run to process the data. This // step will create a list of all the agents that will be executed to flag/unflag the data. // This method can be called multiple times. Every call should contain the desired parameters of // the agent and optionally data selection parameters. When data selection parameters are present, // the agent will loop through only that portion of the data. // This method will check if the requested agent (mode) is known from the following list // (manual, clip, quack, shadow, elevation, tfcrop, rflag, extend, unflag and summary). If // empty or unknown, it will give a warning and return. // If any tfcrop, rflag or extend mode is present, this method will calculate the maximum value // of time interval (ntime) from these agents. The maximum value will be used for all agents in // the list. // A similar situation will happen with the combinescans parameter. If any of the combinescans is // True, it will be taken as True to all agents. // Async I/O will be activated if any of the modes clip, tfcrop or rflag is requested. // Only for the tfcrop agent, if a correlation ALL is requested, this method will create one // agent for each available polarization in the MS. For example, if the MS contains polarizations // XX and YY and the parameter is correlation="ABS_ALL", then there will be two tfcrop agents, // one with correlation="ABS_XX" and the other with correlation="ABS_YY". The apply parameter // is set by default to True to apply the flags. Record agent_pars = Record(); agent_pars.define("mode", "clip"); agent_pars.define("clipzeros", true); agent_pars.define("apply", true); tf->parseAgentParameters(agent_pars); Record agent_pars = Record(); agent_pars.define("mode", "manual"); agent_pars.define("autocorr", true); tf->parseAgentParameters(agent_pars); Record agent_pars = Record(); agent_pars.define("mode", "summary"); agent_pars.define("basecnt", true); tf->parseAgentParameters(agent_pars); // There are convenience functions to parse the agent's parameters, one specific for each agent. // The above calls can be done instead using these functions. tf->parseClipParameters(clipzeros=true, apply=true); tf->parseManualParameters(autocorr=true); tf->parseSummaryParameters(basecnt=true); // In either one of the cases, three agents will be created. // // NOTE: it is possible to add multiple summary agents to the list and gather a list of summary // reports when executing the tool. // We need to initialize the agents, which // will call the constructor of each one of them and set the parameters that were given in the previous // calls. Some basic checks will be performed at this stage for types and values of the parameters. // If any tfcrop, rflag, extend or display agent is in the list, the iteration approach will be // set to a different value depending on whether combinescans is true or not. When True, the // iteration approach will be set to FlagDataHandler::COMBINE_SCANS_MAP_ANTENNA_PAIRS_ONLY, otherwise // to FlagDataHandler::COMPLETE_SCAN_MAP_ANTENNA_PAIRS_ONLY. // This method will create agents and add them to a FlagAgentList. If for any reason, the call to // FlagAgentBase::create(fdh_p, agent_rec) fails, an error message will be displayed. Any agents previously // added to the FlagAgentList will remain there. A subsequent call to this method can be done to add // more agents to the same FlagAgentList. tf->initAgents(); // The next step in the chain is to actually process the flags and write them or // not to the MS. The run method takes two parameters, writeflags and sequential. // The parameter writeflags controls whether to write the flags or not to the MS. // By default it is set to True. Setting writeflags to False is useful when one // wants to run the tool together with the display agent to see what is going to be // flagged before deciding to write or not to the MS. The sequential parameter // controls if the order of the agent's list needs to be preserved or not. If set to False, // the order will not be preserved and the framework may execute the agent's list in parallel. // By default sequential is set to True. // The run method gathers several reports, depending on which agents are run. The display and summary agents // produce reports that can be retrieved from calling the run method. The reports are returned via a Record // that may contain multiple reports at the same time. Record myReports; myReports = tf->run(); // To destroy the tool, call a method to execute the destructor. tf->done();
To flag data using different algorithms.
Definition at line 202 of file TestFlagger.h.
casa::TestFlagger::TestFlagger | ( | ) |
default constructor
casa::TestFlagger::~TestFlagger | ( | ) |
destructor
casa::TestFlagger::TestFlagger | ( | const TestFlagger & | ) | [inline, private] |
Definition at line 331 of file TestFlagger.h.
void casa::TestFlagger::done | ( | ) |
reset everything
void casa::TestFlagger::getMax | ( | Double | value | ) | [private] |
Maximum between two numbers.
bool casa::TestFlagger::initAgents | ( | ) |
initialize the agents list
bool casa::TestFlagger::isExpressionPolarizationAll | ( | String | expression | ) |
bool casa::TestFlagger::isModeValid | ( | String | mode | ) | [private] |
Check if mode is valid against a list of known modes.
TestFlagger& casa::TestFlagger::operator= | ( | const TestFlagger & | ) | [inline, private] |
Definition at line 333 of file TestFlagger.h.
bool casa::TestFlagger::parseAgentParameters | ( | Record | agent_params | ) |
parse the parameters of the agent
bool casa::TestFlagger::parseClipParameters | ( | String | field, |
String | spw, | ||
String | array, | ||
String | feed, | ||
String | scan, | ||
String | antenna, | ||
String | uvrange, | ||
String | timerange, | ||
String | correlation, | ||
String | intent, | ||
String | observation, | ||
String | datacolumn, | ||
Vector< Double > | clipminmax, | ||
Bool | clipoutside, | ||
Bool | channelavg, | ||
Bool | clipzeros, | ||
Bool | apply | ||
) |
Parse parameters for clip.
bool casa::TestFlagger::parseElevationParameters | ( | String | field, |
String | spw, | ||
String | array, | ||
String | feed, | ||
String | scan, | ||
String | antenna, | ||
String | uvrange, | ||
String | timerange, | ||
String | correlation, | ||
String | intent, | ||
String | observation, | ||
Double | lowerlimit, | ||
Double | upperlimit, | ||
Bool | apply | ||
) |
Parse parameters for elevation.
bool casa::TestFlagger::parseExtendParameters | ( | String | field, |
String | spw, | ||
String | array, | ||
String | feed, | ||
String | scan, | ||
String | antenna, | ||
String | uvrange, | ||
String | timerange, | ||
String | correlation, | ||
String | intent, | ||
String | observation, | ||
Double | ntime, | ||
Bool | combinescans, | ||
Bool | extendpols, | ||
Double | growtime, | ||
Double | growfreq, | ||
Bool | growaround, | ||
Bool | flagneartime, | ||
Bool | flagnearfreq, | ||
Bool | apply | ||
) |
Parse parameters for extend.
bool casa::TestFlagger::parseManualParameters | ( | String | field, |
String | spw, | ||
String | array, | ||
String | feed, | ||
String | scan, | ||
String | antenna, | ||
String | uvrange, | ||
String | timerange, | ||
String | correlation, | ||
String | intent, | ||
String | observation, | ||
Bool | autocorr, | ||
Bool | apply | ||
) |
Agent's specific parsing methods (for convenience only) Parse parameters for manual.
bool casa::TestFlagger::parseQuackParameters | ( | String | field, |
String | spw, | ||
String | array, | ||
String | feed, | ||
String | scan, | ||
String | antenna, | ||
String | uvrange, | ||
String | timerange, | ||
String | correlation, | ||
String | intent, | ||
String | observation, | ||
String | quackmode, | ||
Double | quackinterval, | ||
Bool | quackincrement, | ||
Bool | apply | ||
) |
Parse parameters for quack.
bool casa::TestFlagger::parseSummaryParameters | ( | String | field, |
String | spw, | ||
String | array, | ||
String | feed, | ||
String | scan, | ||
String | antenna, | ||
String | uvrange, | ||
String | timerange, | ||
String | correlation, | ||
String | intent, | ||
String | observation, | ||
Bool | spwchan, | ||
Bool | spwcorr, | ||
Bool | basecnt | ||
) |
Parse parameters for summary.
bool casa::TestFlagger::parseTfcropParameters | ( | String | field, |
String | spw, | ||
String | array, | ||
String | feed, | ||
String | scan, | ||
String | antenna, | ||
String | uvrange, | ||
String | timerange, | ||
String | correlation, | ||
String | intent, | ||
String | observation, | ||
Double | ntime, | ||
Bool | combinescans, | ||
String | datacolumn, | ||
Double | timecutoff, | ||
Double | freqcutoff, | ||
String | timefit, | ||
String | freqfit, | ||
Int | maxnpieces, | ||
String | flagdimension, | ||
String | usewindowstats, | ||
Int | halfwin, | ||
Bool | apply | ||
) |
Parse parameters for tfcrop.
bool casa::TestFlagger::printFlagSelections | ( | ) |
Flag backup methods.
Run the tool and write the flags to the MS.
bool casa::TestFlagger::selectData | ( | Record | selrec | ) |
parse the data selection
bool casa::TestFlagger::selectData | ( | String | field, |
String | spw, | ||
String | array, | ||
String | feed, | ||
String | scan, | ||
String | antenna, | ||
String | uvrange, | ||
String | timerange, | ||
String | correlation, | ||
String | intent, | ||
String | observation = "" |
||
) |
Record casa::TestFlagger::agentParams_p [protected] |
Definition at line 230 of file TestFlagger.h.
std::vector<Record> casa::TestFlagger::agents_config_list_copy_p [protected] |
Definition at line 243 of file TestFlagger.h.
std::vector<Record> casa::TestFlagger::agents_config_list_p [protected] |
Definition at line 242 of file TestFlagger.h.
FlagAgentList casa::TestFlagger::agents_list_p [protected] |
Definition at line 244 of file TestFlagger.h.
String casa::TestFlagger::antenna_p [protected] |
Definition at line 218 of file TestFlagger.h.
String casa::TestFlagger::array_p [protected] |
Definition at line 223 of file TestFlagger.h.
Bool casa::TestFlagger::combinescans_p [protected] |
Definition at line 232 of file TestFlagger.h.
String casa::TestFlagger::correlation_p [protected] |
Definition at line 220 of file TestFlagger.h.
Record casa::TestFlagger::dataselection_p [protected] |
Definition at line 226 of file TestFlagger.h.
const bool casa::TestFlagger::dbg [static, private] |
Debug message flag.
Definition at line 345 of file TestFlagger.h.
FlagAgentDisplay* casa::TestFlagger::displayAgent_p [protected] |
Display agent parameters.
Definition at line 238 of file TestFlagger.h.
FlagDataHandler* casa::TestFlagger::fdh_p [protected] |
variables for initAgents
Definition at line 241 of file TestFlagger.h.
String casa::TestFlagger::feed_p [protected] |
Definition at line 222 of file TestFlagger.h.
String casa::TestFlagger::field_p [protected] |
Definition at line 217 of file TestFlagger.h.
String casa::TestFlagger::intent_p [protected] |
Definition at line 221 of file TestFlagger.h.
uShort casa::TestFlagger::iterationApproach_p [protected] |
Definition at line 210 of file TestFlagger.h.
Bool casa::TestFlagger::iterset_p [private] |
Definition at line 352 of file TestFlagger.h.
LogSink casa::TestFlagger::logSink_p [private] |
Sink used to store history.
Definition at line 342 of file TestFlagger.h.
Double casa::TestFlagger::max_p [private] |
Store the temporary maximum value.
Definition at line 348 of file TestFlagger.h.
Bool casa::TestFlagger::mixed_p [protected] |
True if there are apply and unapply parameters in the list.
Definition at line 235 of file TestFlagger.h.
String casa::TestFlagger::mode_p [protected] |
agent's members
Definition at line 229 of file TestFlagger.h.
String casa::TestFlagger::msname_p [protected] |
variables used to initialize the FlagDataHandler
Definition at line 209 of file TestFlagger.h.
String casa::TestFlagger::observation_p [protected] |
Definition at line 225 of file TestFlagger.h.
LogIO casa::TestFlagger::os [static, protected] |
Definition at line 206 of file TestFlagger.h.
String casa::TestFlagger::scan_p [protected] |
Definition at line 216 of file TestFlagger.h.
String casa::TestFlagger::spw_p [protected] |
members to parse to selectData
Definition at line 215 of file TestFlagger.h.
FlagAgentSummary* casa::TestFlagger::summaryAgent_p [protected] |
Definition at line 231 of file TestFlagger.h.
Double casa::TestFlagger::timeInterval_p [protected] |
Definition at line 211 of file TestFlagger.h.
String casa::TestFlagger::timerange_p [protected] |
Definition at line 219 of file TestFlagger.h.
Bool casa::TestFlagger::timeset_p [private] |
Helper members.
Definition at line 351 of file TestFlagger.h.
String casa::TestFlagger::uvrange_p [protected] |
Definition at line 224 of file TestFlagger.h.