- Author:
- nima <nafs080@aucklanduni.ac.nz>
- Date:
- 2021-06-19 09:11:56+12:00
- Desc:
- New implementation of python codes (having 1 script instead of 2)
- Permanent Source URI:
- https://staging.physiomeproject.org/workspace/648/rawfile/cd1c084aee2fd311571c12d13ff37d7ebe37e318/Figure4.py
# To reproduce the data needed for Figure 3 in associated
# Physiome paper, execute this script in the Python console
# in OpenCOR. This can be done with the following commands
# at the prompt in the OpenCOR Python console:
# In [1]: cd path/to/folder_this_file_is_in
# In [2]: %run Figure4.py
#
import opencor as opencor
# import numpy as np
#different values for gf to decrease the If
g_f_1 = [0.00427,0.002989,0.001281,0.000427,0]
t = ["time"]
V_m = {}
simulation = opencor.open_simulation("Figure4.sedml")
data = simulation.data()
data.set_ending_point(1.9)
data.set_point_interval(0.001)
for gf in g_f_1:
# reset everything in case we are running interactively and have existing results
simulation.reset(True)
simulation.clear_results()
data.constants()["i_f/g_f_1"] = gf
simulation.run()
ds = simulation.results().data_store()
V_m[gf] = ds.voi_and_variables()["Membrane/V"].values()
simulation.reset(True)
simulation.clear_results()
Time = {}
for i in range(0,1):
simulation.run()
ds = simulation.results().data_store()
Time[t[0]] = ds.voi_and_variables()["environment/time"].values()
print(Time)
V_m.update(Time)
# cache results for plotting
outfile = open("Fig04.csv", 'w')
cols = []
for key, item in V_m.items():
outfile.write(str(key) + ",")
cols.append(item)
outfile.write("\n")
for i in range(0, len(cols[0])):
for j in range(0, len(cols)):
outfile.write(str(cols[j][i]) + ",")
outfile.write("\n")
outfile.close()