Low-level fitting class.
More...
Low-level fitting class.
Definition at line 1375 of file trfUtils.py.
◆ __init__()
def python.trfUtils.Fit.__init__ |
( |
|
self, |
|
|
** |
kwargs |
|
) |
| |
Definition at line 1387 of file trfUtils.py.
1389 self._model = kwargs.get(
'model',
'linear')
1390 self._x = kwargs.get(
'x',
None)
1391 self._y = kwargs.get(
'y',
None)
1394 if not self._x
or not self._y:
1395 msg.warning(
'input data not defined')
1397 if len(self._x) != len(self._y):
1398 msg.warning(
'input data (lists) have different lengths')
1401 if self._model ==
'linear':
1402 self._ss = self._math.sum_square_dev(self._x)
1403 self._ss2 = self._math.sum_dev(self._x, self._y)
1405 self._xm = self._math.
mean(self._x)
1406 self._ym = self._math.
mean(self._y)
1407 self.set_intersect()
1411 msg.warning(
"\'{0}\' model is not implemented".
format(self._model))
◆ chi2()
def python.trfUtils.Fit.chi2 |
( |
|
self | ) |
|
◆ fit()
def python.trfUtils.Fit.fit |
( |
|
self | ) |
|
◆ intersect()
def python.trfUtils.Fit.intersect |
( |
|
self | ) |
|
◆ set_chi2()
def python.trfUtils.Fit.set_chi2 |
( |
|
self | ) |
|
Definition at line 1421 of file trfUtils.py.
1423 y_observed = self._y
1426 y_expected.append(self.value(x))
1427 if y_observed
and y_observed != []
and y_expected
and y_expected != []:
1428 self._chi2 = self._math.
chi2(y_observed, y_expected)
◆ set_intersect()
def python.trfUtils.Fit.set_intersect |
( |
|
self | ) |
|
Definition at line 1447 of file trfUtils.py.
1447 def set_intersect(self):
1449 if self._ym
and self._slope
and self._xm:
1450 self._intersect = self._ym - self._slope * self._xm
1452 self._intersect =
None
◆ set_slope()
def python.trfUtils.Fit.set_slope |
( |
|
self | ) |
|
Definition at line 1436 of file trfUtils.py.
1436 def set_slope(self):
1438 if self._ss2
and self._ss
and self._ss != 0:
1439 self._slope = self._ss2 / self._ss
◆ slope()
def python.trfUtils.Fit.slope |
( |
|
self | ) |
|
◆ value()
def python.trfUtils.Fit.value |
( |
|
self, |
|
|
|
t |
|
) |
| |
Definition at line 1417 of file trfUtils.py.
1419 return self._slope * t + self._intersect
◆ _chi2
python.trfUtils.Fit._chi2 |
|
staticprivate |
◆ _intersect
python.trfUtils.Fit._intersect |
|
staticprivate |
◆ _math
python.trfUtils.Fit._math |
|
private |
◆ _model
python.trfUtils.Fit._model |
|
staticprivate |
◆ _slope
python.trfUtils.Fit._slope |
|
staticprivate |
◆ _ss
◆ _ss2
◆ _x
◆ _xm
◆ _y
◆ _ym
The documentation for this class was generated from the following file:
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="")
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.