28 #ifndef LATTICES_LATTICESTATISTICS_H 29 #define LATTICES_LATTICESTATISTICS_H 31 #include <casacore/casa/aips.h> 32 #include <casacore/casa/Arrays/Array.h> 33 #include <casacore/casa/Containers/Block.h> 34 #include <casacore/casa/Arrays/Vector.h> 35 #include <casacore/casa/Containers/Record.h> 36 #include <casacore/lattices/LatticeMath/LatticeStatsBase.h> 37 #include <casacore/lattices/LatticeMath/TiledCollapser.h> 38 #include <casacore/lattices/LatticeMath/TiledCollapser.h> 39 #include <casacore/lattices/LEL/LatticeExprNode.h> 40 #include <casacore/lattices/LatticeMath/LatticeStatsDataProvider.h> 41 #include <casacore/lattices/LatticeMath/MaskedLatticeStatsDataProvider.h> 42 #include <casacore/scimath/Mathematics/NumericTraits.h> 43 #include <casacore/casa/Utilities/DataType.h> 44 #include <casacore/casa/BasicSL/String.h> 45 #include <casacore/casa/Logging/LogIO.h> 46 #include <casacore/scimath/Mathematics/FitToHalfStatisticsData.h> 47 #include <casacore/scimath/Mathematics/StatisticsData.h> 48 #include <casacore/scimath/Mathematics/StatisticsAlgorithm.h> 59 #include <casacore/casa/iosstrfwd.h> 291 Int zAxis=-1,
Int zLayer=-1,
292 Int hAxis=-1,
Int hLayer=-1);
297 Int zAxis=-1,
Int zLayer=-1,
298 Int hAxis=-1,
Int hLayer=-1);
388 AccumType centerValue=0
427 ThrowCc(
"Logic Error: This object cannot compute flux density");
430 virtual void listMinMax (ostringstream& osMin,
431 ostringstream& osMax,
432 Int oWidth, DataType type);
451 ostringstream& rslt,
Int zLayer);
526 AccumType nPts, AccumType sum, AccumType
median,
527 AccumType medAbsDevMed, AccumType quartile, AccumType sumSq, AccumType
mean,
528 AccumType var, AccumType
rms, AccumType sigma, AccumType dMin, AccumType dMax,
529 AccumType q1, AccumType q3
549 void minMax (
Bool& none, AccumType& dMin, AccumType& dMax,
562 const Bool posInLattice);
583 inline static AccumType
_mean(
const AccumType& sum,
const AccumType& npts) {
584 return npts <= 0 ? 0 : sum/npts;
587 inline static AccumType
_rms(
const AccumType& sumsq,
const AccumType& npts) {
588 return npts <= 0 ? 0 :
sqrt(sumsq/npts);
601 #ifndef CASACORE_NO_AUTO_TEMPLATES 602 #include <casacore/lattices/LatticeMath/LatticeStatistics.tcc> 603 #endif //# CASACORE_NO_AUTO_TEMPLATES A Vector of integers, for indexing into Array<T> objects.
virtual Bool listLayerStats(const Matrix< AccumType > &ord, ostringstream &rslt, Int zLayer)
A Lattice that can be used for temporary storage.
void configureClassical()
configure object to use Classical Statistics The time, t_x, it takes to compute classical statistics ...
Vector< Int > displayAxes() const
Return the display axes.
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.
Int mi
Chauvenet max iterations.
std::map< String, uInt > _chauvIters
Bool getMinMaxPos(IPosition &minPos, IPosition &maxPos)
Recover position of min and max.
const MaskedLattice< T > * pInLattice_p
LatticeExprNode sum(const LatticeExprNode &expr)
void configureChauvenet(Double zscore=-1, Int maxIterations=-1)
configure to use Chauvenet's criterion
void configureFitToHalf(FitToHalfStatisticsData::CENTER centerType=FitToHalfStatisticsData::CMEAN, FitToHalfStatisticsData::USE_DATA useData=FitToHalfStatisticsData::LE_CENTER, AccumType centerValue=0)
configure to use fit to half algorithm.
void configureHingesFences(Double f)
configure to use hinges-fences algorithm
Base class for LatticeStatistics class.
Double hf
hinges-fences f factor
Bool someGoodPoints()
See if there were some valid points found in the storage lattice.
Vector< Int > displayAxes_p
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.
std::list< stat_element > stat_list
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
Bool hasLogger() const
Did we construct with a logger ?
Bool calculateStatistic(Array< AccumType > &slice, LatticeStatsBase::StatisticsTypes type, Bool dropDeg)
Calculate statistic from storage lattice and return in an array.
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.
virtual Bool _canDoFlux() const
Virtual Functions.
void generateRobust()
Find the median per cursorAxes chunk.
std::map< String, uInt > getChauvenetNiter() const
get number of iterations associated with Chauvenet criterion algorithm
IPosition statsSliceShape() const
Find the shape of slice from the statistics lattice at one spatial pixel.
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)
Double zs
Chauvenet zscore.
Char PrecisionType
Higher precision type (Float->Double)
Data provider which allows stats framework to iterate through a masked lattice.
IPosition _storageLatticeShape() const
get the storage lattice shape
Referenced counted pointer for constant data.
Bool doneSomeGoodPoints_p
virtual Quantum< AccumType > _flux(Bool &, AccumType, Double) const
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.
AccumType cv
fit to half center value
CountedPtr< StatisticsAlgorithm< AccumType, const T *, const Bool * > > _createStatsAlgorithm() const
Compute and display various statistics from a lattice.
FitToHalfStatisticsData::CENTER ct
fit to have center type
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...
StatisticsTypes
This enum StatisticTypes is provided for use with the LatticeStatistics<T>::setPlotting function...
Bool needStorageLattice_p
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...
void stretchMinMax(AccumType &dMin, AccumType &dMax) const
Stretch min and max by 5%.
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...
Quantities (i.e. dimensioned values)
Bool setAxes(const Vector< Int > &cursorAxes)
Set the cursor axes (0 relative).
virtual void listMinMax(ostringstream &osMin, ostringstream &osMax, Int oWidth, DataType type)
template <class T, class U> class vector;
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.
*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...
Bool someGoodPointsValue_p
Bool generateStorageLattice()
Create a new storage lattice.
String errorMessage() const
Recover last error message.
FitToHalfStatisticsData::USE_DATA ud
fit to half data portion to use
LatticeExprNode mean(const LatticeExprNode &expr)
CountedPtr< TempLattice< AccumType > > pStoreLattice_p
TableExprNode rms(const TableExprNode &array)
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.
StatisticsData::ALGORITHM algorithm
LatticeStatistics(const MaskedLattice< T > &lattice, LogIO &os, Bool showProgress=True, Bool forceDisk=False)
Constructor takes the lattice and a LogIO object for logging.
NumericTraits< T >::PrecisionType AccumType
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)
void _configureDataProviders(LatticeStatsDataProvider< T > &lattDP, MaskedLatticeStatsDataProvider< T > &maskedLattDP) const
this file contains all the compiler specific defines
static AccumType _rms(const AccumType &sumsq, const AccumType &npts)
void resetError()
Reset argument error condition.
static AccumType _mean(const AccumType &sum, const AccumType &npts)
Bool goodParameterStatus_p
Bool setNewLattice(const MaskedLattice< T > &lattice)
Set a new MaskedLattice object.