From c2ff8c715abb7447bc0cebb622f41e1df3fe8e58 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Thu, 9 Dec 2021 10:20:13 +0000 Subject: [PATCH] refactor!: ks_test removed from develop for now. --- pyerrors/fits.py | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/pyerrors/fits.py b/pyerrors/fits.py index ddebdb91..331e7b0b 100644 --- a/pyerrors/fits.py +++ b/pyerrors/fits.py @@ -1,4 +1,3 @@ -import gc from collections.abc import Sequence import warnings import numpy as np @@ -739,49 +738,3 @@ def error_band(x, func, beta): err = np.array(err) return err - - -def ks_test(obs=None): - """Performs a Kolmogorov–Smirnov test for the Q-values of all fit object. - - If no list is given all Obs in memory are used. - - Disclaimer: The determination of the individual Q-values as well as this function have not been tested yet. - """ - - raise Exception('Not yet implemented') - - if obs is None: - obs_list = [] - for obj in gc.get_objects(): - if isinstance(obj, Obs): - obs_list.append(obj) - else: - obs_list = obs - - # TODO: Rework to apply to Q-values of all fits in memory - Qs = [] - for obs_i in obs_list: - for ens in obs_i.e_names: - if obs_i.e_Q[ens] is not None: - Qs.append(obs_i.e_Q[ens]) - - bins = len(Qs) - x = np.arange(0, 1.001, 0.001) - plt.plot(x, x, 'k', zorder=1) - plt.xlim(0, 1) - plt.ylim(0, 1) - plt.xlabel('Q value') - plt.ylabel('Cumulative probability') - plt.title(str(bins) + ' Q values') - - n = np.arange(1, bins + 1) / np.float64(bins) - Xs = np.sort(Qs) - plt.step(Xs, n) - diffs = n - Xs - loc_max_diff = np.argmax(np.abs(diffs)) - loc = Xs[loc_max_diff] - plt.annotate(s='', xy=(loc, loc), xytext=(loc, loc + diffs[loc_max_diff]), arrowprops=dict(arrowstyle='<->', shrinkA=0, shrinkB=0)) - plt.draw() - - print(scipy.stats.kstest(Qs, 'uniform'))