- Author:
- Alan Garny <agarny@hellix.com>
- Date:
- 2021-06-11 15:36:48+12:00
- Desc:
- Merged Figure.py and Figure-plot.py into Figure3-new.py.
- Permanent Source URI:
- https://staging.physiomeproject.org/workspace/648/rawfile/e6861a389606c7399638b1116eb230a6455c9d87/Figure3.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/the/folder/this/file/is/in
# In [2]: %run Figure3.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(4.8)
data.set_point_interval(0.001)
import opencor as opencor
simulation.reset(True)
simulation.run()
# cache the reference results
ds = simulation.results().data_store()
variables = ds.voi_and_variables()
outfile = open("Figure3.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()