casa::RFFlagCube Class Reference

RFFlagCube: a cube of flags. More...

#include <RFFlagCube.h>

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

List of all members.

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

static LogIO default_sink
 default log sink

Private Member Functions

uInt num (StatEnums which)
 shortcut to RFChunkStats::num

Private Attributes

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

Static Private Attributes

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

Detailed Description

RFFlagCube: a cube of flags.

Intended use:

Internal

Prerequisite

Synopsis

RFFlagCube implements an [NCHAN,NIFR,NTIME] cube of flags, stored in a 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,
Bool  ignore = False,
Bool  reset = False,
LogIO &  os = default_sink 
)

constructor

casa::RFFlagCube::~RFFlagCube (  ) 

Member Function Documentation

void casa::RFFlagCube::advance ( uInt  it,
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().

Bool casa::RFFlagCube::anyFlagged ( uInt  ich,
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

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

Definition at line 307 of file RFFlagCube.h.

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

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

Referenced by clearFlag().

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

returns correlations mask for this agent

Definition at line 272 of file RFFlagCube.h.

References corrmask.

static 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 (  )  [inline, static]

returns mask of all correlations

Definition at line 280 of file RFFlagCube.h.

References full_corrmask.

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

Definition at line 310 of file RFFlagCube.h.

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

RFlagWord casa::RFFlagCube::getFlag ( uInt  ich,
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().

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

returns the current maximum memory usage

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

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

RFlagWord casa::RFFlagCube::getRowFlag ( uInt  ifr,
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().

String casa::RFFlagCube::getSummary (  ) 

returns summary of stats in text form

void casa::RFFlagCube::init ( RFlagWord  polmsk,
uInt  nAgent,
bool  is_selector,
const 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().

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

uInt casa::RFFlagCube::num ( StatEnums  which  )  [inline, private]

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 (  )  [inline, static]

returns the number of instances of the flag cube

Definition at line 354 of file RFFlagCube.h.

References num_inst.

Bool casa::RFFlagCube::preFlagged ( uInt  ich,
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

Bool casa::RFFlagCube::rowAgentFlagged ( uInt  ifr,
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.

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

preFlagged OR agentFlagged

Definition at line 348 of file RFFlagCube.h.

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

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

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

Definition at line 340 of file RFFlagCube.h.

References check_rowmask, and getRowFlag().

Bool casa::RFFlagCube::setFlag ( uInt  ich,
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().

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

sets or clears a flag at the given flag cursor

Referenced by setFlag().

static void casa::RFFlagCube::setMaxMem ( Int  maxmem  )  [static]

sets the maximum memory usage for the flag cube

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

transfers all flags from lattice into VisBuffer

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

Sets or clears a row flag.


Member Data Documentation

Int casa::RFFlagCube::agent_count [static, private]

<n> is the value of this variable

Definition at line 236 of file RFFlagCube.h.

Definition at line 237 of file RFFlagCube.h.

Definition at line 228 of file RFFlagCube.h.

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

RESET or IGNORE policy, or to corrmask for HONOR.

Definition at line 228 of file RFFlagCube.h.

Referenced by rowFlagged(), and rowPreFlagged().

Definition at line 202 of file RFFlagCube.h.

Referenced by num().

Vector<RFlagWord> casa::RFFlagCube::corr_flagmask [static, private]

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

Definition at line 242 of file RFFlagCube.h.

Definition at line 228 of file RFFlagCube.h.

Referenced by corrMask(), and getFlag().

default log sink

Definition at line 95 of file RFFlagCube.h.

Definition at line 251 of file RFFlagCube.h.

Definition at line 251 of file RFFlagCube.h.

Definition at line 214 of file RFFlagCube.h.

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

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

Definition at line 258 of file RFFlagCube.h.

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

Definition at line 215 of file RFFlagCube.h.

Referenced by getRowFlag().

Matrix<std::vector<bool> > casa::RFFlagCube::flagrow_kiss [static, private]

Definition at line 216 of file RFFlagCube.h.

Definition at line 237 of file RFFlagCube.h.

Referenced by fullCorrMask().

Cube<Bool> casa::RFFlagCube::in_flags [static, private]

Definition at line 207 of file RFFlagCube.h.

Referenced by getFlag().

bool casa::RFFlagCube::in_flags_flushed [static, private]

Definition at line 209 of file RFFlagCube.h.

int casa::RFFlagCube::in_flags_time [static, private]

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

Definition at line 205 of file RFFlagCube.h.

Definition at line 228 of file RFFlagCube.h.

Referenced by anyFlagged().

uInt casa::RFFlagCube::nchan [static, private]

Definition at line 221 of file RFFlagCube.h.

uInt casa::RFFlagCube::npol [static, private]

Definition at line 221 of file RFFlagCube.h.

Int casa::RFFlagCube::num_inst [static, private]

number of instances in use

Definition at line 261 of file RFFlagCube.h.

Referenced by numInstances().

LogIO casa::RFFlagCube::os [private]

log sink

Definition at line 245 of file RFFlagCube.h.

Referenced by logSink().

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

Definition at line 248 of file RFFlagCube.h.

Int casa::RFFlagCube::pos_get_flag [static, private]

Definition at line 217 of file RFFlagCube.h.

Int casa::RFFlagCube::pos_set_flag [static, private]

Definition at line 217 of file RFFlagCube.h.

Bool casa::RFFlagCube::reset_preflags [static, private]

Definition at line 219 of file RFFlagCube.h.

Definition at line 251 of file RFFlagCube.h.

Definition at line 251 of file RFFlagCube.h.

flagging stats for this instance

Definition at line 251 of file RFFlagCube.h.

Definition at line 251 of file RFFlagCube.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1