fix: corrected bug that prevented combined fits with multiple x-obs in some cases (#241)

* fix: corrected bug that prevented combined fits with multiple x-obs in some cases

* made test more complex

* [Fix] Slightly increase tolerance for matrix function test.

* Adapt test_merge_idx to compare lists

---------

Co-authored-by: Simon Kuberski <simon.kuberski@cern.ch>
Co-authored-by: Fabian Joswig <fjosw@users.noreply.github.com>
This commit is contained in:
s-kuberski 2024-09-14 02:15:59 +09:00 committed by GitHub
parent 1d6f7f65c0
commit 4b1bb0872a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 7 deletions

View file

@ -1082,6 +1082,20 @@ def test_combined_resplot_qqplot():
fr = pe.least_squares(xd, yd, fd, resplot=True, qqplot=True)
plt.close('all')
def test_combined_fit_xerr():
fitd = {
'a' : lambda p, x: p[0] * x[0] + p[1] * x[1],
'b' : lambda p, x: p[0] * x[0] + p[2] * x[1],
'c' : lambda p, x: p[0] * x[0] + p[3] * x[1],
}
yd = {
'a': [pe.cov_Obs(3 + .1 * np.random.uniform(), .1**2, 'a' + str(i)) for i in range(5)],
'b': [pe.cov_Obs(1 + .1 * np.random.uniform(), .1**2, 'b' + str(i)) for i in range(6)],
'c': [pe.cov_Obs(3 + .1 * np.random.uniform(), .1**2, 'c' + str(i)) for i in range(3)],
}
xd = {k: np.transpose([[1 + .01 * np.random.uniform(), 2] for i in range(len(yd[k]))]) for k in fitd}
pe.fits.least_squares(xd, yd, fitd)
def test_x_multidim_fit():
x1 = np.arange(1, 10)