# Input initialization for i in range(0,numtests): for j in range(0,numpoints): V[i][j] = -70e-3 Vstim = 80e-3 for i in range(0,numtests): for j in range(onset-1,offset): V[i][j] = Vstim Vstim = Vstim - 10e-3 # Variable initialization for j in range(0,numtests): Ca[j][0] = 0 n[j] = x_inf(V[j][0], Vhalf_n, k_n) p[j] = x_inf(V[j][0], Vhalf_p, k_p) q[j] = x_inf(V[j][0], Vhalf_q, k_q) e[j] = x_inf(V[j][0], Vhalf_e, k_e) f[j] = x_inf(V[j][0], Vhalf_f, k_f) # Start of simulation for j in range(0,numtests): for i in range(1,numpoints): dn = (x_inf(V[j][i-1], Vhalf_n, k_n) - n[j])/T_n n[j] = n[j] + dn*deltat dp = (x_inf(V[j][i-1], Vhalf_p, k_p) - p[j])/T_p p[j] = p[j] + dp*deltat dq = (x_inf(V[j][i-1], Vhalf_q, k_q) - q[j])/T_q q[j] = q[j] + dq*deltat de = (x_inf(V[j][i-1], Vhalf_e, k_e) - e[j])/T_e
# Input initialization for i in range(0, numtests): for j in range(0, numpoints): V[i][j] = -70e-3 Vstim = 40e-3 for i in range(0, numtests): for j in range(onset - 1, offset): V[i][j] = Vstim Vstim = Vstim - 10e-3 # Variable initialization for j in range(0, numtests): Ca[j][0] = 0 n[j] = x_inf(V[j][0], Vhalf_n, k_n) p[j] = x_inf(V[j][0], Vhalf_p, k_p) q[j] = x_inf(V[j][0], Vhalf_q, k_q) e[j] = x_inf(V[j][0], Vhalf_e, k_e) f[j] = x_inf(V[j][0], Vhalf_f, k_f) # Start of simulation for j in range(0, numtests): for i in range(1, numpoints): dn = (x_inf(V[j][i - 1], Vhalf_n, k_n) - n[j]) / T_n n[j] = n[j] + dn * deltat dp = (x_inf(V[j][i - 1], Vhalf_p, k_p) - p[j]) / T_p p[j] = p[j] + dp * deltat dq = (x_inf(V[j][i - 1], Vhalf_q, k_q) - q[j]) / T_q q[j] = q[j] + dq * deltat de = (x_inf(V[j][i - 1], Vhalf_e, k_e) - e[j]) / T_e
# Plotting I-V curves import sys import numpy as np import matplotlib.pyplot as plt sys.path += '.' from x_inf import * from input_vars import * x = np.arange(-0.060, 0.080, 0.001) numpoints = len(x) y = np.zeros((2,numpoints)) for i in range(0,numpoints): IKS = gKS * x_inf(x[i], Vhalf_n, k_n) * (x[i] - VKS) IKF = gKF * x_inf(x[i], Vhalf_p, k_p)**4 * x_inf(x[i], Vhalf_q, k_q) * (x[i]- VKF) ICa = gCa * x_inf(x[i], Vhalf_e, k_e)**2 * (x[i] - VCa) y[0][i] = (IKF + IKS) / Cmem y[1][i] = ICa / Cmem plt.subplot(1,2,1) plt.plot([round(i * 1e3, 2) for i in x], y[1], 'k', label='$I_{Ca}$') plt.xlim(-40,80) plt.ylim(-8,6) plt.ylabel('I_Ca (A/F)') plt.xlabel('V (mV)') plt.grid('on')