|
casacore
|
Topics | |
| Mathematics_module_internal_classes | |
| Internal Mathematics_module classes and functions. | |
Functions | |
| casacore::HistAcc (const uInt nBuff) | |
Makes a histogram from input values. | |
| casacore::StatAcc () | |
A statistics accumulator | |
Mathematical types, constants, operations
See below for an overview of the classes in this module.
Mathematicians may argue that everything is mathematics, and hence all of Casacore should be in this module. However this module will only contain core mathematical operations that are independent of astronomical applications.
The Mathematics module has a variety of mathematical classes and functions. Not all numerical operations are found herein. Very complicated operations might be in their own module. such as deconvolution. Many whole array operations are in the (see (file="ArrayMath.h"))ArrayMath global functions (part of the Arrays module). Mathematical operations on Lattices are found in the Lattices module. A wide variety of special Mathematical functions is planned for the Functionals module.
The classes presently in this module fall into the following categories:
| casacore::HistAcc | ( | const uInt | nBuff | ) |
Makes a histogram from input values.
HistAcc stands for `Histogram Accumulator'.
Makes a histogram from input values. The histogram bin parameters may be defined, or determined from the first n input values. The input values are fed to HistAcc via the member function `put'. They can be fed individually, or in the form of an Array.
The histogram `bins' can be defined via the constructor in the form of loop variables: low bin, high bin, bin-width. It is also possible to let the bin parameters be determined automatically from the first n (e.g. n=50) input values. If the actual nr of input values is less than n when the histogram is interrogated in some way, the bin parameters will be determined from what is available.
It is usually convenient to let the bins be defined automatically:
In some cases the bin parameters are pre-defined:
The internal statistics accumulator can be interrogated explicitly or implicitly:
*/ template<class T> class HistAcc { public: /** Constructors and destructor. If the bin-parameters low, high and width (for lowest and highest bin, and binwidth) are not specified, they will be determined automatically from the first nBuff input values (which are stored in a temporary buffer).
Referenced by copy(), HistAcc(), and operator=().
| casacore::StatAcc | ( | ) |
A statistics accumulator
StatAcc stands for `Statistics Accumulator'.
A statistics accumulator accepts (weighted) input values and calculates simple statistice (min, max, weighted mean, rms etc). The accepted input types are real, i.e. Int, uInt, Float, Double, but not Complex. The reason for this is that the < operator of Complex (needed for min/max) works on the norm in any case, and the sqrt function (needed for rms) yields an ambiguous result.
Restriction to real types also allows the internal arithmetic type to be Double rather than the input type. The latter would give all kinds of complications with weighting, accuracy and overflow if the input type would be Int or uInt.
The (weighted) values are fed to StatAcc via the member function `put'. They can be fed individually, or in the form of an Array. The weights are optional (default = 1) and always have type Float.
Asking for a result does not change the internal state. The type of the returned results is always Fallible<Double>. A result is invalid if no input values with non-zero weight have been accumulated yet.
The accumulator can be re-initialised with the function `reset'. Accumulators can be added to each other, which is as if their combined values had been accumulated in the same accumulator.
Some functions have been provided to display a summary of the statistics results. One may choose between a one-line format (with an optional associated header line), and a list.
One often needs simple statistics of a series of values, which may occur by themselves or in arrays at various points in a program.
Sincs it is a pain to have to assign accumulation variables, and to write statistics evaluation code (including exceptions), this helper class is provided.
*/ template<class T> class StatAcc { public: /** constructors and destructor.
Referenced by copy(), getStatistics(), operator+(), operator+=(), operator=(), and StatAcc().