28 #ifndef LATTICES_LATTICESTATISTICS_H
29 #define LATTICES_LATTICESTATISTICS_H
284 Int zAxis=-1,
Int zLayer=-1,
285 Int hAxis=-1,
Int hLayer=-1);
290 Int zAxis=-1,
Int zLayer=-1,
291 Int hAxis=-1,
Int hLayer=-1);
455 ThrowCc(
"Logic Error: This object cannot compute flux density");
458 virtual void listMinMax (ostringstream& osMin,
459 ostringstream& osMax,
460 Int oWidth, DataType type);
479 ostringstream& rslt,
Int zLayer);
572 template <
class U,
class V>
579 template <
class U,
class V>
610 const Bool posInLattice);
649 >& sa, T& overallMin, T& overallMax,
IPosition& arrayShape,
651 std::vector<
Array<Bool> >& maskArray, std::vector<IPosition>& curPos,
657 T currentMin, T currentMax,
const IPosition& curPos,
663 return npts <= 0 ? 0 : sum/npts;
667 return npts <= 0 ? 0 :
sqrt(sumsq/npts);
671 T& overallMin, T& overallMax, T currentMin, T currentMax,
679 extern template class LatticeStatistics<Float>;
684 #ifndef CASACORE_NO_AUTO_TEMPLATES
685 #include <casacore/lattices/LatticeMath/LatticeStatistics.tcc>
686 #endif //# CASACORE_NO_AUTO_TEMPLATES
A Vector of integers, for indexing into Array<T> objects.
void forceAllowCodeDecideWhichAlgortihmToUse()
virtual Bool listLayerStats(const Matrix< AccumType > &ord, ostringstream &rslt, Int zLayer)
A subset of a Lattice or MaskedLattice.
void _computeQuantiles(AccumType &median, AccumType &medAbsDevMed, AccumType &q1, AccumType &q3, CountedPtr< StatisticsAlgorithm< AccumType, U, V > > statsAlg, uInt64 knownNpts, AccumType knownMin, AccumType knownMax) const
A Lattice that can be used for temporary storage.
std::shared_ptr< const MaskedLattice< T > > _inLatPtrMgr
PtrHolder< LatticeStatsAlgorithm > _latticeStatsAlgortihm
unset means let the code decide
void _computeQuantilesForStatsFramework(StatsData< AccumType > &stats, AccumType &q1, AccumType &q3, CountedPtr< StatisticsAlgorithm< AccumType, U, V > > statsAlg) const
void forceUseStatsFrameworkUsingDataProviders()
The force* methods are really only for testing.
LatticeExprNode median(const LatticeExprNode &expr)
Bool retrieveStorageStatistic(Array< AccumType > &slice, const LatticeStatsBase::StatisticsTypes type, const Bool dropDeg)
Retrieve a statistic from the storage lattice and return in an array.
std::map< String, uInt > _chauvIters
Bool getMinMaxPos(IPosition &minPos, IPosition &maxPos)
Recover position of min and max.
Vector< Int > displayAxes() const
Return the display axes.
virtual Quantum< AccumType > _flux(Bool &, AccumType, Double) const
const MaskedLattice< T > * pInLattice_p
LatticeExprNode sum(const LatticeExprNode &expr)
unsigned long long uInt64
Base class for LatticeStatistics class.
virtual Bool _canDoFlux() const
Virtual Functions.
Bool someGoodPoints()
See if there were some valid points found in the storage lattice.
void _doComputationUsingArrays(std::vector< CountedPtr< StatisticsAlgorithm< AccumType, typename Array< T >::const_iterator, Array< Bool >::const_iterator > > > &sa, T &overallMin, T &overallMax, IPosition &arrayShape, std::vector< Array< T > > &dataArray, std::vector< Array< Bool > > &maskArray, std::vector< IPosition > &curPos, uInt nthreads, const SubLattice< T > &subLat, Bool isChauv, Bool isMasked, Bool isReal, CountedPtr< const DataRanges > range)
Vector< Int > displayAxes_p
void minMax(Bool &none, AccumType &dMin, AccumType &dMax, const Vector< AccumType > &d, const Vector< AccumType > &n) const
Find min and max of good data in arrays specified by pointers.
A templated, abstract base class for array-like objects with masks.
Bool setList(const Bool &doList)
This function allows you to control whether the statistics are written to the output stream if you ar...
Data provider which allows stats framework to iterate through an unmasked lattice.
virtual ~LatticeStatistics()
Destructor.
A 2-D Specialization of the Array class.
ostream-like interface to creating log messages.
Bool getStatistic(Array< AccumType > &stat, LatticeStatsBase::StatisticsTypes type, Bool dropDeg=True)
Recover the desired Statistic into an array.
Bool configureClassical()
configure object to use Classical Statistics The time, t_x, it takes to compute classical statistics ...
void _computeStatsUsingArrays(SubLattice< T > subLat, CountedPtr< LattStatsProgress > progressMeter, const IPosition &cursorShape)
std::list< stat_element > stat_list
Traverse a Lattice by cursor shape.
USE_DATA
which section of data to use, greater than or less than the center value
void _doStatsLoop(uInt nsets, CountedPtr< LattStatsProgress > progressMeter)
std::pair< String, String > stat_element
void _computeStatsUsingLattDataProviders(LatticeStepper &stepper, SubLattice< T > subLat, Slicer &slicer, CountedPtr< LattStatsProgress > progressMeter, uInt nsets)
Bool calculateStatistic(Array< AccumType > &slice, LatticeStatsBase::StatisticsTypes type, Bool dropDeg)
Calculate statistic from storage lattice and return in an array.
void stretchMinMax(AccumType &dMin, AccumType &dMax) const
Stretch min and max by 5%.
Bool doRobust_p
doRobust means that when the storage lattice is generated, the robust statistics are generated as wel...
LatticeStatistics< T > & operator=(const LatticeStatistics< T > &other)
Assignment operator.
Bool display()
Display the statistics by listing and/or plotting them.
ALGORITHM
implemented algorithms
Bool getFullMinMax(T &dataMin, T &dataMax)
Get full lattice min and max only.
Bool setNewLattice(const MaskedLattice< T > &lattice, Bool clone=True)
Set a new MaskedLattice object.
void generateRobust()
Find the median per cursorAxes chunk.
virtual void summStats()
Summarize the statistics found over the entire lattice.
CENTER
choice of center point based on the corresponding statistics from the entire distribution of data...
Bool getLayerStats(String &stats, Double area, Int zAxis=-1, Int zLayer=-1, Int hAxis=-1, Int hLayer=-1)
IPosition statsSliceShape() const
Find the shape of slice from the statistics lattice at one spatial pixel.
Char PrecisionType
Higher precision type (Float->Double)
String errorMessage() const
Recover last error message.
Data provider which allows stats framework to iterate through a masked lattice.
IPosition _cursorShapeForArrayMethod(uInt64 setSize) const
Referenced counted pointer for constant data.
LatticeStatistics(const MaskedLattice< T > &lattice, LogIO &os, Bool showProgress=True, Bool forceDisk=False, Bool clone=True)
Constructor takes the lattice and a LogIO object for logging.
Bool doneSomeGoodPoints_p
void _updateMinMaxPos(T &overallMin, T &overallMax, T currentMin, T currentMax, const IPosition &minPos, const IPosition &maxPos, Bool atStart, const SubLattice< T > &subLat)
Compute and display various statistics from a lattice.
Vector< Int > cursorAxes_p
LatticeExprNode sqrt(const LatticeExprNode &expr)
virtual Bool _computeFlux(Array< AccumType > &flux, const Array< AccumType > &npts, const Array< AccumType > &sum)
Bool getConvertedStatistic(Array< T > &stat, LatticeStatsBase::StatisticsTypes type, Bool dropDeg=True)
bool Bool
Define the standard types used by Casacore.
void setStream(ostream &os, Int oPrec)
Non-virtual functions.
void _latticePosToStoragePos(IPosition &storagePos, const IPosition &latticePos)
convert a position in the input lattice to the corresponding position in the stats storage lattice...
IPosition _storageLatticeShape() const
get the storage lattice shape
Bool configureHingesFences(Double f)
configure to use hinges-fences algorithm
StatisticsTypes
This enum StatisticTypes is provided for use with the LatticeStatistics<T>::setPlotting function...
Bool needStorageLattice_p
void _fillStorageLattice(T currentMin, T currentMax, const IPosition &curPos, const StatsData< AccumType > &stats, Bool doQuantiles, AccumType q1=0, AccumType q3=0)
Bool setInExCludeRange(const Vector< T > &include, const Vector< T > &exclude, Bool setMinMaxToInclude=False)
You may specify a pixel intensity range as either one for which all pixels in that range are included...
Quantities (i.e. dimensioned values)
Bool hasLogger() const
Did we construct with a logger ?
Bool setAxes(const Vector< Int > &cursorAxes)
Set the cursor axes (0 relative).
virtual void listMinMax(ostringstream &osMin, ostringstream &osMax, Int oWidth, DataType type)
IPosition locInStorageLattice(const IPosition &latticePosition, LatticeStatsBase::StatisticsTypes type) const
Given a location in the lattice and a statistic type, work out where to put it in the storage lattice...
A templated N-D Array class with zero origin. Array<T, Alloc> is a templated, N-dimensional, Array class. The origin is zero, but by default indices are zero-based. This Array class is the base class for the Vector, Matrix, and Cube subclasses.
Specify which elements to extract from an n-dimensional array.
Vector< Int > statsToPlot_p
Bool getStats(Vector< AccumType > &, const IPosition &pos, const Bool posInLattice=False)
This function gets a vector containing all the statistics for a given location.
Bool someGoodPointsValue_p
Bool generateStorageLattice()
Create a new storage lattice.
Bool configureBiweight(Int maxIter, Double c)
The configure methods return True if reconfiguration is actually necessary (ie if the underlying stor...
LatticeExprNode mean(const LatticeExprNode &expr)
CountedPtr< TempLattice< AccumType > > pStoreLattice_p
TableExprNode rms(const TableExprNode &array)
const Double c
Fundamental physical constants (SI units):
Bool configureChauvenet(Double zscore=-1, Int maxIterations=-1)
configure to use Chauvenet's criterion
StatisticsData::ALGORITHM _getAlgorithm() const
std::map< String, uInt > getChauvenetNiter() const
get number of iterations associated with Chauvenet criterion algorithm
String: the storage and methods of handling collections of characters.
virtual Bool listStats(Bool hasBeam, const IPosition &dPos, const Matrix< AccumType > &ord)
List the statistics to the logger.
IPosition locInLattice(const IPosition &storagePosition, Bool relativeToParent=True) const
Given a location in the storage lattice, convert those locations on the non-statistics axis (the last...
NumericTraits< T >::PrecisionType AccumType
void forceUseOldTiledApplyMethod()
virtual void displayStats(AccumType nPts, AccumType sum, AccumType median, AccumType medAbsDevMed, AccumType quartile, AccumType sumSq, AccumType mean, AccumType var, AccumType rms, AccumType sigma, AccumType dMin, AccumType dMax, AccumType q1, AccumType q3)
Bool configureFitToHalf(FitToHalfStatisticsData::CENTER centerType=FitToHalfStatisticsData::CMEAN, FitToHalfStatisticsData::USE_DATA useData=FitToHalfStatisticsData::LE_CENTER, AccumType centerValue=0)
configure to use fit to half algorithm.
Base class of statistics algorithm class hierarchy.
void _configureDataProviders(LatticeStatsDataProvider< T > &lattDP, MaskedLatticeStatsDataProvider< T > &maskedLattDP) const
static AccumType _rms(const AccumType &sumsq, const AccumType &npts)
void resetError()
Reset argument error condition.
static AccumType _mean(const AccumType &sum, const AccumType &npts)
void setComputeQuantiles(Bool b)
should quantile-like stats (median, quartiles, medabsdevmed) be computed? When the stats framework is...
Bool goodParameterStatus_p
StatisticsAlgorithmFactory< AccumType, const T *, const Bool * > _saf
void forceUseStatsFrameworkUsingArrays()