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
casacore::StatisticsAlgorithmFactoryData::BiweightData
Definition: StatisticsAlgorithmFactoryData.h:39
casacore::StatisticsAlgorithmFactory
Provides a single interface for creation of stats algorithm objects.
Definition: StatisticsAlgorithmFactory.h:43
casacore::StatisticsAlgorithmFactory::_hf
Double _hf
hinges-fences f factor
Definition: StatisticsAlgorithmFactory.h:122
casacore::StatisticsAlgorithmFactory::hingesFencesFactor
Double hingesFencesFactor() const
Throws an exception if the current configuration is not relevant to the hinges-fences algorithm.
casacore::StatisticsData::ALGORITHM
ALGORITHM
implemented algorithms
Definition: StatisticsData.h:47
casacore::CountedPtr
Referenced counted pointer for constant data.
Definition: CountedPtr.h:81
casacore::StatisticsAlgorithmFactory::configureChauvenet
void configureChauvenet(Double zscore=-1, Int maxIterations=-1)
configure to use Chauvenet's criterion
casacore::FitToHalfStatisticsData::USE_DATA
USE_DATA
which section of data to use, greater than or less than the center value
Definition: FitToHalfStatisticsData.h:48
casacore::StatisticsAlgorithmFactory::configureHingesFences
void configureHingesFences(Double f)
configure to use hinges-fences algorithm
casacore::StatisticsAlgorithmFactory::_chauvData
StatisticsAlgorithmFactoryData::ChauvenetData _chauvData
Definition: StatisticsAlgorithmFactory.h:125
casacore::StatisticsAlgorithmFactoryData::ChauvenetData
Definition: StatisticsAlgorithmFactoryData.h:54
casacore::StatisticsAlgorithmFactory::algorithm
StatisticsData::ALGORITHM algorithm() const
Definition: StatisticsAlgorithmFactory.h:92
casacore::Double
double Double
Definition: aipstype.h:55
casacore::StatisticsAlgorithmFactory::configureFitToHalf
void configureFitToHalf(FitToHalfStatisticsData::CENTER centerType=FitToHalfStatisticsData::CMEAN, FitToHalfStatisticsData::USE_DATA useData=FitToHalfStatisticsData::LE_CENTER, AccumType centerValue=0)
configure to use fit to half algorithm.
casacore::StatisticsAlgorithmFactory::_algorithm
StatisticsData::ALGORITHM _algorithm
Definition: StatisticsAlgorithmFactory.h:120
casacore::StatisticsAlgorithmFactory::~StatisticsAlgorithmFactory
~StatisticsAlgorithmFactory()
casacore::StatisticsAlgorithmFactory::_biweightData
StatisticsAlgorithmFactoryData::BiweightData _biweightData
Definition: StatisticsAlgorithmFactory.h:123
casacore::StatisticsAlgorithmFactory::fitToHalfData
StatisticsAlgorithmFactoryData::FitToHalfData< AccumType > fitToHalfData() const
Throws an exception if the current configuration is not relevant to the fit-to-half algorithm.
casacore::StatisticsAlgorithmFactory::biweightData
StatisticsAlgorithmFactoryData::BiweightData biweightData() const
Throws an exception if the current configuration is not relevant to the Biweight algorithm.
casacore::StatisticsAlgorithmFactory::createStatsAlgorithm
CountedPtr< StatisticsAlgorithm< CASA_STATP > > createStatsAlgorithm() const
Create a pointer to an object of a class derived from StatisticsAlgorithm that reflects the current c...
casacore::StatisticsAlgorithmFactory::chauvenetData
StatisticsAlgorithmFactoryData::ChauvenetData chauvenetData() const
Throws an exception if the current configuration is not relevant to the Chauvenet/zscore algorithm.
casacore::FitToHalfStatisticsData::CENTER
CENTER
choice of center point based on the corresponding statistics from the entire distribution of data,...
Definition: FitToHalfStatisticsData.h:41
casacore::StatisticsAlgorithmFactory::_fitToHalfData
StatisticsAlgorithmFactoryData::FitToHalfData< AccumType > _fitToHalfData
Definition: StatisticsAlgorithmFactory.h:124
casacore::StatisticsAlgorithmFactory::StatisticsAlgorithmFactory
StatisticsAlgorithmFactory()
upon construction, the object is configured to use the classical stats algorithm
casacore::Int
int Int
Definition: aipstype.h:50
casacore
this file contains all the compiler specific defines
Definition: mainpage.dox:28
casacore::C::c
const Double c
Fundamental physical constants (SI units):
casacore::StatisticsAlgorithmFactory::configureClassical
void configureClassical()
casacore::FitToHalfStatisticsData::LE_CENTER
@ LE_CENTER
Definition: FitToHalfStatisticsData.h:49
casacore::StatisticsAlgorithmFactory::copy
void copy(StatisticsAlgorithmFactory< AccumType, DataIterator2, MaskIterator2, WeightsIterator2 > &other) const
copy the data from this object to an object with different template types.
casacore::StatisticsAlgorithmFactoryData::FitToHalfData
Definition: StatisticsAlgorithmFactoryData.h:46
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Record
A hierarchical collection of named fields of various types.
Definition: Record.h:181
casacore::StatisticsAlgorithmFactory::toRecord
Record toRecord() const
create a record from the current configuration that can be used to create another object using the fr...
casacore::StatisticsAlgorithmFactory::fromRecord
static StatisticsAlgorithmFactory< CASA_STATP > fromRecord(const Record &r)
create an object from a record
casacore::FitToHalfStatisticsData::CMEAN
@ CMEAN
Definition: FitToHalfStatisticsData.h:42
casacore::StatisticsAlgorithmFactory::configureBiweight
void configureBiweight(Int maxIter=3, Double c=6.0)