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/NumericTraits.h>
31 #include <casacore/scimath/StatsFramework/StatisticsAlgorithm.h>
32 #include <casacore/scimath/StatsFramework/StatisticsAlgorithmFactoryData.h>
33 #include <casacore/scimath/StatsFramework/StatisticsData.h>
34 
35 namespace casacore {
36 
37 // Provides a single interface for creation of stats algorithm objects
38 
39 template <
40  class AccumType, class DataIterator, class MaskIterator=const Bool *,
41  class WeightsIterator=DataIterator
42 >
44 
45 public:
46 
47  // to make copy() more straight forward to implement
48  template <
49  class AccumType2, class DataIterator2, class MaskIterator2,
50  class WeightsIterator2
51  >
53 
54  // upon construction, the object is configured to use the classical stats
55  // algorithm
57 
59 
60  void configureBiweight(Int maxIter=3, Double c=6.0);
61 
63 
64  // configure to use fit to half algorithm.
69  =FitToHalfStatisticsData::LE_CENTER, AccumType centerValue=0
70  );
71 
72  // configure to use hinges-fences algorithm
74 
75  // configure to use Chauvenet's criterion
76  void configureChauvenet(Double zscore=-1, Int maxIterations=-1);
77 
78  // copy the data from this object to an object with different template
79  // types. Note that the AccumType of <src>other</src> must be the same as
80  // the AccumType of this object.
81  template <class DataIterator2, class MaskIterator2, class WeightsIterator2>
82  void copy(
84  AccumType, DataIterator2, MaskIterator2, WeightsIterator2
85  >& other
86  ) const;
87 
88  // Create a pointer to an object of a class derived from StatisticsAlgorithm
89  // that reflects the current configuration
91 
93 
94  // Throws an exception if the current configuration is not relevant
95  // to the Biweight algorithm
97 
98  // Throws an exception if the current configuration is not relevant
99  // to the Chauvenet/zscore algorithm
101 
102  // Throws an exception if the current configuration is not relevant
103  // to the hinges-fences algorithm
105 
106  // Throws an exception if the current configuration is not relevant
107  // to the fit-to-half algorithm
109  fitToHalfData() const;
110 
111  // create a record from the current configuration that can be used
112  // to create another object using the fromRecord() method.
113  Record toRecord() const;
114 
115  // create an object from a record
117 
118 private:
119 
121  // hinges-fences f factor
126 
127 };
128 
129 }
130 
131 #ifndef CASACORE_NO_AUTO_TEMPLATES
132 #include <casacore/scimath/StatsFramework/StatisticsAlgorithmFactory.tcc>
133 #endif
134 
135 #endif
Referenced counted pointer for constant data.
Definition: CountedPtr.h:81
USE_DATA
which section of data to use, greater than or less than the center value
CENTER
choice of center point based on the corresponding statistics from the entire distribution of data,...
Provides a single interface for creation of stats algorithm objects.
StatisticsAlgorithmFactory()
upon construction, the object is configured to use the classical stats algorithm
CountedPtr< StatisticsAlgorithm< CASA_STATP > > createStatsAlgorithm() const
Create a pointer to an object of a class derived from StatisticsAlgorithm that reflects the current c...
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 configureChauvenet(Double zscore=-1, Int maxIterations=-1)
configure to use Chauvenet's criterion
StatisticsAlgorithmFactoryData::FitToHalfData< AccumType > _fitToHalfData
StatisticsAlgorithmFactoryData::BiweightData biweightData() const
Throws an exception if the current configuration is not relevant to the Biweight algorithm.
void configureHingesFences(Double f)
configure to use hinges-fences algorithm
void configureBiweight(Int maxIter=3, Double c=6.0)
void copy(StatisticsAlgorithmFactory< AccumType, DataIterator2, MaskIterator2, WeightsIterator2 > &other) const
copy the data from this object to an object with different template types.
StatisticsAlgorithmFactoryData::FitToHalfData< AccumType > fitToHalfData() const
Throws an exception if the current configuration is not relevant to the fit-to-half algorithm.
Record toRecord() const
create a record from the current configuration that can be used to create another object using the fr...
StatisticsAlgorithmFactoryData::ChauvenetData _chauvData
StatisticsAlgorithmFactoryData::ChauvenetData chauvenetData() const
Throws an exception if the current configuration is not relevant to the Chauvenet/zscore algorithm.
StatisticsData::ALGORITHM algorithm() const
static StatisticsAlgorithmFactory< CASA_STATP > fromRecord(const Record &r)
create an object from a record
StatisticsAlgorithmFactoryData::BiweightData _biweightData
Double hingesFencesFactor() const
Throws an exception if the current configuration is not relevant to the hinges-fences algorithm.
ALGORITHM
implemented algorithms
const Double c
Fundamental physical constants (SI units):
this file contains all the compiler specific defines
Definition: mainpage.dox:28
int Int
Definition: aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
double Double
Definition: aipstype.h:55