Location: Computational analysis of the human sinus node action potential @ ee3b51bbb18e / Figure03.py

Author:
nima <nafs080@aucklanduni.ac.nz>
Date:
2021-03-22 11:53:08+13:00
Desc:
Figure 06 and 07 Python codes
Permanent Source URI:
https://staging.physiomeproject.org/workspace/648/rawfile/ee3b51bbb18e879df1098bf0a5bd3dc16e3960fe/Figure03.py

# To reproduce the data needed for Figure 4 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 Figure03.py
#

import opencor as opencor
# import numpy as np

# load the reference model
simulation = opencor.open_simulation("https://models.physiomeproject.org/workspace/648/rawfile/53b550877456e599044a843dc57edea84f597e7f/New_HumanSAN_Fabbri_Fantini_Wilders_Severi_2017.sedml")
data = simulation.data()
data.set_ending_point(1.3)
data.set_point_interval(0.001)

import opencor as opencor

# load the reference model - Thorsen
# simulation = opencor.open_simulation("https://models.physiomeproject.org/workspace/5b8/rawfile/9228fb82a5fbade44d3e54d903710377759ffa77/Composite%20Model(Thorsen).sedml")

# reset everything in case we are running interactively and have existing results
simulation.reset(True)

# # run to steady-state
# for i in range(0, 1):
#     simulation.run()
#
# # clear the results
# simulation.clear_results()
# # set the ending time
# simulation.data().set_ending_point(600)
# # and run the steady-state simulation
simulation.run()


# cache the reference results
ds = simulation.results().data_store()
variables = ds.voi_and_variables()
outfile = open("Fig03.csv", 'w')
cols = []
for key, item in variables.items():
    outfile.write(key + ",")
    cols.append(list(item.values()))

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()