change order of clipped line to fit normal line, add rectify

This commit is contained in:
a.ott 2020-01-29 11:03:13 +01:00
parent f6b2ea8938
commit e7553b24cd
2 changed files with 11 additions and 3 deletions

View File

@ -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()

View File

@ -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