You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
644 B
30 lines
644 B
|
|
import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
from scipy.optimize import curve_fit
|
|
|
|
kb = 1.380649e-23 # J/K
|
|
|
|
def helfrich_model(x, kappa, b, kbT):
|
|
kappa = abs(kappa)
|
|
b = abs(b)
|
|
return kbT / (8 * b + kappa * x)
|
|
|
|
def aproxHelfrich(x, y, T):
|
|
x = np.array(x)
|
|
y = np.array(y)
|
|
kbT = kb * T
|
|
|
|
def model_fixedT(x, kappa, b):
|
|
return helfrich_model(x, kappa, b, kbT)
|
|
|
|
try:
|
|
popt, _ = curve_fit(model_fixedT, x, y, p0=[1.4e-19, 1e-7])
|
|
kappa, b = popt
|
|
return abs(kappa), abs(b)
|
|
except RuntimeError:
|
|
print("Error: La optimización no convergió")
|
|
return None, None
|
|
|
|
|
|
|
|
|