mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-19 14:29:46 +01:00
formatted slsDetectorCalibration
This commit is contained in:
@@ -1,47 +1,33 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
class Stat
|
||||
{
|
||||
class Stat {
|
||||
public:
|
||||
|
||||
Stat() : n(0), m(0.), m2(0.) {}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
n = 0;
|
||||
m=0;
|
||||
m2=0;
|
||||
Stat() : n(0), m(0.), m2(0.) {}
|
||||
|
||||
void Clear() {
|
||||
n = 0;
|
||||
m = 0;
|
||||
m2 = 0;
|
||||
}
|
||||
|
||||
void Push(double x)
|
||||
{
|
||||
|
||||
m+=x;
|
||||
m2+=x*x;
|
||||
n++;
|
||||
}
|
||||
|
||||
int NumDataValues() const
|
||||
{
|
||||
return n;
|
||||
}
|
||||
void Push(double x) {
|
||||
|
||||
double Mean() const
|
||||
{
|
||||
return (n > 0) ? m/n : 0.0;
|
||||
}
|
||||
m += x;
|
||||
m2 += x * x;
|
||||
n++;
|
||||
}
|
||||
|
||||
double Variance() const
|
||||
{
|
||||
return ( (n >0 ) ? (m2/n-m*m/(n*n)) : 0.0 );
|
||||
}
|
||||
int NumDataValues() const { return n; }
|
||||
|
||||
double StandardDeviation() const
|
||||
{
|
||||
return sqrt( Variance() );
|
||||
}
|
||||
double Mean() const { return (n > 0) ? m / n : 0.0; }
|
||||
|
||||
private:
|
||||
int n;
|
||||
double m, m2;
|
||||
};
|
||||
double Variance() const {
|
||||
return ((n > 0) ? (m2 / n - m * m / (n * n)) : 0.0);
|
||||
}
|
||||
|
||||
double StandardDeviation() const { return sqrt(Variance()); }
|
||||
|
||||
private:
|
||||
int n;
|
||||
double m, m2;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user