casacore
StatisticsAlgorithmFactory.h
Go to the documentation of this file.
1 //# Copyright (C) 2000,2001
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 
26 #ifndef SCIMATH_STATSALGORITHMFACTORY_H
27 #define SCIMATH_STATSALGORITHMFACTORY_H
28 
29 #include <casacore/casa/Utilities/CountedPtr.h>
30 #include <casacore/scimath/Mathematics/FitToHalfStatisticsData.h>
31 #include <casacore/scimath/Mathematics/NumericTraits.h>
32 #include <casacore/scimath/Mathematics/StatisticsAlgorithm.h>
33 #include <casacore/scimath/Mathematics/StatisticsData.h>
34 
35 namespace casacore {
36 
37 // Allows a common way for configuring and creating stats algorithm objects
38 
39 template <class AccumType, class DataIterator, class MaskIterator=const Bool *, class WeightsIterator=DataIterator>
41 
42 public:
43 
44  struct FitToHalfData {
46  // fit to half data portion to use
48  // fit to half center value (only relevent if center=CVALUE)
49  AccumType centerValue;
50  };
51 
52  struct ChauvenetData {
55  };
56 
57  // upon construction, the object is configured to use the classical stats algorithm
59 
61 
62  void configureClassical();
63 
64  // configure to use fit to half algorithm.
65  void configureFitToHalf(
68  AccumType centerValue=0
69  );
70 
71  // configure to use hinges-fences algorithm
73 
74  // configure to use Chauvenet's criterion
75  void configureChauvenet(Double zscore=-1, Int maxIterations=-1);
76 
77  // Create a pointer to an object of a class derived from StatisticsAlgorithm
78  // that reflects the current configuration
80 
82 
83  // Throws an exception if the current configuration is not relevant
84  // to the Chauvenet/zscore algorithm
85  ChauvenetData chauvenetData() const;
86 
87  // Throws an exception if the current configuration is not relevant
88  // to the hinges-fences algorithm
89  Double hingesFencesFactor() const;
90 
91  // Throws an exception if the current configuration is not relevant
92  // to the fit-to-half algorithm
93  FitToHalfData fitToHalfData() const;
94 
95  // create a record from the current configuration that can be used
96  // to create another object using the fromRecord() method.
97  Record toRecord() const;
98 
99  // create an object from a record
101 
102 private:
103 
105  // hinges-fences f factor
107  FitToHalfData _fitToHalfData;
108  ChauvenetData _chauvData;
109 
110 };
111 
112 }
113 
114 #ifndef CASACORE_NO_AUTO_TEMPLATES
115 #include <casacore/scimath/Mathematics/StatisticsAlgorithmFactory.tcc>
116 #endif
117 
118 #endif
Record toRecord() const
create a record from the current configuration that can be used to create another object using the fr...
int Int
Definition: aipstype.h:50
void configureChauvenet(Double zscore=-1, Int maxIterations=-1)
configure to use Chauvenet&#39;s criterion
void configureHingesFences(Double f)
configure to use hinges-fences algorithm
USE_DATA
which section of data to use, greater than or less than the center value
ALGORITHM
implemented algorithms
CountedPtr< StatisticsAlgorithm< CASA_STATP > > createStatsAlgorithm() const
Create a pointer to an object of a class derived from StatisticsAlgorithm that reflects the current c...
CENTER
choice of center point based on the corresponding statistics from the entire distribution of data...
StatisticsData::ALGORITHM algorithm() const
Referenced counted pointer for constant data.
Definition: CountedPtr.h:86
static StatisticsAlgorithmFactory< CASA_STATP > fromRecord(const Record &r)
create an object from a record
double Double
Definition: aipstype.h:55
void configureFitToHalf(FitToHalfStatisticsData::CENTER centerType=FitToHalfStatisticsData::CMEAN, FitToHalfStatisticsData::USE_DATA useData=FitToHalfStatisticsData::LE_CENTER, AccumType centerValue=0)
configure to use fit to half algorithm.
A hierarchical collection of named fields of various types.
Definition: Record.h:180
Double hingesFencesFactor() const
Throws an exception if the current configuration is not relevant to the hinges-fences algorithm...
Allows a common way for configuring and creating stats algorithm objects.
StatisticsAlgorithmFactory()
upon construction, the object is configured to use the classical stats algorithm
AccumType centerValue
fit to half center value (only relevent if center=CVALUE)
FitToHalfData fitToHalfData() const
Throws an exception if the current configuration is not relevant to the fit-to-half algorithm...
this file contains all the compiler specific defines
Definition: mainpage.dox:28
FitToHalfStatisticsData::USE_DATA side
fit to half data portion to use
ChauvenetData chauvenetData() const
Throws an exception if the current configuration is not relevant to the Chauvenet/zscore algorithm...