#include <RobustAverage.h>
|
| RobustAverage (const unsigned int maxValues, bool withWeights=true) |
|
| RobustAverage ()=default |
| default constructor
|
|
| RobustAverage (std::vector< float > &&values) |
|
void | reserve (const unsigned int maxValues) |
|
void | clear () |
| clear the stored values
|
|
void | addValue (const float value, const float weight=1) |
|
std::pair< float, float > | getFilteredAverage (const float sigma=3, const float interQuartileRange=0.9) |
|
std::tuple< float, float, float, unsigned int > | filterPointsMedian (const float maxAbsMedian, const float sigma=5) |
| remove all the point which are abs(val - val_median)>maxAbsMedian
|
|
float | getMean () const |
|
float | getTrunctedMean (float low, float high) |
|
float | getMedian () |
|
float | getWeightedMean () const |
|
float | getStdDev () |
|
const auto & | getValues () const |
|
void | setValues (const std::vector< float > &values) |
|
const auto & | getWeigths () const |
|
void | print () const |
| values which will be averaged and filtered
|
|
void | sort () |
|
bool | getUseWeights () const |
| returns if weights are stored
|
|
void | setUseWeights (bool useweights) |
| returns if weights are stored
|
|
float | getQuantile (float quantile, int type) |
|
class to perform filtering of outliers and robust averaging of a set of values. This class is more or less a dummy for now... TODO add more sophisticated methods
Usage using existing data:
- std::vector<float> values{1., 2., 2.3};
- o2::tpc::RobustAverage rob(std::move(values));
- float average = rob.getFilteredAverage(3);
Usage using copy of data:
- o2::tpc::RobustAverage rob(3);
- rob.addValue(1.); rob.addValue(2.); rob.addValue(2.3);
- float average = rob.getFilteredAverage(3);
Definition at line 40 of file RobustAverage.h.
◆ RobustAverage() [1/3]
o2::tpc::RobustAverage::RobustAverage |
( |
const unsigned int |
maxValues, |
|
|
bool |
withWeights = true |
|
) |
| |
|
inline |
constructor
- Parameters
-
maxValues | maximum number of values which will be averaged. Copy of values will be done. |
withWeights | also storing weights for weighted mean |
Definition at line 46 of file RobustAverage.h.
◆ RobustAverage() [2/3]
o2::tpc::RobustAverage::RobustAverage |
( |
| ) |
|
|
default |
◆ RobustAverage() [3/3]
o2::tpc::RobustAverage::RobustAverage |
( |
std::vector< float > && |
values | ) |
|
|
inline |
constructor
- Parameters
-
values | values which will be averaged and filtered. Move operator is used here! |
Definition at line 59 of file RobustAverage.h.
◆ addValue()
void o2::tpc::RobustAverage::addValue |
( |
const float |
value, |
|
|
const float |
weight = 1 |
|
) |
| |
- Parameters
-
value | value which will be added to the list of stored values for averaging |
weight | weight of the value (weight will only be stored if flag to weights is true) |
Definition at line 193 of file RobustAverage.cxx.
◆ clear()
void o2::tpc::RobustAverage::clear |
( |
| ) |
|
◆ filterPointsMedian()
std::tuple< float, float, float, unsigned int > o2::tpc::RobustAverage::filterPointsMedian |
( |
const float |
maxAbsMedian, |
|
|
const float |
sigma = 5 |
|
) |
| |
remove all the point which are abs(val - val_median)>maxAbsMedian
Definition at line 57 of file RobustAverage.cxx.
◆ getFilteredAverage()
std::pair< float, float > o2::tpc::RobustAverage::getFilteredAverage |
( |
const float |
sigma = 3 , |
|
|
const float |
interQuartileRange = 0.9 |
|
) |
| |
returns the filtered average value
- Parameters
-
sigma | maximum accepted standard deviation: sigma*stdev |
interQuartileRange | number of points in inner quartile to consider |
Definition at line 22 of file RobustAverage.cxx.
◆ getMean()
float o2::tpc::RobustAverage::getMean |
( |
| ) |
const |
|
inline |
◆ getMedian()
float o2::tpc::RobustAverage::getMedian |
( |
| ) |
|
◆ getQuantile()
float o2::tpc::RobustAverage::getQuantile |
( |
float |
quantile, |
|
|
int |
type |
|
) |
| |
- Returns
- returns the quantile value - linear interpolation or median unbiased used -
- Parameters
-
quantile | quantile to get |
type | interpolation type: type=0 use linear interpolation, type=1 use unbiased median (in case of low statistics) |
Definition at line 236 of file RobustAverage.cxx.
◆ getStdDev()
float o2::tpc::RobustAverage::getStdDev |
( |
| ) |
|
|
inline |
- Returns
- returns standard deviation of stored values
Definition at line 95 of file RobustAverage.h.
◆ getTrunctedMean()
float o2::tpc::RobustAverage::getTrunctedMean |
( |
float |
low, |
|
|
float |
high |
|
) |
| |
returns truncated mean for range min and max
- Parameters
-
low | lower fraction rejection e.g. 0.05 -> lower 5% are rejected |
high | upper fraction rejection e.g. 0.95 -> upper 5% are rejected |
Definition at line 201 of file RobustAverage.cxx.
◆ getUseWeights()
bool o2::tpc::RobustAverage::getUseWeights |
( |
| ) |
const |
|
inline |
◆ getValues()
const auto & o2::tpc::RobustAverage::getValues |
( |
| ) |
const |
|
inline |
◆ getWeightedMean()
float o2::tpc::RobustAverage::getWeightedMean |
( |
| ) |
const |
|
inline |
- Returns
- returns weighted mean of stored values
Definition at line 92 of file RobustAverage.h.
◆ getWeigths()
const auto & o2::tpc::RobustAverage::getWeigths |
( |
| ) |
const |
|
inline |
◆ print()
void o2::tpc::RobustAverage::print |
( |
| ) |
const |
◆ reserve()
void o2::tpc::RobustAverage::reserve |
( |
const unsigned int |
maxValues | ) |
|
reserve memory for member
- Parameters
-
maxValues | maximum number of values which will be averaged. Copy of values will be done. |
Definition at line 16 of file RobustAverage.cxx.
◆ setUseWeights()
void o2::tpc::RobustAverage::setUseWeights |
( |
bool |
useweights | ) |
|
|
inline |
◆ setValues()
void o2::tpc::RobustAverage::setValues |
( |
const std::vector< float > & |
values | ) |
|
|
inline |
◆ sort()
void o2::tpc::RobustAverage::sort |
( |
| ) |
|
The documentation for this class was generated from the following files:
- /home/runner/work/AliceO2/AliceO2/Detectors/TPC/calibration/include/TPCCalibration/RobustAverage.h
- /home/runner/work/AliceO2/AliceO2/Detectors/TPC/calibration/src/RobustAverage.cxx