[Fix] Relax test_merge_obs tolerance to machine epsilon and update ODR docstring to reference odrpack

This commit is contained in:
Fabian Joswig 2026-03-29 20:01:48 +02:00
commit 1689dc978c
2 changed files with 2 additions and 2 deletions

View file

@ -394,7 +394,7 @@ Direct visualizations of the performed fits can be triggered via `resplot=True`
For all available options including combined fits to multiple datasets see `pyerrors.fits.least_squares`. For all available options including combined fits to multiple datasets see `pyerrors.fits.least_squares`.
## Total least squares fits ## Total least squares fits
`pyerrors` can also fit data with errors on both the dependent and independent variables using the total least squares method also referred to as orthogonal distance regression as implemented in [scipy](https://docs.scipy.org/doc/scipy/reference/odr.html), see `pyerrors.fits.least_squares`. The syntax is identical to the standard least squares case, the only difference being that `x` also has to be a `list` or `numpy.array` of `Obs`. `pyerrors` can also fit data with errors on both the dependent and independent variables using the total least squares method also referred to as orthogonal distance regression as implemented in [odrpack](https://pypi.org/project/odrpack/), see `pyerrors.fits.total_least_squares`. The syntax is identical to the standard least squares case, the only difference being that `x` also has to be a `list` or `numpy.array` of `Obs`.
For the full API see `pyerrors.fits` for fits and `pyerrors.roots` for finding roots of functions. For the full API see `pyerrors.fits` for fits and `pyerrors.roots` for finding roots of functions.

View file

@ -511,7 +511,7 @@ def test_merge_obs():
my_obs2 = pe.Obs([np.random.normal(1, .1, 100)], ['t|2'], idl=[range(1, 200, 2)]) my_obs2 = pe.Obs([np.random.normal(1, .1, 100)], ['t|2'], idl=[range(1, 200, 2)])
merged = pe.merge_obs([my_obs1, my_obs2]) merged = pe.merge_obs([my_obs1, my_obs2])
diff = merged - (my_obs2 + my_obs1) / 2 diff = merged - (my_obs2 + my_obs1) / 2
assert np.isclose(0, diff.value, atol=1e-16) assert np.isclose(0, diff.value, atol=np.finfo(np.float64).eps)
with pytest.raises(ValueError): with pytest.raises(ValueError):
pe.merge_obs([my_obs1, my_obs1]) pe.merge_obs([my_obs1, my_obs1])
my_covobs = pe.cov_Obs(1.0, 0.003, 'cov') my_covobs = pe.cov_Obs(1.0, 0.003, 'cov')