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

Author:
nima <nafs080@aucklanduni.ac.nz>
Date:
2021-04-28 12:46:11+12:00
Desc:
Updated files with the values in the MATLAB code, results reproduce all the figures except last panel in figure05.png
Permanent Source URI:
https://staging.physiomeproject.org/workspace/648/rawfile/91fc8744fa9895ca7e3907cdc7b6b3dfd2d7bbbc/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("HumanSAN_Fabbri_Fantini_Wilders_Severi_2017.sedml")
data = simulation.data()
data.set_ending_point(1.6)
data.set_point_interval(0.001)

import opencor as opencor


simulation.reset(True)


simulation.run()
simulation.clear_results()
simulation.run()
simulation.clear_results()
simulation.run()
# simulation.clear_results()
# simulation.run()
# simulation.clear_results()
# simulation.run()
# simulation.clear_results()
# 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()