casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::StatsTiledCollapser< T, U > Class Template Reference

Generate statistics, tile by tile, from a masked lattice NOTE this version was moved from LatticeStatistics (early Dec 2014 version) and slightly modified mostly for style issues (no significant semantic differences from that version). For a large number of statistics sets that need to be computed simultaneously, this version is more efficient than using the new stats framework, because creating large numbers of eg ClassicalStatistics objects is much less efficient than the direct manipulation of pointers to primitive types that this class does. More...

#include <StatsTiledCollapser.h>

Inheritance diagram for casacore::StatsTiledCollapser< T, U >:
casacore::TiledCollapser< T, U >

Public Member Functions

 StatsTiledCollapser (const Vector< T > &pixelRange, Bool noInclude, Bool noExclude, Bool fixedMinMax)
 Constructor provides pixel selection range and whether that range is an inclusion or exclusion range. More...
 
virtual ~StatsTiledCollapser ()
 
virtual void init (uInt nOutPixelsPerCollapse)
 Initialize process, making some checks. More...
 
virtual void initAccumulator (uInt64 n1, uInt64 n3)
 Initialiaze the accumulator. More...
 
virtual void process (uInt accumIndex1, uInt accumIndex3, const T *inData, const Bool *inMask, uInt dataIncr, uInt maskIncr, uInt nrval, const IPosition &startPos, const IPosition &shape)
 Process the data in the current chunk. More...
 
virtual void endAccumulator (Array< U > &result, Array< Bool > &resultMask, const IPosition &shape)
 End the accumulation process and return the result arrays. More...
 
virtual Bool canHandleNullMask () const
 Can handle null mask. More...
 
void minMaxPos (IPosition &minPos, IPosition &maxPos)
 Find the location of the minimum and maximum data values in the input lattice. More...
 
- Public Member Functions inherited from casacore::TiledCollapser< T, U >
virtual ~TiledCollapser ()
 Destructor. More...
 

Private Member Functions

void _convertNPts (Double *&nptsPtr, CountedPtr< Block< Double > > npts, CountedPtr< Block< DComplex > > nptsComplex) const
 
void _convertNPts (DComplex *&nptsPtr, CountedPtr< Block< Double > > npts, CountedPtr< Block< DComplex > > nptsComplex) const
 

Private Attributes

Vector< T > _range
 
Bool _include
 
Bool _exclude
 
Bool _fixedMinMax
 
Bool _isReal
 
IPosition _minpos
 
IPosition _maxpos
 
CountedPtr< Block< Double > > _npts
 Accumulators for sum, sum squared, number of points minimum, and maximum. More...
 
CountedPtr< Block< U > > _sum
 
CountedPtr< Block< U > > _sumSq
 
CountedPtr< Block< U > > _mean
 
CountedPtr< Block< U > > _variance
 
CountedPtr< Block< U > > _nvariance
 
CountedPtr< Block< U > > _sigma
 
CountedPtr< Block< T > > _min
 
CountedPtr< Block< T > > _max
 
CountedPtr< Block< Bool > > _initMinMax
 
uInt64 _n1
 
uInt64 _n3
 

Detailed Description

template<class T, class U = T>
class casacore::StatsTiledCollapser< T, U >

Generate statistics, tile by tile, from a masked lattice NOTE this version was moved from LatticeStatistics (early Dec 2014 version) and slightly modified mostly for style issues (no significant semantic differences from that version). For a large number of statistics sets that need to be computed simultaneously, this version is more efficient than using the new stats framework, because creating large numbers of eg ClassicalStatistics objects is much less efficient than the direct manipulation of pointers to primitive types that this class does.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

This class is used by LatticeStatistics to generate statistical sum from an input MaskedLattice. The input lattice is iterated through in tile-sized chunks and fed to an object of this class.

Synopsis

StatsTiledCollapser is derived from TiledCollapser which is a base class used to define methods. Objects of this base class are used by LatticeApply functions. In this particular case, we are interested in LatticeApply::tiledApply. This function iterates through a MaskedLattice and allows you to collapse one or more axes, computing some values from it, and placing those values into an output MaskedLattice. It iterates through the input lattice in optimal tile-sized chunks. LatticeStatistics uses a StatsTiledCollapser object which it gives to LatticeApply::tiledApply for digestion. After it has done its work, LatticeStatistics then accesses the output Lattice that it made.

Example

// Create collapser. Control information is passed in via the constructor
StatsTiledCollapser<T> collapser(range_p, noInclude_p, noExclude_p,
fixedMinMax_p, blcParent_p);
// This is the first output axis getting collapsed values. In LatticeStatistics
// this is the last axis of the output lattice
Int newOutAxis = outLattice.ndim()-1;
// tiledApply does the work by passing the collapser data in chunks
// and by writing the results into the output lattice
LatticeApply<T>::tiledApply(outLattice, inLattice,
collapser, collapseAxes,
newOutAxis);

In this example, a collapser is made and passed to LatticeApply. Afterwards, the output Lattice is available for use. The Lattices must all be the correct shapes on input to tiledApply

Motivation

The LatticeApply classes enable the ugly details of optimal Lattice iteration to be hidden from the user.

To Do

Definition at line 113 of file StatsTiledCollapser.h.

Constructor & Destructor Documentation

template<class T , class U = T>
casacore::StatsTiledCollapser< T, U >::StatsTiledCollapser ( const Vector< T > &  pixelRange,
Bool  noInclude,
Bool  noExclude,
Bool  fixedMinMax 
)

Constructor provides pixel selection range and whether that range is an inclusion or exclusion range.

If fixedMinMax=True and an inclusion range is given, the min and max is set to that inclusion range.

template<class T , class U = T>
virtual casacore::StatsTiledCollapser< T, U >::~StatsTiledCollapser ( )
inlinevirtual

Definition at line 124 of file StatsTiledCollapser.h.

Member Function Documentation

template<class T , class U = T>
void casacore::StatsTiledCollapser< T, U >::_convertNPts ( Double *&  nptsPtr,
CountedPtr< Block< Double > >  npts,
CountedPtr< Block< DComplex > >  nptsComplex 
) const
private
template<class T , class U = T>
void casacore::StatsTiledCollapser< T, U >::_convertNPts ( DComplex *&  nptsPtr,
CountedPtr< Block< Double > >  npts,
CountedPtr< Block< DComplex > >  nptsComplex 
) const
private
template<class T , class U = T>
virtual Bool casacore::StatsTiledCollapser< T, U >::canHandleNullMask ( ) const
inlinevirtual

Can handle null mask.

Reimplemented from casacore::TiledCollapser< T, U >.

Definition at line 147 of file StatsTiledCollapser.h.

References casacore::True.

template<class T , class U = T>
virtual void casacore::StatsTiledCollapser< T, U >::endAccumulator ( Array< U > &  result,
Array< Bool > &  resultMask,
const IPosition shape 
)
virtual

End the accumulation process and return the result arrays.

Implements casacore::TiledCollapser< T, U >.

template<class T , class U = T>
virtual void casacore::StatsTiledCollapser< T, U >::init ( uInt  nOutPixelsPerCollapse)
virtual

Initialize process, making some checks.

Implements casacore::TiledCollapser< T, U >.

template<class T , class U = T>
virtual void casacore::StatsTiledCollapser< T, U >::initAccumulator ( uInt64  n1,
uInt64  n3 
)
virtual

Initialiaze the accumulator.

Implements casacore::TiledCollapser< T, U >.

template<class T , class U = T>
void casacore::StatsTiledCollapser< T, U >::minMaxPos ( IPosition minPos,
IPosition maxPos 
)

Find the location of the minimum and maximum data values in the input lattice.

template<class T , class U = T>
virtual void casacore::StatsTiledCollapser< T, U >::process ( uInt  accumIndex1,
uInt  accumIndex3,
const T *  inData,
const Bool inMask,
uInt  dataIncr,
uInt  maskIncr,
uInt  nrval,
const IPosition startPos,
const IPosition shape 
)
virtual

Process the data in the current chunk.

Implements casacore::TiledCollapser< T, U >.

Member Data Documentation

template<class T , class U = T>
Bool casacore::StatsTiledCollapser< T, U >::_exclude
private

Definition at line 155 of file StatsTiledCollapser.h.

template<class T , class U = T>
Bool casacore::StatsTiledCollapser< T, U >::_fixedMinMax
private

Definition at line 155 of file StatsTiledCollapser.h.

template<class T , class U = T>
Bool casacore::StatsTiledCollapser< T, U >::_include
private

Definition at line 155 of file StatsTiledCollapser.h.

template<class T , class U = T>
CountedPtr<Block<Bool> > casacore::StatsTiledCollapser< T, U >::_initMinMax
private

Definition at line 165 of file StatsTiledCollapser.h.

template<class T , class U = T>
Bool casacore::StatsTiledCollapser< T, U >::_isReal
private

Definition at line 155 of file StatsTiledCollapser.h.

template<class T , class U = T>
CountedPtr<Block<T> > casacore::StatsTiledCollapser< T, U >::_max
private

Definition at line 164 of file StatsTiledCollapser.h.

template<class T , class U = T>
IPosition casacore::StatsTiledCollapser< T, U >::_maxpos
private

Definition at line 156 of file StatsTiledCollapser.h.

template<class T , class U = T>
CountedPtr<Block<U> > casacore::StatsTiledCollapser< T, U >::_mean
private

Definition at line 162 of file StatsTiledCollapser.h.

template<class T , class U = T>
CountedPtr<Block<T> > casacore::StatsTiledCollapser< T, U >::_min
private

Definition at line 164 of file StatsTiledCollapser.h.

template<class T , class U = T>
IPosition casacore::StatsTiledCollapser< T, U >::_minpos
private

Definition at line 156 of file StatsTiledCollapser.h.

template<class T , class U = T>
uInt64 casacore::StatsTiledCollapser< T, U >::_n1
private

Definition at line 167 of file StatsTiledCollapser.h.

template<class T , class U = T>
uInt64 casacore::StatsTiledCollapser< T, U >::_n3
private

Definition at line 167 of file StatsTiledCollapser.h.

template<class T , class U = T>
CountedPtr<Block<Double> > casacore::StatsTiledCollapser< T, U >::_npts
private

Accumulators for sum, sum squared, number of points minimum, and maximum.

Definition at line 161 of file StatsTiledCollapser.h.

template<class T , class U = T>
CountedPtr<Block<U> > casacore::StatsTiledCollapser< T, U >::_nvariance
private

Definition at line 162 of file StatsTiledCollapser.h.

template<class T , class U = T>
Vector<T> casacore::StatsTiledCollapser< T, U >::_range
private

Definition at line 154 of file StatsTiledCollapser.h.

template<class T , class U = T>
CountedPtr<Block<U> > casacore::StatsTiledCollapser< T, U >::_sigma
private

Definition at line 162 of file StatsTiledCollapser.h.

template<class T , class U = T>
CountedPtr<Block<U> > casacore::StatsTiledCollapser< T, U >::_sum
private

Definition at line 162 of file StatsTiledCollapser.h.

template<class T , class U = T>
CountedPtr<Block<U> > casacore::StatsTiledCollapser< T, U >::_sumSq
private

Definition at line 162 of file StatsTiledCollapser.h.

template<class T , class U = T>
CountedPtr<Block<U> > casacore::StatsTiledCollapser< T, U >::_variance
private

Definition at line 162 of file StatsTiledCollapser.h.


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