Location: BG_HaiMurphy @ ad3c1a3c060c / parameter_finder / Yang_R_mlcp_fitting / Rmlcp_fitting.py

Author:
Shelley Fong <sfon036@UoA.auckland.ac.nz>
Date:
2022-05-11 16:50:16+12:00
Desc:
Updating version with Yang05 modifications
Permanent Source URI:
https://models.cellml.org/workspace/818/rawfile/ad3c1a3c060ce9500f56f3fae9cc78aa3db44a39/parameter_finder/Yang_R_mlcp_fitting/Rmlcp_fitting.py

# Fit a lienar function to R_mlcp, which is a sigmoid dependent on cGMP concentration

import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize

def linearFn(c, m):
    return m * c

# time = np.linspace(0,60,2000)
cGMP = np.linspace(0,15,500) # [=] uM?

Km = 5.5 # [=] uM
R_OG = [pow(t,2)/(pow(Km,2) + pow(t,2)) for t in cGMP]

p0 = (1) # start with values near those we expect
m, cv = scipy.optimize.curve_fit(linearFn, cGMP, R_OG, p0, maxfev=2000, ftol=1e-4) # (function, xdata, ydata, p_IC)
# m, q = params
k_opt = linearFn(cGMP, m)
print(f"kfit = {m} * c)")

# manual plots
# k_test = linearFn(cGMP, 1.66, 0.09995)

plt.figure
plt.plot(cGMP, R_OG)
plt.plot(cGMP, k_opt)
# plt.plot(cGMP, k_test)
plt.legend(['original','fit'])
plt.show()