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:
casa::FlaggerEnums

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
casacore::RecordInterface
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 > > 
acc
 
casacore::MeasurementSetmssel_p
 new added More...
 
VisSetvs_p
 
bool scan_looping
 
casacore::String msname_p
 
casacore::Bool nullSelect_p
 
casacore::Bool setdata_p
 
casacore::Bool selectdata_p
 
casacore::String dataMode_p
 
casacore::Vector
< casacore::String
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; 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::Vector
< casacore::String
antnames
 
casacore::Vector
< casacore::Double
spwfreqs
 
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...
 
casacore::MeasurementSetoriginalms_p
 Hold the original ms. More...
 
casacore::MSSelectionmsselection_p
 casacore::MS Selection More...
 
bool spw_selection
 
casacore::Recordagents_p
 casacore::List of Agents More...
 
casacore::Int agentCount_p
 
casacore::Recordopts_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 {
  POLZN,
  POL,
  CORR,
  CHAN,
  IFR,
  TIME,
  ROW,
  ANT,
  FEED,
  FEEDCORR,
  NONE,
  Num_StatEnums
}
 
enum  PreFlagPolicy {
  FL_HONOR,
  FL_IGNORE,
  FL_RESET
}
 

Detailed Description

Flagger: high-performance automated flagging.

Intended use:

Prerequisite

Etymology

casacore::MSFlagger and plain flagger were already taken.

Synopsis

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.

Example

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 flagger.run(agents,opt);

Motivation

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 )
inlineprivate

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
inline

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 
)
protected

creates an agent by name

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

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 ( )
static

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 ( )
inlinestatic

returns the log sink

Definition at line 257 of file Flagger.h.

References os.

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

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)
static
casacore::uInt casa::Flagger::numAnt ( ) const
inline

number of antennas in MS

Definition at line 221 of file Flagger.h.

References nant.

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

number of feeds in MS

Definition at line 229 of file Flagger.h.

References nfeed.

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

number of feed correlations in MS

Definition at line 233 of file Flagger.h.

References nfeedcorr.

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

number of IFRs in MS

Definition at line 225 of file Flagger.h.

References nifr.

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

Definition at line 268 of file Flagger.h.

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

print flagging reports from individual agents

casacore::Bool casa::Flagger::printflagselections ( )
void casa::Flagger::printSummaryReport ( RFChunkStats chunk)
protected
static void casa::Flagger::reform_baselinelist ( casacore::Matrix< casacore::Int > &  baselinelist,
unsigned  nant 
)
static
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 ( )
protected
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 ( )
protected

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
protected

Definition at line 117 of file Flagger.h.

casacore::Record casa::Flagger::agent_defaults
protected

Definition at line 145 of file Flagger.h.

Referenced by defaultAgents().

casacore::Int casa::Flagger::agentCount_p
private

Definition at line 284 of file Flagger.h.

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

casacore::List of Agents

Definition at line 283 of file Flagger.h.

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

Definition at line 142 of file Flagger.h.

Referenced by antNames().

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

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
protected

Definition at line 135 of file Flagger.h.

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

Definition at line 134 of file Flagger.h.

casacore::String casa::Flagger::dataMode_p
protected

Definition at line 127 of file Flagger.h.

const bool casa::Flagger::dbg
staticprivate

Debug Message flag.

Definition at line 290 of file Flagger.h.

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

Definition at line 141 of file Flagger.h.

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

Definition at line 141 of file Flagger.h.

casacore::LogSink casa::Flagger::logSink_p
private

Sink used to store history.

Definition at line 273 of file Flagger.h.

casacore::MRadialVelocity casa::Flagger::mDataStart_p
protected

Definition at line 136 of file Flagger.h.

casacore::MRadialVelocity casa::Flagger::mDataStep_p
protected

Definition at line 137 of file Flagger.h.

casacore::MeasurementSet casa::Flagger::ms
protected

Definition at line 115 of file Flagger.h.

Referenced by measSet().

casacore::String casa::Flagger::msname_p
protected

Definition at line 123 of file Flagger.h.

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

new added

Definition at line 120 of file Flagger.h.

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

casacore::MS Selection

Definition at line 279 of file Flagger.h.

casacore::uInt casa::Flagger::nant
protected

Definition at line 140 of file Flagger.h.

Referenced by numAnt().

casacore::uInt casa::Flagger::nfeed
protected

Definition at line 140 of file Flagger.h.

Referenced by numFeed().

casacore::uInt casa::Flagger::nfeedcorr
protected

Definition at line 140 of file Flagger.h.

Referenced by numFeedCorr().

casacore::uInt casa::Flagger::nifr
protected

Definition at line 140 of file Flagger.h.

Referenced by numIfr().

casacore::Bool casa::Flagger::nullSelect_p
protected

Definition at line 124 of file Flagger.h.

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

casacore::List of extra options

Definition at line 287 of file Flagger.h.

casacore::MeasurementSet casa::Flagger::originalms
protected

Definition at line 116 of file Flagger.h.

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

Hold the original ms.

Definition at line 276 of file Flagger.h.

casacore::LogIO casa::Flagger::os
staticprotected

Definition at line 147 of file Flagger.h.

Referenced by logSink().

casacore::Bool casa::Flagger::quack_agent_exists
private

Definition at line 292 of file Flagger.h.

bool casa::Flagger::scan_looping
protected

Definition at line 122 of file Flagger.h.

casacore::Bool casa::Flagger::selectdata_p
protected

Definition at line 126 of file Flagger.h.

casacore::Bool casa::Flagger::setdata_p
protected

Definition at line 125 of file Flagger.h.

bool casa::Flagger::spw_selection
private

Definition at line 280 of file Flagger.h.

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

Definition at line 143 of file Flagger.h.

VisSet* casa::Flagger::vs_p
protected

Definition at line 121 of file Flagger.h.


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