casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
casa::Flagger Class Reference

Flagger: high-performance automated flagging. More...

#include <Flagger.h>

Inheritance diagram for casa::Flagger:

Public Member Functions

 Flagger ()
 default constructor More...
 Flagger (casacore::MeasurementSet &ms)
 construct and attach to a measurement set More...
 ~Flagger ()
bool attach (casacore::MeasurementSet &ms, casacore::Bool setupAgentDefaults=true)
 Change or set the casacore::MS this Flagger refers to. More...
casacore::Bool selectdata (casacore::Bool useoriginalms=false, casacore::String field="", casacore::String spw="", casacore::String array="", casacore::String feed="", casacore::String scan="", casacore::String baseline="", casacore::String uvrange="", casacore::String time="", casacore::String correlation="", casacore::String intent="", casacore::String observation="")
 Set the data selection parameters. More...
casacore::Bool setdata (casacore::String field, casacore::String spw, casacore::String array, casacore::String feed, casacore::String scan, casacore::String baseline, casacore::String uvrange, casacore::String time, casacore::String correlation, casacore::String intent, casacore::String observation="")
 Make a data selection. More...
casacore::Bool setmanualflags (casacore::Bool autocorr, casacore::Bool unflag, casacore::String clipexpr, casacore::Vector< casacore::Double > cliprange, casacore::String clipcolumn, casacore::Bool outside, casacore::Bool channel_average, casacore::Double quackinterval=0.0, casacore::String quackmode=casacore::String("beg"), casacore::Bool quackincrement=casacore::Bool(false), casacore::String opmode=casacore::String("flag"), casacore::Double diameter=-1.0, casacore::Double lowerlimit=-1.0, casacore::Double upperlimit=91.0)
 Make a selection for manual flagging. More...
casacore::Bool clearflagselections (casacore::Int recordindex)
 Clean up all agents of type "select". More...
casacore::Bool printflagselections ()
casacore::Bool fillSelections (casacore::Record &rec)
 Fill the selection record to attach to the list of agents. More...
casacore::Bool setautoflagparams (casacore::String algorithm, casacore::Record &parameters)
 Set autoflag params. More...
casacore::Record getautoflagparams (casacore::String algorithm)
 Get default autoflag params. More...
casacore::Bool addAgent (casacore::RecordInterface &newAgent)
void detach ()
 Detaches from the casacore::MS. More...
casacore::Record run (casacore::Bool trial, casacore::Bool reset)
void summary (const casacore::RecordInterface &agents)
casacore::Bool saveFlagVersion (casacore::String versionname, casacore::String comment, casacore::String merge)
 flag version support. More...
casacore::Bool restoreFlagVersion (casacore::Vector< casacore::String > versionname, casacore::String merge)
casacore::Bool deleteFlagVersion (casacore::Vector< casacore::String > versionname)
casacore::Bool getFlagVersionList (casacore::Vector< casacore::String > &verlist)
const casacore::MeasurementSetmeasSet () const
 returns current MS More...
casacore::uInt numAnt () const
 number of antennas in MS More...
casacore::uInt numIfr () const
 number of IFRs in MS More...
casacore::uInt numFeed () const
 number of feeds in MS More...
casacore::uInt numFeedCorr () const
 number of feed correlations in MS More...
const casacore::Vector
< casacore::String > & 
antNames () const
 names of antennas More...
casacore::uInt ifrNumber (casacore::Int ant1, casacore::Int ant2) const
 derives a flat IFR index from two antenna indices More...
casacore::Vector< casacore::IntifrNumbers (casacore::Vector< casacore::Int > ant1, casacore::Vector< casacore::Int > ant2) const
 vector version of above More...
void ifrToAnt (casacore::uInt &ant1, casacore::uInt &ant2, casacore::uInt ifr) const
 derives antenna indices from a flat IFR index More...
const casacore::RecordInterfacedefaultAgents () const
 returns a record with all available agents and their default options More...

Static Public Member Functions

static const
defaultOptions ()
 returns a record of available options More...
static casacore::LogIOlogSink ()
 returns the log sink More...
static void reform_baselinelist (casacore::Matrix< casacore::Int > &baselinelist, unsigned nant)
static int my_aipspp_sum (const casacore::Array< casacore::Bool > &a)

Protected Member Functions

std::shared_ptr< RFABasecreateAgent (const casacore::String &name, RFChunkStats &chunk, const casacore::RecordInterface &parms, bool &only_selector)
 creates an agent by name More...
const casacore::RecordInterfacesetupAgentDefaults ()
 sets up record of agents and default parameters More...
void printAgentReports ()
 print flagging reports from individual agents More...
void printSummaryReport (RFChunkStats &chunk)
casacore::Bool selectDataChannel ()

Protected Attributes

casacore::MeasurementSet ms
casacore::MeasurementSet originalms
std::vector< std::shared_ptr
< RFABase > > 
 new added More...
bool scan_looping
casacore::String msname_p
casacore::Bool nullSelect_p
casacore::Bool setdata_p
casacore::Bool selectdata_p
casacore::String dataMode_p
< casacore::String
 casacore::Vector<casacore::Int> dataEnd_p; casacore::Vector<casacore::Int> dataStart_p, dataStep_p; casacore::Vector<casacore::Int> dataspectralwindowids_p; casacore::Vector<casacore::Int> spwidnchans_p; More...
casacore::Vector< casacore::Intdatafieldids_p
casacore::Vector< casacore::Intdatadescids_p
casacore::MRadialVelocity mDataStart_p
casacore::MRadialVelocity mDataStep_p
casacore::uInt nant
casacore::uInt nifr
casacore::uInt nfeed
casacore::uInt nfeedcorr
casacore::Vector< casacore::Intifr2ant1
casacore::Vector< casacore::Intifr2ant2
< casacore::String
< casacore::Double
casacore::Record agent_defaults

Static Protected Attributes

static casacore::LogIO os

Private Member Functions

 Flagger (const Flagger &)
Flaggeroperator= (const Flagger &)
void printAgentRecord (casacore::String &, casacore::uInt, const casacore::RecordInterface &)

Private Attributes

casacore::LogSink logSink_p
 Sink used to store history. More...
 Hold the original ms. More...
 casacore::MS Selection More...
bool spw_selection
 casacore::List of Agents More...
casacore::Int agentCount_p
 casacore::List of extra options More...
casacore::Bool quack_agent_exists

Static Private Attributes

static const bool dbg
 Debug Message flag. More...

Additional Inherited Members

- Public Types inherited from casa::FlaggerEnums
enum  StatEnums {
enum  PreFlagPolicy {

Detailed Description

Flagger: high-performance automated flagging.

Intended use:



casacore::MSFlagger and plain flagger were already taken.


Flagger 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.


construct casacore::MS and flagger casacore::MeasurementSet ms("test.MS2",casacore::Table::Update); Flagger flagger(ms); build record of global flagging options casacore::Record opt(casacore::Record::Variable); build record of flagging agents to be run casacore::Record selopt(flagger.defaultAgents().asRecord("select")); selopt.define(RF_POLICY,"RESET"); selopt.define(RF_AUTOCORR,true); casacore::Record agents(casacore::Record::Variable); agents.defineRecord("select",selopt); perform the flagging,opt);


We need an automated flagging tool. Existing tools (casacore::MSFlagger and flagger.g) were too slow. Hence, Flagger was developed.

To Do

Definition at line 100 of file Flagger.h.

Constructor & Destructor Documentation

casa::Flagger::Flagger ( )

default constructor

casa::Flagger::Flagger ( casacore::MeasurementSet ms)

construct and attach to a measurement set

casa::Flagger::~Flagger ( )
casa::Flagger::Flagger ( const Flagger )

Definition at line 266 of file Flagger.h.

Member Function Documentation

casacore::Bool casa::Flagger::addAgent ( casacore::RecordInterface newAgent)
const casacore::Vector<casacore::String>& casa::Flagger::antNames ( ) const

names of antennas

Definition at line 237 of file Flagger.h.

References antnames.

bool casa::Flagger::attach ( casacore::MeasurementSet ms,
casacore::Bool  setupAgentDefaults = true 

Change or set the casacore::MS this Flagger refers to.

casacore::Bool casa::Flagger::clearflagselections ( casacore::Int  recordindex)

Clean up all agents of type "select".

casacore::Bool clearflagselections(casacore::Vector<casacore::Int> &recordlist,casacore::Vector<casacore::String> &agentlist);

std::shared_ptr<RFABase> casa::Flagger::createAgent ( const casacore::String name,
RFChunkStats chunk,
const casacore::RecordInterface parms,
bool &  only_selector 

creates an agent by name

const casacore::RecordInterface& casa::Flagger::defaultAgents ( ) const

returns a record with all available agents and their default options

Definition at line 250 of file Flagger.h.

References agent_defaults.

static const casacore::RecordInterface& casa::Flagger::defaultOptions ( )

returns a record of available options

casacore::Bool casa::Flagger::deleteFlagVersion ( casacore::Vector< casacore::String versionname)
void casa::Flagger::detach ( )

Detaches from the casacore::MS.

casacore::Bool casa::Flagger::fillSelections ( casacore::Record rec)

Fill the selection record to attach to the list of agents.

casacore::Record casa::Flagger::getautoflagparams ( casacore::String  algorithm)

Get default autoflag params.

casacore::Bool casa::Flagger::getFlagVersionList ( casacore::Vector< casacore::String > &  verlist)
casacore::uInt casa::Flagger::ifrNumber ( casacore::Int  ant1,
casacore::Int  ant2 
) const

derives a flat IFR index from two antenna indices

casacore::Vector<casacore::Int> casa::Flagger::ifrNumbers ( casacore::Vector< casacore::Int ant1,
casacore::Vector< casacore::Int ant2 
) const

vector version of above

void casa::Flagger::ifrToAnt ( casacore::uInt ant1,
casacore::uInt ant2,
casacore::uInt  ifr 
) const

derives antenna indices from a flat IFR index

static casacore::LogIO& casa::Flagger::logSink ( )

returns the log sink

Definition at line 257 of file Flagger.h.

References os.

const casacore::MeasurementSet& casa::Flagger::measSet ( ) const

returns current MS

Definition at line 218 of file Flagger.h.

References ms.

static int casa::Flagger::my_aipspp_sum ( const casacore::Array< casacore::Bool > &  a)
casacore::uInt casa::Flagger::numAnt ( ) const

number of antennas in MS

Definition at line 221 of file Flagger.h.

References nant.

casacore::uInt casa::Flagger::numFeed ( ) const

number of feeds in MS

Definition at line 229 of file Flagger.h.

References nfeed.

casacore::uInt casa::Flagger::numFeedCorr ( ) const

number of feed correlations in MS

Definition at line 233 of file Flagger.h.

References nfeedcorr.

casacore::uInt casa::Flagger::numIfr ( ) const

number of IFRs in MS

Definition at line 225 of file Flagger.h.

References nifr.

Flagger& casa::Flagger::operator= ( const Flagger )

Definition at line 268 of file Flagger.h.

void casa::Flagger::printAgentRecord ( casacore::String ,
casacore::uInt  ,
const casacore::RecordInterface  
void casa::Flagger::printAgentReports ( )

print flagging reports from individual agents

casacore::Bool casa::Flagger::printflagselections ( )
void casa::Flagger::printSummaryReport ( RFChunkStats chunk)
static void casa::Flagger::reform_baselinelist ( casacore::Matrix< casacore::Int > &  baselinelist,
unsigned  nant 
casacore::Bool casa::Flagger::restoreFlagVersion ( casacore::Vector< casacore::String versionname,
casacore::String  merge 
casacore::Record casa::Flagger::run ( casacore::Bool  trial,
casacore::Bool  reset 
casacore::Bool casa::Flagger::saveFlagVersion ( casacore::String  versionname,
casacore::String  comment,
casacore::String  merge 

flag version support.

casacore::Bool casa::Flagger::selectdata ( casacore::Bool  useoriginalms = false,
casacore::String  field = "",
casacore::String  spw = "",
casacore::String  array = "",
casacore::String  feed = "",
casacore::String  scan = "",
casacore::String  baseline = "",
casacore::String  uvrange = "",
casacore::String  time = "",
casacore::String  correlation = "",
casacore::String  intent = "",
casacore::String  observation = "" 

Set the data selection parameters.

casacore::Bool casa::Flagger::selectDataChannel ( )
casacore::Bool casa::Flagger::setautoflagparams ( casacore::String  algorithm,
casacore::Record parameters 

Set autoflag params.

casacore::Bool casa::Flagger::setdata ( casacore::String  field,
casacore::String  spw,
casacore::String  array,
casacore::String  feed,
casacore::String  scan,
casacore::String  baseline,
casacore::String  uvrange,
casacore::String  time,
casacore::String  correlation,
casacore::String  intent,
casacore::String  observation = "" 

Make a data selection.

casacore::Bool casa::Flagger::setmanualflags ( casacore::Bool  autocorr,
casacore::Bool  unflag,
casacore::String  clipexpr,
casacore::Vector< casacore::Double cliprange,
casacore::String  clipcolumn,
casacore::Bool  outside,
casacore::Bool  channel_average,
casacore::Double  quackinterval = 0.0,
casacore::String  quackmode = casacore::String("beg"),
casacore::Bool  quackincrement = casacore::Bool(false),
casacore::String  opmode = casacore::String("flag"),
casacore::Double  diameter = -1.0,
casacore::Double  lowerlimit = -1.0,
casacore::Double  upperlimit = 91.0 

Make a selection for manual flagging.

const casacore::RecordInterface& casa::Flagger::setupAgentDefaults ( )

sets up record of agents and default parameters

void casa::Flagger::summary ( const casacore::RecordInterface agents)

Member Data Documentation

std::vector<std::shared_ptr<RFABase> > casa::Flagger::acc

Definition at line 117 of file Flagger.h.

casacore::Record casa::Flagger::agent_defaults

Definition at line 145 of file Flagger.h.

Referenced by defaultAgents().

casacore::Int casa::Flagger::agentCount_p

Definition at line 284 of file Flagger.h.

casacore::Record* casa::Flagger::agents_p

casacore::List of Agents

Definition at line 283 of file Flagger.h.

casacore::Vector<casacore::String> casa::Flagger::antnames

Definition at line 142 of file Flagger.h.

Referenced by antNames().

casacore::Vector<casacore::String> casa::Flagger::correlations_p

casacore::Vector<casacore::Int> dataEnd_p; casacore::Vector<casacore::Int> dataStart_p, dataStep_p; casacore::Vector<casacore::Int> dataspectralwindowids_p; casacore::Vector<casacore::Int> spwidnchans_p;

Definition at line 133 of file Flagger.h.

casacore::Vector<casacore::Int> casa::Flagger::datadescids_p

Definition at line 135 of file Flagger.h.

casacore::Vector<casacore::Int> casa::Flagger::datafieldids_p

Definition at line 134 of file Flagger.h.

casacore::String casa::Flagger::dataMode_p

Definition at line 127 of file Flagger.h.

const bool casa::Flagger::dbg

Debug Message flag.

Definition at line 290 of file Flagger.h.

casacore::Vector<casacore::Int> casa::Flagger::ifr2ant1

Definition at line 141 of file Flagger.h.

casacore::Vector<casacore::Int> casa::Flagger::ifr2ant2

Definition at line 141 of file Flagger.h.

casacore::LogSink casa::Flagger::logSink_p

Sink used to store history.

Definition at line 273 of file Flagger.h.

casacore::MRadialVelocity casa::Flagger::mDataStart_p

Definition at line 136 of file Flagger.h.

casacore::MRadialVelocity casa::Flagger::mDataStep_p

Definition at line 137 of file Flagger.h.

casacore::MeasurementSet casa::Flagger::ms

Definition at line 115 of file Flagger.h.

Referenced by measSet().

casacore::String casa::Flagger::msname_p

Definition at line 123 of file Flagger.h.

casacore::MeasurementSet* casa::Flagger::mssel_p

new added

Definition at line 120 of file Flagger.h.

casacore::MSSelection* casa::Flagger::msselection_p

casacore::MS Selection

Definition at line 279 of file Flagger.h.

casacore::uInt casa::Flagger::nant

Definition at line 140 of file Flagger.h.

Referenced by numAnt().

casacore::uInt casa::Flagger::nfeed

Definition at line 140 of file Flagger.h.

Referenced by numFeed().

casacore::uInt casa::Flagger::nfeedcorr

Definition at line 140 of file Flagger.h.

Referenced by numFeedCorr().

casacore::uInt casa::Flagger::nifr

Definition at line 140 of file Flagger.h.

Referenced by numIfr().

casacore::Bool casa::Flagger::nullSelect_p

Definition at line 124 of file Flagger.h.

casacore::Record* casa::Flagger::opts_p

casacore::List of extra options

Definition at line 287 of file Flagger.h.

casacore::MeasurementSet casa::Flagger::originalms

Definition at line 116 of file Flagger.h.

casacore::MeasurementSet* casa::Flagger::originalms_p

Hold the original ms.

Definition at line 276 of file Flagger.h.

casacore::LogIO casa::Flagger::os

Definition at line 147 of file Flagger.h.

Referenced by logSink().

casacore::Bool casa::Flagger::quack_agent_exists

Definition at line 292 of file Flagger.h.

bool casa::Flagger::scan_looping

Definition at line 122 of file Flagger.h.

casacore::Bool casa::Flagger::selectdata_p

Definition at line 126 of file Flagger.h.

casacore::Bool casa::Flagger::setdata_p

Definition at line 125 of file Flagger.h.

bool casa::Flagger::spw_selection

Definition at line 280 of file Flagger.h.

casacore::Vector<casacore::Double> casa::Flagger::spwfreqs

Definition at line 143 of file Flagger.h.

VisSet* casa::Flagger::vs_p

Definition at line 121 of file Flagger.h.

The documentation for this class was generated from the following file: