![]() |
Project
|
#include <RobustAverage.h>
Public Member Functions | |
| 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:
Usage using copy of data:
Definition at line 40 of file RobustAverage.h.
|
inline |
constructor
| 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.
|
default |
default constructor
|
inline |
constructor
| values | values which will be averaged and filtered. Move operator is used here! |
Definition at line 59 of file RobustAverage.h.
| 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.
| void o2::tpc::RobustAverage::clear | ( | ) |
clear the stored values
Definition at line 187 of file RobustAverage.cxx.
| 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.
| std::pair< float, float > o2::tpc::RobustAverage::getFilteredAverage | ( | const float | sigma = 3, |
| const float | interQuartileRange = 0.9 |
||
| ) |
returns the filtered average value
| sigma | maximum accepted standard deviation: sigma*stdev |
| interQuartileRange | number of points in inner quartile to consider |
Definition at line 22 of file RobustAverage.cxx.
|
inline |
Definition at line 81 of file RobustAverage.h.
| float o2::tpc::RobustAverage::getMedian | ( | ) |
Definition at line 172 of file RobustAverage.cxx.
| 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.
|
inline |
Definition at line 95 of file RobustAverage.h.
returns truncated mean for range min and max
| 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.
|
inline |
returns if weights are stored
Definition at line 112 of file RobustAverage.h.
|
inline |
Definition at line 98 of file RobustAverage.h.
|
inline |
Definition at line 92 of file RobustAverage.h.
|
inline |
Definition at line 103 of file RobustAverage.h.
| void o2::tpc::RobustAverage::print | ( | ) | const |
values which will be averaged and filtered
Definition at line 159 of file RobustAverage.cxx.
| void o2::tpc::RobustAverage::reserve | ( | const unsigned int | maxValues | ) |
reserve memory for member
| maxValues | maximum number of values which will be averaged. Copy of values will be done. |
Definition at line 16 of file RobustAverage.cxx.
returns if weights are stored
Definition at line 115 of file RobustAverage.h.
Definition at line 100 of file RobustAverage.h.
| void o2::tpc::RobustAverage::sort | ( | ) |
Definition at line 108 of file RobustAverage.cxx.