casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
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 ()
LogIOlogSink ()
 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< Boolin_flags
 more than 32 (or so) agents
static int in_flags_time
static bool in_flags_flushed
static RFCubeLattice< RFlagWordflag
static FlagMatrix flagrow
static Matrix
< boost::dynamic_bitset<> > 
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 92 of file RFFlagCube.h.


Constructor & Destructor Documentation

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

constructor


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 324 of file RFFlagCube.h.

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

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

Definition at line 279 of file RFFlagCube.h.

References check_corrmask.

cleans up at end of chunk

Referenced by clearFlag().

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

Definition at line 309 of file RFFlagCube.h.

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

returns correlations mask for this agent

Definition at line 274 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.

returns flag mask for this agent

Definition at line 266 of file RFFlagCube.h.

References flagmask, and kiss.

Returns full flag matrix (i.e.

cursor of global iterator)

Definition at line 318 of file RFFlagCube.h.

References flag_curs.

returns mask of all correlations

Definition at line 282 of file RFFlagCube.h.

References full_corrmask.

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

Gets full flag word at the given flag cursor.

Definition at line 285 of file RFFlagCube.h.

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

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

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

Definition at line 312 of file RFFlagCube.h.

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

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

returns the current maximum memory usage

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 333 of file RFFlagCube.h.

References flagrow, and kiss.

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

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

returns reference to internal iterator

Definition at line 353 of file RFFlagCube.h.

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

returns reference to logsink

Definition at line 359 of file RFFlagCube.h.

References os.

creates a custom iterator

Definition at line 315 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 214 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 356 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 321 of file RFFlagCube.h.

References check_corrmask, and getFlag().

prints flagging stats to stderr

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 346 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 350 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 342 of file RFFlagCube.h.

References check_rowmask, and getRowFlag().

sets or clears a flag at the given flag cursor

Referenced by setFlag().

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

Versions of above that use global flag cursor.

Definition at line 306 of file RFFlagCube.h.

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

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

sets the maximum memory usage for the flag cube

transfers all flags from lattice into VisBuffer

Sets or clears a row flag.


Member Data Documentation

<n> is the value of this variable

Definition at line 238 of file RFFlagCube.h.

Definition at line 239 of file RFFlagCube.h.

Definition at line 230 of file RFFlagCube.h.

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

RESET or IGNORE policy, or to corrmask for HONOR.

Definition at line 230 of file RFFlagCube.h.

Referenced by rowFlagged(), and rowPreFlagged().

Definition at line 203 of file RFFlagCube.h.

Referenced by num().

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

Definition at line 244 of file RFFlagCube.h.

Definition at line 230 of file RFFlagCube.h.

Referenced by corrMask(), and getFlag().

default log sink

Definition at line 96 of file RFFlagCube.h.

Definition at line 253 of file RFFlagCube.h.

Definition at line 253 of file RFFlagCube.h.

Definition at line 216 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 259 of file RFFlagCube.h.

Referenced by flagMatrix().

Definition at line 260 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 230 of file RFFlagCube.h.

Referenced by flagMask().

unsigned long casa::RFFlagCube::flagmask_kiss [private]

Definition at line 236 of file RFFlagCube.h.

Definition at line 217 of file RFFlagCube.h.

Referenced by getRowFlag().

Matrix<boost::dynamic_bitset<> > casa::RFFlagCube::flagrow_kiss [static, private]

Definition at line 218 of file RFFlagCube.h.

Definition at line 239 of file RFFlagCube.h.

Referenced by fullCorrMask().

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

more than 32 (or so) agents

Definition at line 209 of file RFFlagCube.h.

Referenced by getFlag().

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

Definition at line 211 of file RFFlagCube.h.

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

Definition at line 210 of file RFFlagCube.h.

bool casa::RFFlagCube::kiss [private]

Definition at line 205 of file RFFlagCube.h.

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

Definition at line 206 of file RFFlagCube.h.

Definition at line 230 of file RFFlagCube.h.

Referenced by anyFlagged().

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

Definition at line 223 of file RFFlagCube.h.

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

Definition at line 223 of file RFFlagCube.h.

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

number of instances in use

Definition at line 263 of file RFFlagCube.h.

Referenced by numInstances().

log sink

Definition at line 247 of file RFFlagCube.h.

Referenced by logSink().

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

Definition at line 250 of file RFFlagCube.h.

Definition at line 219 of file RFFlagCube.h.

Definition at line 219 of file RFFlagCube.h.

Definition at line 221 of file RFFlagCube.h.

Definition at line 253 of file RFFlagCube.h.

Definition at line 253 of file RFFlagCube.h.

flagging stats for this instance

Definition at line 253 of file RFFlagCube.h.

Definition at line 253 of file RFFlagCube.h.


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