diff --git a/FiCurve.py b/FiCurve.py index 3903518..5d95a58 100644 --- a/FiCurve.py +++ b/FiCurve.py @@ -24,7 +24,7 @@ class FICurve: # f_max, f_min, k, x_zero self.boltzmann_fit_vars = [] - # offset increase + # increase, offset self.f_infinity_fit = [] self.all_calculate_frequency_points() diff --git a/functions.py b/functions.py index ab00e7c..3459db0 100644 --- a/functions.py +++ b/functions.py @@ -1,5 +1,6 @@ import numpy as np +from numba import jit def line(x, m, c): @@ -37,8 +38,8 @@ def inverse_full_boltzmann(x, f_max, f_min, k, x_zero): return -(np.log((f_max-f_min) / (x - f_min) - 1) / k) + x_zero -def clipped_line(x, a, b): - return np.clip(a+b*x, 0, None) +def clipped_line(x, m, c): + return np.clip(m*x + c, 0, None) def inverse_clipped_line(x, a, b): @@ -46,3 +47,10 @@ def inverse_clipped_line(x, a, b): raise ValueError("Value undefined in inverse_clipped_line.") return (x-a)/b + + +@jit(nopython=True) # useful in less that 1000x10000 calls (1000 tests with 10k data points) +def rectify(x): + if x < 0: + return 0 + return x