from scipy.optimize import curve_fit
from numpy import tanh
def probe(x, I_0, T_e, A):
return I_0 * tanh(x / T_e) + A * x
def fit(x, y):
params = curve_fit(probe, x, y, [50, 10, 1])[0]
return params