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

#include <VisChunkAverager.h>

Public Member Functions

 VisChunkAverager (const casacore::Vector< casacore::MS::PredefinedColumns > &dataCols, const casacore::Bool doSpWeight, const casacore::Vector< casacore::Matrix< casacore::Int > > &chBounds=casacore::Vector< casacore::Matrix< casacore::Int > >())
 Construct from which *DATA column(s) to read and whether or not to use WEIGHT_SPECTRUM. More...
 
 ~VisChunkAverager ()
 Null destructor. More...
 
void reset ()
 Reset the averager. More...
 
VisBufferaverage (ROVisibilityIterator &vi)
 casacore::Time average vi's current chunk, AND advance vi to the end of that chunk. More...
 
casacore::uInt uIntMax (const casacore::uInt a, const casacore::uInt b) const
 max(a, b) in Math.h is so overloaded, and (u)casacore::Int is so promotable, that they're unusable together. More...
 

Static Public Member Functions

static casacore::Bool check_chunk (ROVisibilityIterator &vi, casacore::Double &time_to_break, const casacore::Bool watch_obs, const casacore::Bool watch_scan, const casacore::Bool watch_state)
 Checks whether the interval of vi needs to be truncated in order to prevent collisions where two rows have the same casacore::MS key (ignoring TIME) but different SCAN_NUMBER, STATE_ID, and/or OBSERVATION_ID. More...
 

Private Member Functions

 VisChunkAverager ()
 Prohibit null constructor, copy constructor and assignment for now. More...
 
VisChunkAverageroperator= (const VisChunkAverager &)
 
 VisChunkAverager (const VisChunkAverager &)
 
void initialize (VisBuffer &vb)
 Initialize the next accumulation interval. More...
 
void normalize (const casacore::Double minTime, const casacore::Double maxTime, const casacore::Double firstinterval, const casacore::Double lastinterval)
 Normalize the accumulation (finish the average). More...
 
void fill_vb (VisBuffer &vb)
 Force vb to read all the columns (modified by colEnums_p and doSpWeight_p). More...
 
casacore::uInt hashFunction (const casacore::Int ant1, const casacore::Int ant2, const casacore::Int feed1, const casacore::Int feed2, const casacore::Int procid) const
 Hash function to return a unique (within the VisBuffer) key (as defined by the casacore::MS def'n) for an interferometer (ant1, ant2, feed1, feed2, processor_id). More...
 
casacore::Bool setupHashFunction (ROVisibilityIterator &vi)
 These return their success values. More...
 
casacore::Bool makeHashMap (ROVisibilityIterator &vi)
 
casacore::Bool findCollision (ROVisibilityIterator &vi, casacore::Double &time_to_break, const casacore::Bool watchObs, const casacore::Bool watchScan, const casacore::Bool watchState)
 Check whether any of the unflagged rows in vi's current chunk have the same casacore::MS key (not counting TIME) but different values for the columns in colsToWatch. More...
 
casacore::Bool checkForBreak (casacore::Vector< casacore::Int > &firstVals, const casacore::Int i, const casacore::uInt slotnum, const casacore::uInt chunkletNum, const std::vector< casacore::Int > &inrows_for_slot) const
 Helper function for findCollision(). More...
 

Private Attributes

casacore::Vector
< casacore::MS::PredefinedColumns
colEnums_p
 Start of initialization list. More...
 
casacore::Bool doSpWeight_p
 Use WEIGHT_SPECTRUM? More...
 
casacore::Vector
< casacore::Matrix
< casacore::Int > > 
chanAveBounds_p
 Used for both selecting and averaging channels. More...
 
casacore::Bool readyToHash_p
 End of initialization list. More...
 
casacore::Bool haveHashMap_p
 Is sphash_to_inprows_p OK? More...
 
casacore::uInt maxant1p1_p
 Maxima for hashFunction(). More...
 
casacore::uInt maxant2p1_p
 
casacore::uInt maxfeed1p1_p
 
casacore::uInt maxfeed2p1_p
 
mapuIvIType sphash_to_inprows_p
 casacore::uInt maxprocp1_p; Not needed More...
 
casacore::Int nCorr_p
 Number of correlations and channels. More...
 
casacore::Int nChan_p
 
casacore::Int nCat_p
 The number of flag categories. More...
 
CalVisBuffer avBuf_p
 Averaging buffer. More...
 

Detailed Description

Definition at line 89 of file VisChunkAverager.h.

Constructor & Destructor Documentation

casa::VisChunkAverager::VisChunkAverager ( const casacore::Vector< casacore::MS::PredefinedColumns > &  dataCols,
const casacore::Bool  doSpWeight,
const casacore::Vector< casacore::Matrix< casacore::Int > > &  chBounds = casacore::Vectorcasacore::Matrixcasacore::Int > >() 
)

Construct from which *DATA column(s) to read and whether or not to use WEIGHT_SPECTRUM.

casa::VisChunkAverager::~VisChunkAverager ( )

Null destructor.

casa::VisChunkAverager::VisChunkAverager ( )
private

Prohibit null constructor, copy constructor and assignment for now.

casa::VisChunkAverager::VisChunkAverager ( const VisChunkAverager )
private

Member Function Documentation

VisBuffer& casa::VisChunkAverager::average ( ROVisibilityIterator vi)

casacore::Time average vi's current chunk, AND advance vi to the end of that chunk.

casacore::Input: vi ROVisibilityIterator vi.setRowBlocking(0) will be called to ensure that ++vi advances by 1 integration at a time. Output from private data: avBuf_p CalVisBuffer Output buffer for the averaged "integration".

static casacore::Bool casa::VisChunkAverager::check_chunk ( ROVisibilityIterator vi,
casacore::Double time_to_break,
const casacore::Bool  watch_obs,
const casacore::Bool  watch_scan,
const casacore::Bool  watch_state 
)
static

Checks whether the interval of vi needs to be truncated in order to prevent collisions where two rows have the same casacore::MS key (ignoring TIME) but different SCAN_NUMBER, STATE_ID, and/or OBSERVATION_ID.

ARRAY_ID is already separated by the chunking.

time_to_break is set to the TIME of the earliest collision, or the end of the buffer if none are found.

casacore::Bool casa::VisChunkAverager::checkForBreak ( casacore::Vector< casacore::Int > &  firstVals,
const casacore::Int  i,
const casacore::uInt  slotnum,
const casacore::uInt  chunkletNum,
const std::vector< casacore::Int > &  inrows_for_slot 
) const
private

Helper function for findCollision().

void casa::VisChunkAverager::fill_vb ( VisBuffer vb)
private

Force vb to read all the columns (modified by colEnums_p and doSpWeight_p).

Sets readyToHash_p to false.

casacore::Bool casa::VisChunkAverager::findCollision ( ROVisibilityIterator vi,
casacore::Double time_to_break,
const casacore::Bool  watchObs,
const casacore::Bool  watchScan,
const casacore::Bool  watchState 
)
private

Check whether any of the unflagged rows in vi's current chunk have the same casacore::MS key (not counting TIME) but different values for the columns in colsToWatch.

time_to_break will be set to the time of the earliest collision if any are found, or the last TIME in vi's current chunk otherwise (assumes vi's current chunk is ascendingly sorted in TIME).

colsToWatch should contain casacore::MS::SCAN_NUMBER, casacore::MS::STATE_ID, casacore::MS::OBSERVATION_ID, and/or nothing. Otherwise an casacore::AipsError will be thrown. casacore::MS::ARRAY_ID is already separated by the chunking.

casacore::uInt casa::VisChunkAverager::hashFunction ( const casacore::Int  ant1,
const casacore::Int  ant2,
const casacore::Int  feed1,
const casacore::Int  feed2,
const casacore::Int  procid 
) const
private

Hash function to return a unique (within the VisBuffer) key (as defined by the casacore::MS def'n) for an interferometer (ant1, ant2, feed1, feed2, processor_id).

Note that a VisBuffer only contains one ddid and fieldid, and TIME is deliberately excluded this that is what will be averaged over.

Sorting a set of the returned keys is equivalent to sorting by (procid, ant1, ant2, feed1, feed2).

void casa::VisChunkAverager::initialize ( VisBuffer vb)
private

Initialize the next accumulation interval.

casacore::Bool casa::VisChunkAverager::makeHashMap ( ROVisibilityIterator vi)
private
void casa::VisChunkAverager::normalize ( const casacore::Double  minTime,
const casacore::Double  maxTime,
const casacore::Double  firstinterval,
const casacore::Double  lastinterval 
)
private

Normalize the accumulation (finish the average).

VisChunkAverager& casa::VisChunkAverager::operator= ( const VisChunkAverager )
private
void casa::VisChunkAverager::reset ( )

Reset the averager.

casacore::Bool casa::VisChunkAverager::setupHashFunction ( ROVisibilityIterator vi)
private

These return their success values.

(They could fail if any of ant1, ant2, feed1, feed2, or procid are < 0, but that shouldn't happen and isn't checked for.)

casacore::uInt casa::VisChunkAverager::uIntMax ( const casacore::uInt  a,
const casacore::uInt  b 
) const
inline

max(a, b) in Math.h is so overloaded, and (u)casacore::Int is so promotable, that they're unusable together.

Definition at line 130 of file VisChunkAverager.h.

Member Data Documentation

CalVisBuffer casa::VisChunkAverager::avBuf_p
private

Averaging buffer.

Definition at line 233 of file VisChunkAverager.h.

casacore::Vector<casacore::Matrix<casacore::Int> > casa::VisChunkAverager::chanAveBounds_p
private

Used for both selecting and averaging channels.

Definition at line 199 of file VisChunkAverager.h.

casacore::Vector<casacore::MS::PredefinedColumns> casa::VisChunkAverager::colEnums_p
private

Start of initialization list.

Which of DATA, MODEL_DATA, and/or CORRECTED_DATA to use.

Definition at line 193 of file VisChunkAverager.h.

casacore::Bool casa::VisChunkAverager::doSpWeight_p
private

Use WEIGHT_SPECTRUM?

Definition at line 196 of file VisChunkAverager.h.

casacore::Bool casa::VisChunkAverager::haveHashMap_p
private

Is sphash_to_inprows_p OK?

Definition at line 206 of file VisChunkAverager.h.

casacore::uInt casa::VisChunkAverager::maxant1p1_p
private

Maxima for hashFunction().

Definition at line 209 of file VisChunkAverager.h.

casacore::uInt casa::VisChunkAverager::maxant2p1_p
private

Definition at line 210 of file VisChunkAverager.h.

casacore::uInt casa::VisChunkAverager::maxfeed1p1_p
private

Definition at line 211 of file VisChunkAverager.h.

casacore::uInt casa::VisChunkAverager::maxfeed2p1_p
private

Definition at line 212 of file VisChunkAverager.h.

casacore::Int casa::VisChunkAverager::nCat_p
private

The number of flag categories.

0 if flagCategory() is invalid.

Definition at line 230 of file VisChunkAverager.h.

casacore::Int casa::VisChunkAverager::nChan_p
private

Definition at line 227 of file VisChunkAverager.h.

casacore::Int casa::VisChunkAverager::nCorr_p
private

Number of correlations and channels.

Definition at line 227 of file VisChunkAverager.h.

casacore::Bool casa::VisChunkAverager::readyToHash_p
private

End of initialization list.

Is everything setup for hashFunction()?

Definition at line 203 of file VisChunkAverager.h.

mapuIvIType casa::VisChunkAverager::sphash_to_inprows_p
private

casacore::uInt maxprocp1_p; Not needed

A map from a sparse hash of "baseline" to a vector of input row numbers matching that hash.

The hash is calculated by hashFunction().

The vector has an entry, in order, for each chunklet (vb) in vi's current chunk which is either -1 (the chunklet has no row matching the hash) or the row number relative to the starting row in that chunklet's vb.

Definition at line 224 of file VisChunkAverager.h.


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