# 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 from sklearn import preprocessing import numpy as np # Figure name prefilename = 'Fig3' # Set figure dimension (width, height) in inches. fw, fh = 15, 10 # Set subplots subpRow, subpCol = 3, 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 = .3, wspace=.3) axs = axs.ravel() var_name = np.array(["Time", "bss", "gss", "btc", "gtc", "icat", "v"]) filename = '%s.csv' % (prefilename) print(filename) data = pd.read_csv(filename) print('filename', filename) data = pd.read_csv(filename) time = data [ var_name[0] ] bss_data = data [var_name[1]] gss_data = data [var_name[2]] btc_data = data [var_name[3]] gtc_data = data [var_name[4]] icat_data = data [var_name[5]] v_data = data [var_name[6]] axs[1].plot( v_data, pow(bss_data,2), 'b') axs[0].plot( v_data, gss_data, 'b') axs[2].plot( v_data, btc_data, 'b') axs[3].plot( v_data, gtc_data, 'b') #axs[4].plot( v_data, icat_data, 'b') # Set ylable tit = ['Steady state','Steady state','Time constant (ms)','Time constant (ms)','I (normalised)','I (normalised)'] cycle = plt.rcParams [ 'axes.prop_cycle' ].by_key() [ 'color' ] # To add the extracted data from original paper to your plot, modify the path to have access to the # "Extracted_data" I_V = [] prefilename = 'Fig3_4' # V =[-60] # V =[50, 40, 30, 25, 20, 10, 0,-10,-20,-30,-40,-50,-60, -70,-80] V = [-60, -50, -40, -30, -20, -10, 0, 10, 20] for i in range(len(V)): filename5 = '%s_%s.csv' % (prefilename, 8) data5 = pd.read_csv(filename5) print('filename', filename5) icat_data5 = data5 ['icat'] max_icat_data5 = max(abs(data5 ['icat'])) filename = '%s_%s.csv' % (prefilename, i) data = pd.read_csv(filename) print('filename', filename) time = data ['Time'] icat_data = data ['icat'] max_icat_data = max(data['icat']) print('max_icat_data', max_icat_data5) axs [4].plot( time, icat_data/0.20810 , color=cycle [i % 4]) MAX_I_V = (min(icat_data / max_icat_data5)) I_V.append(MAX_I_V ) # v_clamp =[50, 40, 30, 25, 20, 10, 0,-10,-20,-30,-40,-50,-60, -70,-80] print(I_V) axs[5].plot(V, I_V, '-b')# y_data = data [ var [ i ] prefilename = 'Fig3' for i in range(2): filename = '%s_%s.csv' % (prefilename, i+1) data = pd.read_csv(filename) y_d = data [ 'Curve1' ] x_d = data [ 'x' ] axs [ i ].plot(x_d, y_d, 'k*') axs [i].set_xlim([ -100, 50 ]) axs [i].set_xlabel('V (mV)', fontsize=labelfontsize) axs [i].set_ylabel('%s' % (tit[i]),fontsize=labelfontsize) figfiles = '%s.png' % (prefilename) plt.savefig(figfiles) plt.show()