Silaev/PycharmProjects/3.5.1 auto/fitting.py

13 lines
425 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from scipy.optimize import curve_fit
from numpy import tanh
# Обсчет значений на данный момент недоступен, но может быть вызван в другом файле
# с использованием функции fit()
def probe(x, I_0, k_0, A):
return I_0 * tanh(k_0 / I_0 * x) + A * x
def fit(x, y):
params = curve_fit(probe, x, y, [50, 10, 1])[0]
return params