fix: multi dim fits fixed in least squares. Test added. (#160)

Co-authored-by: Simon Kuberski <simon.kuberski@uni-muenster.de>
This commit is contained in:
Fabian Joswig 2023-03-03 16:35:26 +00:00 committed by GitHub
parent cb289a55ec
commit 82cd2f11ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -913,6 +913,17 @@ def test_combined_resplot_qqplot():
plt.close('all')
def test_x_multidim_fit():
x1 = np.arange(1, 10)
x = np.array([[xi, xi] for xi in x1]).T
y = [pe.pseudo_Obs(i + 2 / i, .1 * i, 't') for i in x[0]]
[o.gm() for o in y]
def fitf(a, x):
return a[0] * x[0] + a[1] / x[1]
pe.fits.least_squares(x, y, fitf)
def fit_general(x, y, func, silent=False, **kwargs):
"""Performs a non-linear fit to y = func(x) and returns a list of Obs corresponding to the fit parameters.