source: trunk/src/Utils/Statistics.cc @ 190

Last change on this file since 190 was 190, checked in by Matthew Whiting, 18 years ago

Large commit. The addition of a new Statistics namespace & class, plus a number of changes to the code to make the cube-wide statistics calculation work. The FDR calculations are incorporated into the new class, and a number of functions have been made into templates to ease the calculations. Details follow:

  • New namespace and class (StatsContainer? -- templated) in Statistics.hh, that holds mean,median,stddev & madfm, and provide accessor and calculator functions for these. It also holds the threshold values for sigma-clipping and FDR methods, as well as the PValue evaluation functions
  • The correctionFactor incorporated into the namespace, and given a conversion function that other functions can call (eg. the atrous_Xd_reconstruct functions).
  • Templated the statistics functions in getStats.cc.
  • Templated the sort functions, and made swap an inline one defined in utils.hh.
  • A number of changes to cubes.cc and cubes.hh:
    • DataArray? gains a StatsContainer? object, to store stats info.
    • Image has lost its pValue array (not needed as we calculate on the fly) and mask array (not used).
    • Image has also lost all its stats members, but keeps minPix.
    • Functions to go are Image::maskObject, Image::findStats. Removed calls to the former. Latter never used.
    • Cube::setCubeStats does the cube-wide stats calculations, including setupFDR (now a Cube function).
    • Cube loses the specMean etc arrays.
  • The Search functions (ReconSearch? and CubicSearch?) changed to accommodate the exchange of StatsContainer? objects. This changed the prototypes as well.
  • The growObject function incorporates the new StatsContainer? object.
  • Minor change to Merger, in the preparation for calling growObject.
  • A new par introduced: flagUserThreshold -- set to true when the user enters a value for the threshold.
  • Removed thresholding_functions.cc and incorporated its functions into cubes.cc and cubes.hh.
File size: 1.3 KB
Line 
1#include <Utils/Statistics.hh>
2#include <Utils/utils.hh>
3using namespace Statistics;
4
5template <class T>
6void Statistics::StatsContainer<T>::calculate(T *array, long size)
7{
8  findNormalStats(array, size, this->mean, this->stddev);
9  findMedianStats(array, size, this->median, this->madfm);
10  this->defined = true;
11}
12template void Statistics::StatsContainer<int>::calculate(int *array, long size);
13template void Statistics::StatsContainer<long>::calculate(long *array, long size);
14template void Statistics::StatsContainer<float>::calculate(float *array, long size);
15template void Statistics::StatsContainer<double>::calculate(double *array, long size);
16//--------------------------------------------------------------------
17
18template <class T>
19void Statistics::StatsContainer<T>::calculate(T *array, long size, bool *isGood)
20{
21  findNormalStats(array, size, isGood, this->mean, this->stddev);
22  findMedianStats(array, size, isGood, this->median, this->madfm);
23  this->defined = true;
24}
25template void Statistics::StatsContainer<int>::calculate(int *array, long size, bool *isGood);
26template void Statistics::StatsContainer<long>::calculate(long *array, long size, bool *isGood);
27template void Statistics::StatsContainer<float>::calculate(float *array, long size, bool *isGood);
28template void Statistics::StatsContainer<double>::calculate(double *array, long size, bool *isGood);
29
Note: See TracBrowser for help on using the repository browser.