- Author:
- nima <nafs080@aucklanduni.ac.nz>
- Date:
- 2020-10-29 09:32:37+13:00
- Desc:
- All the Cellml files, Sedml files and python scripts for figures are added
- Permanent Source URI:
- https://models.physiomeproject.org/workspace/607/rawfile/f725b6864f22a00138a2c2455308142c8baba373/Figure01.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 Figure01.py
#
import opencor as opencor
# import numpy as np
# Na_m = [0.13, 0.1275, 0.125, 0.1175, 0.11, 0.105]
# Cl_m = [0.131, 0.1285, 0.126, 0.1185, 0.111, 0.106]
# glucose_m = [0.0, 0.005, 0.01, 0.025, 0.04, 0.05]
#######
#pH(rbc) is a variable
P50 = {}
simulation = opencor.open_simulation("Figure01(UL).sedml")
data = simulation.data()
data.set_ending_point(0.96)
data.set_point_interval(0.08)
# for i, glu_m in enumerate(glucose_m):
# # reset everything in case we are running interactively and have existing results
# simulation.reset(True)
# simulation.clear_results()
#
# data.constants()["Apical_concentrations/Na_m"] = Na_m[i]
# data.constants()["Apical_concentrations/Cl_m"] = Cl_m[i]
# data.constants()["Apical_concentrations/glucose_m"] = glu_m
simulation.reset(True)
simulation.run()
# cache the reference results
ds = simulation.results().data_store()
variables = ds.voi_and_variables()
outfile = open("P501.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()
#
simulation = opencor.open_simulation("Figure01(UR).sedml")
data = simulation.data()
data.set_ending_point(117)
data.set_point_interval(10)
simulation.reset(True)
simulation.clear_results()
data.constants()["main/pH"] = 7.24
simulation.run()
ds = simulation.results().data_store()
variables = ds.voi_and_variables()
outfile = open("P502.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()
simulation = opencor.open_simulation("Figure01(BL).sedml")
data = simulation.data()
data.set_ending_point(7.2)
data.set_point_interval(0.6)
simulation.reset(True)
simulation.clear_results()
data.constants()["main/pH"] = 7.24
simulation.run()
ds = simulation.results().data_store()
variables = ds.voi_and_variables()
outfile = open("P503.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()
simulation = opencor.open_simulation("Figure01(BR).sedml")
data = simulation.data()
data.set_ending_point(30)
data.set_point_interval(2.5)
simulation.reset(True)
simulation.clear_results()
data.constants()["main/pH"] = 7.24
simulation.run()
ds = simulation.results().data_store()
variables = ds.voi_and_variables()
outfile = open("P504.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()