From 25fdc9ae5cf691b2463205828676204331e1dee0 Mon Sep 17 00:00:00 2001 From: Jim Rybarski Date: Wed, 27 Jun 2018 10:44:10 -0500 Subject: [PATCH] Remove code that handles multidimensional arrays and uncertainty --- biofits/fit.py | 17 ++--------------- setup.py | 2 +- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/biofits/fit.py b/biofits/fit.py index e838f39..e3bf4e4 100644 --- a/biofits/fit.py +++ b/biofits/fit.py @@ -25,18 +25,11 @@ def fit_hyperbola(concentrations, signals): slope, intercept, _, _, _ = stats.linregress(concentrations, signals) yint_min, yint_max = (0.0, np.inf) if intercept > 0 else (-np.inf, 0.0) delta_y_min, delta_y_max = (0.0, np.inf) if slope > 0 else (-np.inf, 0.0) - signals = [np.mean(s) for s in signals] - sigmas = [np.std(s) for s in signals] - if 0 in sigmas: - # if we have scalar values, the standard deviation will be zero everywhere and this will cause a division by - # zero to occur. In this case, we just weight all points equally - sigmas = np.ones((len(signals),)) (yint, delta_y, kd), covariance = curve_fit(hyperbola, concentrations, signals, bounds=((yint_min, delta_y_min, sys.float_info.min*10000), - (yint_max, delta_y_max, np.inf)), - sigma=sigmas) + (yint_max, delta_y_max, np.inf))) yint_stddev = covariance[0, 0] ** 0.5 delta_y_stddev = covariance[1, 1] ** 0.5 kd_stddev = covariance[2, 2] ** 0.5 @@ -64,17 +57,11 @@ def fit_quadratic(concentrations, signals): slope, intercept, _, _, _ = stats.linregress(concentrations, signals) yint_min, yint_max = (0.0, np.inf) if intercept > 0 else (-np.inf, 0.0) delta_y_min, delta_y_max = (0.0, np.inf) if slope > 0 else (-np.inf, 0.0) - sigmas = [np.std(s) for s in signals] - if 0 in sigmas: - # if we have scalar values, the standard deviation will be zero everywhere and this will cause a division by - # zero to occur. In this case, we just weight all points equally - sigmas = np.ones((len(signals),)) (yint, delta_y, kd, constant), covariance = curve_fit(quadratic, concentrations, signals, bounds=((yint_min, delta_y_min, sys.float_info.min*10000, 0.0), - (yint_max, delta_y_max, np.inf, np.inf)), - sigma=sigmas) + (yint_max, delta_y_max, np.inf, np.inf))) yint_stddev = covariance[0, 0] ** 0.5 delta_y_stddev = covariance[1, 1] ** 0.5 kd_stddev = covariance[2, 2] ** 0.5 diff --git a/setup.py b/setup.py index 06b8506..7682c85 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup -VERSION = '0.25' +VERSION = '0.26' if __name__ == '__main__': setup(