some mathematical tools
More...
some mathematical tools
Definition at line 1460 of file trfUtils.py.
◆ chi2()
| python.trfUtils.math.chi2 |
( |
| self, |
|
|
| observed, |
|
|
| expected ) |
Definition at line 1483 of file trfUtils.py.
1483 def chi2(self, observed, expected):
1484 if 0 in expected:
1485 return 0.0
1486 return sum((_o - _e) ** 2 / _e for _o, _e in zip(observed, expected))
1487
1488
double chi2(TH1 *h0, TH1 *h1)
◆ mean()
| python.trfUtils.math.mean |
( |
| self, |
|
|
| data ) |
Definition at line 1463 of file trfUtils.py.
1463 def mean(self, data):
1464 n = len(data)
1465 if n < 1:
1466 msg.warning('mean requires at least one data point')
1467 return sum(data)/n
1468
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
◆ sum_dev()
| python.trfUtils.math.sum_dev |
( |
| self, |
|
|
| x, |
|
|
| y ) |
Definition at line 1477 of file trfUtils.py.
1477 def sum_dev(self, x, y):
1478 c1 = self.mean(x)
1479 c2 = self.mean(y)
1480 return sum((_x - c1) * (_y - c2) for _x, _y in zip(x, y))
1481
◆ sum_square_dev()
| python.trfUtils.math.sum_square_dev |
( |
| self, |
|
|
| data ) |
Definition at line 1471 of file trfUtils.py.
1471 def sum_square_dev(self, data):
1472 c = self.mean(data)
1473 return sum((x - c) ** 2 for x in data)
1474
The documentation for this class was generated from the following file: