Location: ICC_Lees_Green_2014 @ 881bedcb01f1 / Simulations / Plot_Fig5_ICC.py

Author:
Leyla <lnor300>
Date:
2022-09-27 19:24:59+13:00
Desc:
..
Permanent Source URI:
https://models.physiomeproject.org/workspace/83c/rawfile/881bedcb01f191d01798f0d6266263a935197ee3/Simulations/Plot_Fig5_ICC.py

# Author : Leyla Noroozbabaee
# Date: 12/09/2021
import matplotlib.pyplot as plt
import pandas as pd
from pathlib import Path

# 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.


# Figure Name
prefig = 'Fig5'
figfile = 'sim%s' % prefig

# To include the extracted data from the original paper
Fig5_Extracted_data = 1

# Set Subplot
fig, axs = plt.subplots(2,2, figsize=(8,8), facecolor='w', edgecolor='k')
fig.subplots_adjust(hspace = .2, wspace=.2)
axs = axs.ravel()
labelfontsize = 12
# Set Title
title = ['A Low-Cl(NaV)','B Low-Cl(NSCa)','C Low-Cl(NaV)','D Low-Cl(NSCa)']
for i in range(2):
    filename = 'Fig5_%da.csv' % (i + 1)
    data = pd.read_csv(filename)
    Ca_i_Ano1 = data [ 'Ca_i' ]
    Vm_Ano1 = data [ 'Vm' ]
    filename2 = 'Fig5_%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+ 2].plot(time, Ca_i_Ano1, 'b', time, Ca_i_no_Ano1, 'r')
    axs [ i ].set_xlim([ 0, 15 ])
    axs [ i + 2 ].set_xlim([ 0, 15 ])
    if i == 0 or i == 2:
        axs [ i ].plot(time, Vm_Ano1, 'b', time, Vm_no_Ano1, 'r')
        axs [ i + 2 ].plot(time, Ca_i_Ano1, 'b', time, Ca_i_no_Ano1, 'r')
        axs [ i ].set_xlim([ 5.1, 20.1 ])
        axs [ i + 2 ].set_xlim([ 5.1, 20.1 ])
    axs[i].set_title(str(title[i]))

    axs [i + 2].set_title(str(title[i+2]))
    axs [0].set_ylabel('Vm [mV]', fontsize=labelfontsize)
    axs [2].set_ylabel('Ca ($\mu$M)', fontsize=labelfontsize)
if Fig5_Extracted_data == 1:
    for i in range(4):
        filename0 = 'Fig5_origin_%da.csv' % (i + 1)
        data_folder = Path("Fig5_extracted_data")
        file0_to_open = data_folder / filename0
        data = pd.read_csv(file0_to_open)
        y_d0 = data [ 'Curve1' ]
        x_d0 = data [ 'x' ]
        filename = 'Fig5_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 == 0:
            axs [ i ].plot(6.5 + x_d0, y_d0, 'b*')
            axs [ i ].plot(6.5 + x_d, y_d, 'r*')
        elif i == 1 or i == 3:
            axs [ i ].plot(0.8 + x_d0, y_d0, 'b*')
            axs [ i ].plot( x_d, y_d, 'r*')
        elif i == 2:
            axs [ i ].plot(6.5 + x_d0, y_d0, 'b*')
            axs [ i ].plot( 6.5 + x_d, y_d, 'r*')
        else:
            axs [ i ].plot(x_d0, y_d0, 'b*')
            axs [ i ].plot(x_d, y_d, 'r*')

    axs [ 2 ].set_xlabel('Time [ms]', fontsize=labelfontsize)
    axs [ 3 ].set_xlabel('Time [ms]', fontsize=labelfontsize)
    figfiles = '%s.png' % (prefig)
    plt.savefig(figfiles)
plt.show()