casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
casa::VisChunkAverager Class Reference

#include <VisChunkAverager.h>

List of all members.

Public Member Functions

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

Static Public Member Functions

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

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 89 of file VisChunkAverager.h.


Constructor & Destructor Documentation

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

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

Null destructor.

Prohibit null constructor, copy constructor and assignment for now.


Member Function Documentation

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

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 Bool casa::VisChunkAverager::check_chunk ( ROVisibilityIterator vi,
Double time_to_break,
const Bool  watch_obs,
const Bool  watch_scan,
const 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 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.

Bool casa::VisChunkAverager::checkForBreak ( Vector< Int > &  firstVals,
const Int  i,
const uInt  slotnum,
const uInt  chunkletNum,
const std::vector< 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.

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

Check whether any of the unflagged rows in vi's current chunk have the same 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 MS::SCAN_NUMBER, MS::STATE_ID, MS::OBSERVATION_ID, and/or nothing. Otherwise an AipsError will be thrown. MS::ARRAY_ID is already separated by the chunking.

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

Hash function to return a unique (within the VisBuffer) key (as defined by the 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).

Initialize the next accumulation interval.

void casa::VisChunkAverager::normalize ( const Double  minTime,
const Double  maxTime,
const Double  firstinterval,
const Double  lastinterval 
) [private]

Normalize the accumulation (finish the average).

VisChunkAverager& casa::VisChunkAverager::operator= ( const VisChunkAverager ) [private]

Reset the averager.

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

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

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

Definition at line 130 of file VisChunkAverager.h.


Member Data Documentation

Averaging buffer.

Definition at line 233 of file VisChunkAverager.h.

Used for both selecting and averaging channels.

Definition at line 199 of file VisChunkAverager.h.

Start of initialization list.

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

Definition at line 193 of file VisChunkAverager.h.

Use WEIGHT_SPECTRUM?

Definition at line 196 of file VisChunkAverager.h.

Is sphash_to_inprows_p OK?

Definition at line 206 of file VisChunkAverager.h.

Maxima for hashFunction().

Definition at line 209 of file VisChunkAverager.h.

Definition at line 210 of file VisChunkAverager.h.

Definition at line 211 of file VisChunkAverager.h.

Definition at line 212 of file VisChunkAverager.h.

The number of flag categories.

0 if flagCategory() is invalid.

Definition at line 230 of file VisChunkAverager.h.

Definition at line 227 of file VisChunkAverager.h.

Number of correlations and channels.

Definition at line 227 of file VisChunkAverager.h.

End of initialization list.

Is everything setup for hashFunction()?

Definition at line 203 of file VisChunkAverager.h.

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: