- Author:
- Leyla <lnor300>
- Date:
- 2022-09-27 18:32:30+13:00
- Desc:
- ...
- Permanent Source URI:
- https://models.cellml.org/workspace/83c/rawfile/d5463b9ed6e0280cd3b71eaf70db83a205db3d94/Simulations/Plot_Fig4_ICC.py
# Author: Leyla Noroozbabaee
# Date: 12/09/2021
# To reproduce Figure 4 and 5 from original paper, the python file 'ICC_Lees_Green.py'
# should be run in the Python console in OpenCOR.
import matplotlib.pyplot as plt
from pathlib import Path
import pandas as pd
# Figure Name
prefig = 'Fig_4'
# To include the extracted data from the original paper
Fig4_Extracted_data = 1
# Set Subplot
fig, axs = plt.subplots(2, 4, figsize=(14, 7), facecolor='w', edgecolor='k')
fig.subplots_adjust(hspace =.25, wspace=.25)
axs = axs.ravel()
labelfontsize = 12
# Set Title
title = ['A High-Cl(NaV)', 'B High-Cl(NSV)','C High-Cl(NSCa)','D High-Cl(CaV)','E High-Cl(NaV)','F High-Cl(NSV)',
'G High-Cl(NSCa)', 'H High-Cl(CaV)']
for i in range(4):
filename1 = 'Fig4_%da.csv' % (i + 1)
data = pd.read_csv(filename1)
Ca_i_Ano1 = data [ 'Ca_i' ]
Vm_Ano1 = data [ 'Vm' ]
filename2 = 'Fig4_%db.csv' % (i + 1)
data = pd.read_csv(filename2)
time = data ['time']
Ca_i_no_Ano1 = data ['Ca_i']
Vm_no_Ano1 = data [ 'Vm' ]
axs[i].plot(time, Vm_Ano1, 'b', time, Vm_no_Ano1, 'r')
axs[i + 4].plot(time, Ca_i_Ano1, 'b', time, Ca_i_no_Ano1, 'r')
axs[i].set_title(str(title[i]))
axs [ i ].set_xlim([ 0, 15 ])
axs [ i + 4 ].set_xlim([ 0, 15 ])
if i == 3 or i == 7:
axs [ i ].plot(time, Vm_Ano1, 'b', time, Vm_no_Ano1, 'r')
axs [ i + 4 ].plot(time, Ca_i_Ano1, 'b', time, Ca_i_no_Ano1, 'r')
axs [ i ].set_xlim([ 5.1, 20.1 ])
axs [ i + 4].set_xlim([ 5.1, 20.1 ])
axs[i+4].set_title(str(title[i+4]))
axs [i+4 ].set_xlabel('Time [ms]', fontsize=labelfontsize)
if Fig4_Extracted_data == 1:
for i in range(8):
filename0 = 'Fig4_origin_%da.csv' % (i + 1)
data_folder = Path("Fig4_extracted_data")
file0_to_open = data_folder / filename0
data = pd.read_csv(file0_to_open)
y_d0 = data [ 'Curve1' ]
x_d0 = data [ 'x' ]
filename = 'Fig4_origin_%db.csv' % (i + 1)
file_to_open = data_folder / filename
data = pd.read_csv(file_to_open)
y_d = data [ 'Curve1' ]
x_d = data [ 'x' ]
if i == 3 or i == 7:
axs [ i ].plot(5+x_d0, y_d0, 'b*')
axs [ i ].plot(5+x_d, y_d, 'r*')
elif i == 2 or i == 6:
axs [ i ].plot(0.8+x_d0, y_d0, 'b*')
axs [ i ].plot(0.8+x_d, y_d, 'r*')
elif i == 0 :
axs [ i ].plot(0.6+x_d0, y_d0, 'b*')
axs [ i ].plot(0.6+x_d, y_d, 'r*')
elif i == 5 :
axs [ i ].plot(x_d0, y_d0, 'b*')
axs [ i ].plot(0.9+x_d, y_d, 'r*')
elif i == 4 :
axs [ i ].plot(1+x_d0, y_d0, 'b*')
axs [ i ].plot(x_d, y_d, 'r*')
else:
axs [ i ].plot(x_d0, y_d0, 'b*')
axs [ i ].plot(x_d, y_d, 'r*')
figfiles = '%s.png' % (prefig)
plt.savefig(figfiles)
figfiles = '%s.pdf' % (prefig)
plt.savefig(figfiles)
axs [0].set_ylabel('Vm [mV]', fontsize=labelfontsize)
axs [4].set_ylabel('Ca ($\mu$M)', fontsize=labelfontsize)
figfiles = '%s.png' % (prefig)
plt.savefig(figfiles)
plt.show()