casacore
Loading...
Searching...
No Matches
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: casa-feedback@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/scimath/Mathematics/NumericTraits.h>
30#include <casacore/scimath/StatsFramework/StatisticsAlgorithm.h>
31#include <casacore/scimath/StatsFramework/StatisticsAlgorithmFactoryData.h>
32#include <casacore/scimath/StatsFramework/StatisticsData.h>
33
34namespace casacore {
35
36// Provides a single interface for creation of stats algorithm objects
37
38template <
39 class AccumType, class DataIterator, class MaskIterator=const Bool *,
40 class WeightsIterator=DataIterator
41>
43
44public:
45
46 // to make copy() more straight forward to implement
47 template <
48 class AccumType2, class DataIterator2, class MaskIterator2,
49 class WeightsIterator2
50 >
52
53 // upon construction, the object is configured to use the classical stats
54 // algorithm
56
58
59 void configureBiweight(Int maxIter=3, Double c=6.0);
60
62
63 // configure to use fit to half algorithm.
68 =FitToHalfStatisticsData::LE_CENTER, 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 // copy the data from this object to an object with different template
78 // types. Note that the AccumType of <src>other</src> must be the same as
79 // the AccumType of this object.
80 template <class DataIterator2, class MaskIterator2, class WeightsIterator2>
81 void copy(
83 AccumType, DataIterator2, MaskIterator2, WeightsIterator2
84 >& other
85 ) const;
86
87 // Create a pointer to an object of a class derived from StatisticsAlgorithm
88 // that reflects the current configuration
89 std::shared_ptr<StatisticsAlgorithm<CASA_STATP>> createStatsAlgorithm() const;
90
92
93 // Throws an exception if the current configuration is not relevant
94 // to the Biweight algorithm
96
97 // Throws an exception if the current configuration is not relevant
98 // to the Chauvenet/zscore algorithm
100
101 // Throws an exception if the current configuration is not relevant
102 // to the hinges-fences algorithm
104
105 // Throws an exception if the current configuration is not relevant
106 // to the fit-to-half algorithm
109
110 // create a record from the current configuration that can be used
111 // to create another object using the fromRecord() method.
113
114 // create an object from a record
116
117private:
118
120 // hinges-fences f factor
125
126};
127
128}
129
130#ifndef CASACORE_NO_AUTO_TEMPLATES
131#include <casacore/scimath/StatsFramework/StatisticsAlgorithmFactory.tcc>
132#endif
133
134#endif
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
static StatisticsAlgorithmFactory< CASA_STATP > fromRecord(const Record &r)
create an object from a record
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
std::shared_ptr< StatisticsAlgorithm< CASA_STATP > > createStatsAlgorithm() const
Create a pointer to an object of a class derived from StatisticsAlgorithm that reflects the current c...
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.
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
StatisticsAlgorithmFactoryData::BiweightData _biweightData
Double hingesFencesFactor() const
Throws an exception if the current configuration is not relevant to the hinges-fences algorithm.
StatisticsAlgorithmFactoryData::FitToHalfData< AccumType > fitToHalfData() const
Throws an exception if the current configuration is not relevant to the fit-to-half algorithm.
ALGORITHM
implemented algorithms
this file contains all the compiler specific defines
Definition mainpage.dox:28
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53