change order of clipped line to fit normal line, add rectify
This commit is contained in:
parent
f6b2ea8938
commit
e7553b24cd
@ -24,7 +24,7 @@ class FICurve:
|
|||||||
|
|
||||||
# f_max, f_min, k, x_zero
|
# f_max, f_min, k, x_zero
|
||||||
self.boltzmann_fit_vars = []
|
self.boltzmann_fit_vars = []
|
||||||
# offset increase
|
# increase, offset
|
||||||
self.f_infinity_fit = []
|
self.f_infinity_fit = []
|
||||||
|
|
||||||
self.all_calculate_frequency_points()
|
self.all_calculate_frequency_points()
|
||||||
|
12
functions.py
12
functions.py
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from numba import jit
|
||||||
|
|
||||||
|
|
||||||
def line(x, m, c):
|
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
|
return -(np.log((f_max-f_min) / (x - f_min) - 1) / k) + x_zero
|
||||||
|
|
||||||
|
|
||||||
def clipped_line(x, a, b):
|
def clipped_line(x, m, c):
|
||||||
return np.clip(a+b*x, 0, None)
|
return np.clip(m*x + c, 0, None)
|
||||||
|
|
||||||
|
|
||||||
def inverse_clipped_line(x, a, b):
|
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.")
|
raise ValueError("Value undefined in inverse_clipped_line.")
|
||||||
|
|
||||||
return (x-a)/b
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user