some mathematical tools
More...
some mathematical tools
Definition at line 1471 of file trfUtils.py.
◆ chi2()
| python.trfUtils.math.chi2 |
( |
| self, |
|
|
| observed, |
|
|
| expected ) |
Definition at line 1494 of file trfUtils.py.
1494 def chi2(self, observed, expected):
1495 if 0 in expected:
1496 return 0.0
1497 return sum((_o - _e) ** 2 / _e for _o, _e in zip(observed, expected))
1498
1499
double chi2(TH1 *h0, TH1 *h1)
◆ mean()
| python.trfUtils.math.mean |
( |
| self, |
|
|
| data ) |
Definition at line 1474 of file trfUtils.py.
1474 def mean(self, data):
1475 n = len(data)
1476 if n < 1:
1477 msg.warning('mean requires at least one data point')
1478 return sum(data)/n
1479
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 1488 of file trfUtils.py.
1488 def sum_dev(self, x, y):
1489 c1 = self.mean(x)
1490 c2 = self.mean(y)
1491 return sum((_x - c1) * (_y - c2) for _x, _y in zip(x, y))
1492
◆ sum_square_dev()
| python.trfUtils.math.sum_square_dev |
( |
| self, |
|
|
| data ) |
Definition at line 1482 of file trfUtils.py.
1482 def sum_square_dev(self, data):
1483 c = self.mean(data)
1484 return sum((x - c) ** 2 for x in data)
1485
The documentation for this class was generated from the following file: