casa
$Rev:20696$
|
RFFlagCube: a cube of flags. More...
#include <RFFlagCube.h>
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 FlagMatrix & | flagMatrix () |
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 | |
FlagCubeIterator & | iterator () |
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 | |
RFChunkStats & | chunk |
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 |
FlagMatrix * | flag_curs |
local flag cursor used by this instance (setFlag and clearFlag). | |
uInt | flag_itime |
Static Private Attributes | |
static Cube< Bool > | in_flags |
more than 32 (or so) agents | |
static int | in_flags_time |
static bool | in_flags_flushed |
static RFCubeLattice< RFlagWord > | flag |
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< RFlagWord > | corr_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 |
RFFlagCube: a cube of flags.
Internal
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.
Definition at line 92 of file RFFlagCube.h.
casa::RFFlagCube::RFFlagCube | ( | RFChunkStats & | ch, |
Bool | ignore = False , |
||
Bool | reset = False , |
||
LogIO & | os = default_sink |
||
) |
constructor
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.
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 279 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, | ||
FlagCubeIterator & | iter | ||
) |
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().
Bool casa::RFFlagCube::clearRowFlag | ( | uInt | ifr, |
uInt | itime | ||
) |
RFlagWord casa::RFFlagCube::corrMask | ( | ) | [inline] |
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.
RFlagWord casa::RFFlagCube::flagMask | ( | ) | [inline] |
returns flag mask for this agent
Definition at line 266 of file RFFlagCube.h.
const FlagMatrix & casa::RFFlagCube::flagMatrix | ( | ) | [inline] |
Returns full flag matrix (i.e.
cursor of global iterator)
Definition at line 318 of file RFFlagCube.h.
References flag_curs.
RFlagWord casa::RFFlagCube::fullCorrMask | ( | ) | [inline, static] |
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
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 333 of file RFFlagCube.h.
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
FlagCubeIterator & casa::RFFlagCube::iterator | ( | ) | [inline] |
returns reference to internal iterator
Definition at line 353 of file RFFlagCube.h.
References flag, and casa::RFCubeLattice< T >::iterator().
LogIO & casa::RFFlagCube::logSink | ( | ) | [inline] |
FlagCubeIterator casa::RFFlagCube::newCustomIter | ( | ) | [inline] |
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().
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 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().
Bool casa::RFFlagCube::setFlag | ( | uInt | ich, |
uInt | ifr, | ||
FlagCubeIterator & | iter | ||
) |
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
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.
Int casa::RFFlagCube::agent_count [static, private] |
<n> is the value of this variable
Definition at line 238 of file RFFlagCube.h.
RFlagWord casa::RFFlagCube::base_flagmask [static, private] |
Definition at line 239 of file RFFlagCube.h.
RFlagWord casa::RFFlagCube::check_corrmask [private] |
Definition at line 230 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 230 of file RFFlagCube.h.
Referenced by rowFlagged(), and rowPreFlagged().
RFChunkStats& casa::RFFlagCube::chunk [private] |
Definition at line 203 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 244 of file RFFlagCube.h.
RFlagWord casa::RFFlagCube::corrmask [private] |
Definition at line 230 of file RFFlagCube.h.
Referenced by corrMask(), and getFlag().
LogIO casa::RFFlagCube::default_sink [static] |
default log sink
Definition at line 96 of file RFFlagCube.h.
uInt casa::RFFlagCube::fl_cleared [private] |
Definition at line 253 of file RFFlagCube.h.
uInt casa::RFFlagCube::fl_raised [private] |
Definition at line 253 of file RFFlagCube.h.
RFCubeLattice<RFlagWord> casa::RFFlagCube::flag [static, private] |
Definition at line 216 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 259 of file RFFlagCube.h.
Referenced by flagMatrix().
uInt casa::RFFlagCube::flag_itime [private] |
Definition at line 260 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 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.
FlagMatrix casa::RFFlagCube::flagrow [static, private] |
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.
RFlagWord casa::RFFlagCube::full_corrmask [static, private] |
Definition at line 239 of file RFFlagCube.h.
Referenced by fullCorrMask().
Cube<Bool> casa::RFFlagCube::in_flags [static, private] |
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().
bool casa::RFFlagCube::kiss_flagrow [private] |
Definition at line 206 of file RFFlagCube.h.
RFlagWord casa::RFFlagCube::my_corrflagmask [private] |
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().
LogIO casa::RFFlagCube::os [private] |
PreFlagPolicy casa::RFFlagCube::pfpolicy [private] |
pre-flag policy (can be set on a per-instance basis)
Definition at line 250 of file RFFlagCube.h.
Int casa::RFFlagCube::pos_get_flag [static, private] |
Definition at line 219 of file RFFlagCube.h.
Int casa::RFFlagCube::pos_set_flag [static, private] |
Definition at line 219 of file RFFlagCube.h.
Bool casa::RFFlagCube::reset_preflags [static, private] |
Definition at line 221 of file RFFlagCube.h.
uInt casa::RFFlagCube::row_fl_cleared [private] |
Definition at line 253 of file RFFlagCube.h.
uInt casa::RFFlagCube::row_fl_raised [private] |
Definition at line 253 of file RFFlagCube.h.
uInt casa::RFFlagCube::tot_fl_raised [private] |
flagging stats for this instance
Definition at line 253 of file RFFlagCube.h.
uInt casa::RFFlagCube::tot_row_fl_raised [private] |
Definition at line 253 of file RFFlagCube.h.