source: tags/release-1.0.6/src/Utils/Statistics.cc @ 1391

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

A large commit based around a few changes:

  • Implemented the new SNRpeak column, defining it in columns.cc and printing it out in outputDetection.cc.
  • Corrected a bug in the subsection parsing that miscalculated the pixel offset when "*" was given as an axis range.
  • setupFDR now calculates the flux threshold so this can be reported.
  • The object flags now distinguish between spatial edge and spectral edge locations.
  • Other minor changes for clarity's sake.
File size: 2.9 KB
Line 
1#include <Utils/Statistics.hh>
2#include <Utils/utils.hh>
3using namespace Statistics;
4
5template <class T> Statistics::StatsContainer<T>::StatsContainer(const StatsContainer<T>& s)
6{
7  this->defined    = s.defined;
8  this->mean       = s.mean;
9  this->stddev     = s.stddev;
10  this->median     = s.median;
11  this->madfm      = s.madfm;
12  this->threshold  = s.threshold;
13  this->pThreshold = s.pThreshold;
14  this->useRobust  = s.useRobust;
15  this->useFDR     = s.useFDR;
16}
17template StatsContainer<int>::StatsContainer(const StatsContainer<int>& s);
18template StatsContainer<long>::StatsContainer(const StatsContainer<long>& s);
19template StatsContainer<float>::StatsContainer(const StatsContainer<float>& s);
20template StatsContainer<double>::StatsContainer(const StatsContainer<double>& s);
21//--------------------------------------------------------------------
22
23template <class T> Statistics::StatsContainer<T>& StatsContainer<T>::operator= (const StatsContainer<T>& s)
24{
25  this->defined    = s.defined;
26  this->mean       = s.mean;
27  this->stddev     = s.stddev;
28  this->median     = s.median;
29  this->madfm      = s.madfm;
30  this->threshold  = s.threshold;
31  this->pThreshold = s.pThreshold;
32  this->useRobust  = s.useRobust;
33  this->useFDR     = s.useFDR;
34}
35template StatsContainer<int>& StatsContainer<int>::operator= (const StatsContainer<int>& s);
36template StatsContainer<long>& StatsContainer<long>::operator= (const StatsContainer<long>& s);
37template StatsContainer<float>& StatsContainer<float>::operator= (const StatsContainer<float>& s);
38template StatsContainer<double>& StatsContainer<double>::operator= (const StatsContainer<double>& s);
39//--------------------------------------------------------------------
40
41template <class T> void Statistics::StatsContainer<T>::calculate(T *array, long size)
42{
43  findNormalStats(array, size, this->mean, this->stddev);
44  findMedianStats(array, size, this->median, this->madfm);
45  this->defined = true;
46}
47template void Statistics::StatsContainer<int>::calculate(int *array, long size);
48template void Statistics::StatsContainer<long>::calculate(long *array, long size);
49template void Statistics::StatsContainer<float>::calculate(float *array, long size);
50template void Statistics::StatsContainer<double>::calculate(double *array, long size);
51//--------------------------------------------------------------------
52
53template <class T>
54void Statistics::StatsContainer<T>::calculate(T *array, long size, bool *isGood)
55{
56  findNormalStats(array, size, isGood, this->mean, this->stddev);
57  findMedianStats(array, size, isGood, this->median, this->madfm);
58  this->defined = true;
59}
60template void Statistics::StatsContainer<int>::calculate(int *array, long size, bool *isGood);
61template void Statistics::StatsContainer<long>::calculate(long *array, long size, bool *isGood);
62template void Statistics::StatsContainer<float>::calculate(float *array, long size, bool *isGood);
63template void Statistics::StatsContainer<double>::calculate(double *array, long size, bool *isGood);
64
Note: See TracBrowser for help on using the repository browser.