Location: Imtiaz_IP3_2002 @ 4624ea7e4bf5 / Simulation / Figure6 / Plot_Fig6.py

Author:
Leyla <lnor300>
Date:
2022-11-02 15:31:28+13:00
Desc:
..
Permanent Source URI:
https://models.fieldml.org/workspace/763/rawfile/4624ea7e4bf53d57d1f03fbbc2791d8e953ace0b/Simulation/Figure6/Plot_Fig6.py

# Author: Leyla Noroozbabaee
# Date: 12/12/2021
# To reproduce Figure 6 from original paper, the python file 'Fig6_sim.py' should be run.

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
# Figure name
prefilename = 'Fig6'
figfile = 'Figure6'
# Read data from the files
x_name = 'Time'
y_name = [ 'vm']
# set the stimulus range
I_clamp1 = np.linspace(-35, 35, num=30)
# Set figure dimension (width, height) in inches.
fw, fh = 15, 6
# Set subplots
subpRow, subpCol = 1, 2
ax, lns = {}, {}
# This gives list with the colors from the cycle, which you can use to iterate over.
cycle = plt.rcParams [ 'axes.prop_cycle' ].by_key() [ 'color' ]
# Set subplots
lfontsize, labelfontsize = 10, 15  # legend, label fontsize
fig, axs = plt.subplots(subpRow, subpCol, figsize=(fw, fh), facecolor='w', edgecolor='k')
fig.subplots_adjust(hspace = .1, wspace=.1)
j = 0
for index, i in enumerate(I_clamp1):
    j = j+1
    if j < 16:
        filename = '%s_%s.csv' % (prefilename, index)
        data = pd.read_csv(filename)
        x_data = data [ x_name ]
        y_data = data [ y_name ]
        axs[1].plot(x_data, y_data)
        axs[1].set_xlim([ 0, 3 ])
        axs[1].set_ylim([-100, -30 ])
        axs [1].set_xlabel('Time (min)', fontsize=labelfontsize)
    else:
        filename = '%s_%s.csv' % (prefilename, index)
        data = pd.read_csv(filename)
        x_data = data [ x_name ]
        y_data = data [ y_name ]
        axs [0 ].plot(x_data, y_data)
        axs [0 ].set_xlim([ 0, 1.5])
        axs [0 ].set_ylim([ -70, -20 ])
        axs [ 0 ].set_ylabel('V (mV)', fontsize=labelfontsize)
        axs [ 0 ].set_xlabel('Time (min)', fontsize=labelfontsize)

figfiles = '%s.png' % figfile
plt.savefig(figfiles)
plt.show()