From 6174343de615f7d68cabcb13919b38e856c98427 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Mon, 10 Jan 2022 15:24:43 +0100 Subject: [PATCH] test: test for ks_test added --- tests/fits_test.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/fits_test.py b/tests/fits_test.py index 8a1759cb..48012edb 100644 --- a/tests/fits_test.py +++ b/tests/fits_test.py @@ -309,6 +309,25 @@ def test_error_band(): pe.fits.error_band(x, f, fitp.fit_parameters) +def test_ks_test(): + def f(a, x): + y = a[0] + a[1] * x + return y + + fit_res = [] + + for i in range(20): + data = [] + for j in range(10): + data.append(pe.pseudo_Obs(j + np.random.normal(0.0, 0.25), 0.25, 'test')) + my_corr = pe.Corr(data) + + fit_res.append(my_corr.fit(f, silent=True)) + + pe.fits.ks_test() + pe.fits.ks_test(fit_res) + + 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.