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 | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
casa::RFFlagCube Class Reference

RFFlagCube: a cube of flags. More...

#include <RFFlagCube.h>

Inheritance diagram for casa::RFFlagCube:
casa::FlaggerEnums

Public Member Functions

 RFFlagCube (RFChunkStats &ch, casacore::Bool ignore=false, casacore::Bool reset=false, casacore::LogIO &os=default_sink)
 constructor More...
 
 ~RFFlagCube ()
 
casacore::LogIOlogSink ()
 returns reference to logsink More...
 
void init (RFlagWord polmsk, casacore::uInt nAgent, bool is_selector, const casacore::String &name="")
 creates flag cube for current chunk. More...
 
void cleanup ()
 cleans up at end of chunk More...
 
casacore::String getSummary ()
 returns summary of stats in text form More...
 
void printStats ()
 prints flagging stats to stderr More...
 
void reset ()
 resets at start of pass More...
 
void advance (casacore::uInt it, casacore::Bool getFlags=false)
 advances global flag iterator to time slot it (if required), sets the flag cursor from the iterator (see below). More...
 
void getMSFlags (casacore::uInt it)
 fills global flag lattice with apriori flags from a VisBuffer (if required) More...
 
void setMSFlags (casacore::uInt itime)
 transfers all flags from lattice into VisBuffer More...
 
FlagCubeIterator newCustomIter ()
 creates a custom iterator More...
 
const FlagMatrixflagMatrix ()
 Returns full flag matrix (i.e. More...
 
casacore::Bool setFlag (casacore::uInt ich, casacore::uInt ifr, FlagCubeIterator &iter)
 sets or clears a flag at the given flag cursor More...
 
casacore::Bool clearFlag (casacore::uInt ich, casacore::uInt ifr, FlagCubeIterator &iter)
 
RFlagWord getFlag (casacore::uInt ich, casacore::uInt ifr, FlagCubeIterator &iter)
 Gets full flag word at the given flag cursor. More...
 
casacore::Bool setFlag (casacore::uInt ich, casacore::uInt ifr)
 Versions of above that use global flag cursor. More...
 
casacore::Bool clearFlag (casacore::uInt ich, casacore::uInt ifr)
 
RFlagWord getFlag (casacore::uInt ich, casacore::uInt ifr)
 
casacore::Bool preFlagged (casacore::uInt ich, casacore::uInt ifr)
 the preFlagged() function uses the corr-mask to tell if any of this agent's correlations are pre-flagged. More...
 
casacore::Bool anyFlagged (casacore::uInt ich, casacore::uInt ifr)
 The anyFlagged() uses the corr-flagmask to tell if any of my correlations are flagged either by any agent or pre-flagged Uses internal cursor. More...
 
casacore::Bool setRowFlag (casacore::uInt ifr, casacore::uInt itime)
 Sets or clears a row flag. More...
 
casacore::Bool clearRowFlag (casacore::uInt ifr, casacore::uInt itime)
 
RFlagWord getRowFlag (casacore::uInt ifr, casacore::uInt itime)
 Gets full row flag word. More...
 
casacore::Bool rowPreFlagged (casacore::uInt ifr, casacore::uInt itime)
 tells if a row is pre-flagged in the casacore::MS (or does not exist) More...
 
casacore::Bool rowAgentFlagged (casacore::uInt ifr, casacore::uInt itime)
 tells if a row is flagged by any agent More...
 
casacore::Bool rowFlagged (casacore::uInt ifr, casacore::uInt itime)
 preFlagged OR agentFlagged More...
 
FlagCubeIteratoriterator ()
 returns reference to internal iterator More...
 
RFlagWord flagMask ()
 returns flag mask for this agent More...
 
RFlagWord corrMask ()
 returns correlations mask for this agent More...
 
RFlagWord checkCorrMask ()
 returns the checked-correlations mask for this agent (=0 for RESET/IGNORE policies, or =corrMask() for HONOR policy). More...
 

Static Public Member Functions

static casacore::uInt estimateMemoryUse (const RFChunkStats &ch)
 returns estimated size of flag cube for a given chunk. More...
 
static RFlagWord fullCorrMask ()
 returns mask of all correlations More...
 
static casacore::Int numInstances ()
 returns the number of instances of the flag cube More...
 
static void setMaxMem (casacore::Int maxmem)
 sets the maximum memory usage for the flag cube More...
 
static int getMaxMem ()
 returns the current maximum memory usage More...
 

Static Public Attributes

static casacore::LogIO default_sink
 default log sink More...
 

Private Member Functions

casacore::uInt num (StatEnums which)
 shortcut to RFChunkStats::num More...
 

Private Attributes

RFChunkStatschunk
 
bool kiss
 
bool kiss_flagrow
 
RFlagWord flagmask
 Flag mask used by this instance. More...
 
RFlagWord corrmask
 
RFlagWord check_corrmask
 
RFlagWord check_rowmask
 RESET or IGNORE policy, or to corrmask for HONOR. More...
 
RFlagWord my_corrflagmask
 
unsigned long flagmask_kiss
 
casacore::LogIO os
 log sink More...
 
PreFlagPolicy pfpolicy
 pre-flag policy (can be set on a per-instance basis) More...
 
casacore::uInt tot_fl_raised
 flagging stats for this instance More...
 
casacore::uInt fl_raised
 
casacore::uInt fl_cleared
 
casacore::uInt tot_row_fl_raised
 
casacore::uInt row_fl_raised
 
casacore::uInt row_fl_cleared
 
FlagMatrixflag_curs
 local flag cursor used by this instance (setFlag and clearFlag). More...
 
casacore::uInt flag_itime
 

Static Private Attributes

static casacore::Cube
< casacore::Bool
in_flags
 
static int in_flags_time
 
static bool in_flags_flushed
 
static RFCubeLattice< RFlagWordflag
 
static FlagMatrix flagrow
 
static casacore::Matrix
< std::vector< bool > > 
flagrow_kiss
 
static casacore::Int pos_get_flag
 
static casacore::Int pos_set_flag
 
static casacore::Bool reset_preflags
 
static casacore::uInt npol
 
static casacore::uInt nchan
 
static casacore::Int agent_count
 <n> is the value of this variable More...
 
static RFlagWord base_flagmask
 
static RFlagWord full_corrmask
 
static casacore::Vector
< RFlagWord
corr_flagmask
 corr_flagmask is a mapping from corrmasks into masks of agents that flag the given corrmask More...
 
static casacore::Int num_inst
 number of instances in use 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

RFFlagCube: a cube of flags.

Intended use:

Internal

Prerequisite

Synopsis

RFFlagCube implements an [NCHAN,NIFR,NTIME] cube of flags, stored in a casacore::TempLattice that is iterated alog the TIME axis. One static (i.e. global) cube is used to hold the actual flags. Individual instances (instantiated by flagging agents) have individual unique bitmasks and, possibly, individual iterators.

It was/is a design mistake to use a global/static buffer to hold the shared flags. Instead, every agent should point to the unique dynamically allocated buffer.

Example

Motivation

To Do

Definition at line 91 of file RFFlagCube.h.

Constructor & Destructor Documentation

casa::RFFlagCube::RFFlagCube ( RFChunkStats ch,
casacore::Bool  ignore = false,
casacore::Bool  reset = false,
casacore::LogIO os = default_sink 
)

constructor

casa::RFFlagCube::~RFFlagCube ( )

Member Function Documentation

void casa::RFFlagCube::advance ( casacore::uInt  it,
casacore::Bool  getFlags = false 
)

advances global flag iterator to time slot it (if required), sets the flag cursor from the iterator (see below).

If getflags is true, also calls getDataFlags().

casacore::Bool casa::RFFlagCube::anyFlagged ( casacore::uInt  ich,
casacore::uInt  ifr 
)
inline

The anyFlagged() uses the corr-flagmask to tell if any of my correlations are flagged either by any agent or pre-flagged Uses internal cursor.

Definition at line 322 of file RFFlagCube.h.

References check_corrmask, getFlag(), kiss, and my_corrflagmask.

RFlagWord casa::RFFlagCube::checkCorrMask ( )
inline

returns the checked-correlations mask for this agent (=0 for RESET/IGNORE policies, or =corrMask() for HONOR policy).

Definition at line 277 of file RFFlagCube.h.

References check_corrmask.

void casa::RFFlagCube::cleanup ( )

cleans up at end of chunk

casacore::Bool casa::RFFlagCube::clearFlag ( casacore::uInt  ich,
casacore::uInt  ifr,
FlagCubeIterator iter 
)

Referenced by clearFlag().

casacore::Bool casa::RFFlagCube::clearFlag ( casacore::uInt  ich,
casacore::uInt  ifr 
)
inline

Definition at line 307 of file RFFlagCube.h.

References clearFlag(), flag, and casa::RFCubeLattice< T >::iterator().

casacore::Bool casa::RFFlagCube::clearRowFlag ( casacore::uInt  ifr,
casacore::uInt  itime 
)
RFlagWord casa::RFFlagCube::corrMask ( )
inline

returns correlations mask for this agent

Definition at line 272 of file RFFlagCube.h.

References corrmask.

static casacore::uInt casa::RFFlagCube::estimateMemoryUse ( const RFChunkStats ch)
static

returns estimated size of flag cube for a given chunk.

RFlagWord casa::RFFlagCube::flagMask ( )
inline

returns flag mask for this agent

Definition at line 264 of file RFFlagCube.h.

References flagmask, and kiss.

const FlagMatrix & casa::RFFlagCube::flagMatrix ( )
inline

Returns full flag matrix (i.e.

cursor of global iterator)

Definition at line 316 of file RFFlagCube.h.

References flag_curs.

RFlagWord casa::RFFlagCube::fullCorrMask ( )
inlinestatic

returns mask of all correlations

Definition at line 280 of file RFFlagCube.h.

References full_corrmask.

RFlagWord casa::RFFlagCube::getFlag ( casacore::uInt  ich,
casacore::uInt  ifr,
FlagCubeIterator iter 
)
inline

Gets full flag word at the given flag cursor.

Definition at line 283 of file RFFlagCube.h.

References casacore::C::c, casa::FlaggerEnums::CORR, corrmask, in_flags, kiss, and num().

Referenced by anyFlagged(), getFlag(), and preFlagged().

RFlagWord casa::RFFlagCube::getFlag ( casacore::uInt  ich,
casacore::uInt  ifr 
)
inline

Definition at line 310 of file RFFlagCube.h.

References flag, getFlag(), and casa::RFCubeLattice< T >::iterator().

static int casa::RFFlagCube::getMaxMem ( )
static

returns the current maximum memory usage

void casa::RFFlagCube::getMSFlags ( casacore::uInt  it)

fills global flag lattice with apriori flags from a VisBuffer (if required)

RFlagWord casa::RFFlagCube::getRowFlag ( casacore::uInt  ifr,
casacore::uInt  itime 
)
inline

Gets full row flag word.

Definition at line 331 of file RFFlagCube.h.

References flagrow, and kiss.

Referenced by rowAgentFlagged(), rowFlagged(), and rowPreFlagged().

casacore::String casa::RFFlagCube::getSummary ( )

returns summary of stats in text form

void casa::RFFlagCube::init ( RFlagWord  polmsk,
casacore::uInt  nAgent,
bool  is_selector,
const casacore::String name = "" 
)

creates flag cube for current chunk.

name is name of agent. nAgent is total number of agents

FlagCubeIterator & casa::RFFlagCube::iterator ( )
inline

returns reference to internal iterator

Definition at line 351 of file RFFlagCube.h.

References flag, and casa::RFCubeLattice< T >::iterator().

casacore::LogIO & casa::RFFlagCube::logSink ( )
inline

returns reference to logsink

Definition at line 357 of file RFFlagCube.h.

References os.

FlagCubeIterator casa::RFFlagCube::newCustomIter ( )
inline

creates a custom iterator

Definition at line 313 of file RFFlagCube.h.

References flag, and casa::RFCubeLattice< T >::newIter().

casacore::uInt casa::RFFlagCube::num ( StatEnums  which)
inlineprivate

shortcut to RFChunkStats::num

Definition at line 212 of file RFFlagCube.h.

References chunk, and casa::RFChunkStats::num().

Referenced by getFlag().

int casa::RFFlagCube::numInstances ( )
inlinestatic

returns the number of instances of the flag cube

Definition at line 354 of file RFFlagCube.h.

References num_inst.

casacore::Bool casa::RFFlagCube::preFlagged ( casacore::uInt  ich,
casacore::uInt  ifr 
)
inline

the preFlagged() function uses the corr-mask to tell if any of this agent's correlations are pre-flagged.

Uses internal cursor.

Definition at line 319 of file RFFlagCube.h.

References check_corrmask, and getFlag().

void casa::RFFlagCube::printStats ( )

prints flagging stats to stderr

void casa::RFFlagCube::reset ( )

resets at start of pass

casacore::Bool casa::RFFlagCube::rowAgentFlagged ( casacore::uInt  ifr,
casacore::uInt  itime 
)
inline

tells if a row is flagged by any agent

Definition at line 344 of file RFFlagCube.h.

References getRowFlag(), casa::RowAbsent, and casa::RowFlagged.

casacore::Bool casa::RFFlagCube::rowFlagged ( casacore::uInt  ifr,
casacore::uInt  itime 
)
inline

preFlagged OR agentFlagged

Definition at line 348 of file RFFlagCube.h.

References check_rowmask, getRowFlag(), and casa::RowFlagged.

casacore::Bool casa::RFFlagCube::rowPreFlagged ( casacore::uInt  ifr,
casacore::uInt  itime 
)
inline

tells if a row is pre-flagged in the casacore::MS (or does not exist)

Definition at line 340 of file RFFlagCube.h.

References check_rowmask, and getRowFlag().

casacore::Bool casa::RFFlagCube::setFlag ( casacore::uInt  ich,
casacore::uInt  ifr,
FlagCubeIterator iter 
)

sets or clears a flag at the given flag cursor

Referenced by setFlag().

casacore::Bool casa::RFFlagCube::setFlag ( casacore::uInt  ich,
casacore::uInt  ifr 
)
inline

Versions of above that use global flag cursor.

Definition at line 304 of file RFFlagCube.h.

References flag, casa::RFCubeLattice< T >::iterator(), and setFlag().

static void casa::RFFlagCube::setMaxMem ( casacore::Int  maxmem)
static

sets the maximum memory usage for the flag cube

void casa::RFFlagCube::setMSFlags ( casacore::uInt  itime)

transfers all flags from lattice into VisBuffer

casacore::Bool casa::RFFlagCube::setRowFlag ( casacore::uInt  ifr,
casacore::uInt  itime 
)

Sets or clears a row flag.

Member Data Documentation

casacore::Int casa::RFFlagCube::agent_count
staticprivate

<n> is the value of this variable

Definition at line 236 of file RFFlagCube.h.

RFlagWord casa::RFFlagCube::base_flagmask
staticprivate

Definition at line 237 of file RFFlagCube.h.

RFlagWord casa::RFFlagCube::check_corrmask
private

Definition at line 228 of file RFFlagCube.h.

Referenced by anyFlagged(), checkCorrMask(), and preFlagged().

RFlagWord casa::RFFlagCube::check_rowmask
private

RESET or IGNORE policy, or to corrmask for HONOR.

Definition at line 228 of file RFFlagCube.h.

Referenced by rowFlagged(), and rowPreFlagged().

RFChunkStats& casa::RFFlagCube::chunk
private

Definition at line 202 of file RFFlagCube.h.

Referenced by num().

casacore::Vector<RFlagWord> casa::RFFlagCube::corr_flagmask
staticprivate

corr_flagmask is a mapping from corrmasks into masks of agents that flag the given corrmask

Definition at line 242 of file RFFlagCube.h.

RFlagWord casa::RFFlagCube::corrmask
private

Definition at line 228 of file RFFlagCube.h.

Referenced by corrMask(), and getFlag().

casacore::LogIO casa::RFFlagCube::default_sink
static

default log sink

Definition at line 95 of file RFFlagCube.h.

casacore::uInt casa::RFFlagCube::fl_cleared
private

Definition at line 251 of file RFFlagCube.h.

casacore::uInt casa::RFFlagCube::fl_raised
private

Definition at line 251 of file RFFlagCube.h.

RFCubeLattice<RFlagWord> casa::RFFlagCube::flag
staticprivate

Definition at line 214 of file RFFlagCube.h.

Referenced by clearFlag(), getFlag(), iterator(), newCustomIter(), and setFlag().

FlagMatrix* casa::RFFlagCube::flag_curs
private

local flag cursor used by this instance (setFlag and clearFlag).

Normally, set to flag.cursor() in advance(), but can be overridden by setFlagCursor();

Definition at line 257 of file RFFlagCube.h.

Referenced by flagMatrix().

casacore::uInt casa::RFFlagCube::flag_itime
private

Definition at line 258 of file RFFlagCube.h.

RFlagWord casa::RFFlagCube::flagmask
private

Flag mask used by this instance.

Each instance has a unique 1-bit mask. This is assigned automatically in the constructor, by updating the instance count and the nextmask member. Note that the low N bits of a mask are assigned to pre-flags (one per each correlation in the casacore::MS); so the agents start at bit N+1.

Definition at line 228 of file RFFlagCube.h.

Referenced by flagMask().

unsigned long casa::RFFlagCube::flagmask_kiss
private

Definition at line 234 of file RFFlagCube.h.

FlagMatrix casa::RFFlagCube::flagrow
staticprivate

Definition at line 215 of file RFFlagCube.h.

Referenced by getRowFlag().

casacore::Matrix<std::vector<bool> > casa::RFFlagCube::flagrow_kiss
staticprivate

Definition at line 216 of file RFFlagCube.h.

RFlagWord casa::RFFlagCube::full_corrmask
staticprivate

Definition at line 237 of file RFFlagCube.h.

Referenced by fullCorrMask().

casacore::Cube<casacore::Bool> casa::RFFlagCube::in_flags
staticprivate

Definition at line 207 of file RFFlagCube.h.

Referenced by getFlag().

bool casa::RFFlagCube::in_flags_flushed
staticprivate

Definition at line 209 of file RFFlagCube.h.

int casa::RFFlagCube::in_flags_time
staticprivate

Definition at line 208 of file RFFlagCube.h.

bool casa::RFFlagCube::kiss
private

Definition at line 204 of file RFFlagCube.h.

Referenced by anyFlagged(), flagMask(), getFlag(), and getRowFlag().

bool casa::RFFlagCube::kiss_flagrow
private

Definition at line 205 of file RFFlagCube.h.

RFlagWord casa::RFFlagCube::my_corrflagmask
private

Definition at line 228 of file RFFlagCube.h.

Referenced by anyFlagged().

casacore::uInt casa::RFFlagCube::nchan
staticprivate

Definition at line 221 of file RFFlagCube.h.

casacore::uInt casa::RFFlagCube::npol
staticprivate

Definition at line 221 of file RFFlagCube.h.

casacore::Int casa::RFFlagCube::num_inst
staticprivate

number of instances in use

Definition at line 261 of file RFFlagCube.h.

Referenced by numInstances().

casacore::LogIO casa::RFFlagCube::os
private

log sink

Definition at line 245 of file RFFlagCube.h.

Referenced by logSink().

PreFlagPolicy casa::RFFlagCube::pfpolicy
private

pre-flag policy (can be set on a per-instance basis)

Definition at line 248 of file RFFlagCube.h.

casacore::Int casa::RFFlagCube::pos_get_flag
staticprivate

Definition at line 217 of file RFFlagCube.h.

casacore::Int casa::RFFlagCube::pos_set_flag
staticprivate

Definition at line 217 of file RFFlagCube.h.

casacore::Bool casa::RFFlagCube::reset_preflags
staticprivate

Definition at line 219 of file RFFlagCube.h.

casacore::uInt casa::RFFlagCube::row_fl_cleared
private

Definition at line 251 of file RFFlagCube.h.

casacore::uInt casa::RFFlagCube::row_fl_raised
private

Definition at line 251 of file RFFlagCube.h.

casacore::uInt casa::RFFlagCube::tot_fl_raised
private

flagging stats for this instance

Definition at line 251 of file RFFlagCube.h.

casacore::uInt casa::RFFlagCube::tot_row_fl_raised
private

Definition at line 251 of file RFFlagCube.h.


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