@@ -14,7 +14,9 @@ def __init__(self, C_m=1, gmax_Na=120, gmax_K=36, gmax_L=0.3, E_Na=50,
1414 E_K = - 77 , E_L = - 54.387 , t_0 = 0 , t_n = 450 , delta_t = 0.01 ,
1515 I_inj_amplitude = 0 , I_inj_duration = 0 , I_inj_delay = 0 ,
1616 vc_delay = 10 , vc_duration = 30 , vc_condVoltage = - 65 ,
17- vc_testVoltage = 10 , vc_returnVoltage = - 65 , runMode = 'iclamp' ):
17+ vc_testVoltage = 10 , vc_returnVoltage = - 65 , runMode = 'iclamp' ,
18+ injected_current_plot = True , gating_plot = True , cond_dens_plot = True ,
19+ current_plot = True , memb_pot_plot = True ):
1820
1921 self .C_m = C_m
2022 """ membrane capacitance, in uF/cm^2 """
@@ -73,6 +75,13 @@ def __init__(self, C_m=1, gmax_Na=120, gmax_K=36, gmax_L=0.3, E_Na=50,
7375 self .simpleSeriesResistance = 1e7
7476 """Current will be calculated by the difference in voltage between the target and parent, divided by this value, in mOhm"""
7577
78+ # plotting conditionals
79+ self .injected_current_plot = injected_current_plot
80+ self .gating_plot = gating_plot
81+ self .cond_dens_plot = cond_dens_plot
82+ self .current_plot = current_plot
83+ self .memb_pot_plot = memb_pot_plot
84+
7685 def alpha_m (self , V ):
7786 """Channel gating kinetics. Functions of membrane voltage"""
7887 return 0.1 * (V + 40.0 )/ (1.0 - np .exp (- (V + 40.0 ) / 10.0 ))
@@ -271,46 +280,51 @@ def Main(self, init_values=[-64.99584, 0.05296, 0.59590, 0.31773]):
271280 fig = plt .figure ()
272281 fig .canvas .header_visible = False
273282
274- ax1 = plt .subplot (5 ,1 ,1 )
275- plt .xlim ([np .min (self .t ),np .max (self .t )]) #for all subplots
276- plt .title ('Simulation of Hodgkin Huxley model neuron' )
277-
278- if self .is_vclamp ():
279- i_inj_values = [self .I_inj_vclamp (t ,v ) for t ,v in zip (self .t ,V )]
280- else :
281- i_inj_values = [self .I_inj (t ) for t in self .t ]
282-
283- plt .plot (self .t , i_inj_values , 'k' )
284- plt .ylabel ('$I_{inj}$ ($\\ mu{A}/cm^2$)' )
285- if self .is_vclamp (): plt .ylim (- 2000 ,3000 )
286-
287-
288- plt .subplot (5 ,1 ,2 , sharex = ax1 )
289- plt .plot (self .t , m , 'r' , label = 'm' )
290- plt .plot (self .t , h , 'g' , label = 'h' )
291- plt .plot (self .t , n , 'b' , label = 'n' )
292- plt .ylabel ('Gating Variable' )
293- plt .legend ()
294-
295- plt .subplot (5 ,1 ,3 , sharex = ax1 )
296- plt .plot (self .t , gna , 'c' , label = '$g_{Na}$' )
297- plt .plot (self .t , gk , 'y' , label = '$g_{K}$' )
298- plt .ylabel ('Cond. dens' )
299- plt .legend ()
300-
301- plt .subplot (5 ,1 ,4 , sharex = ax1 )
302- plt .plot (self .t , ina , 'c' , label = '$I_{Na}$' )
303- plt .plot (self .t , ik , 'y' , label = '$I_{K}$' )
304- plt .plot (self .t , il , 'm' , label = '$I_{L}$' )
305- plt .ylabel ('Current' )
306- plt .legend ()
307-
308- plt .subplot (5 ,1 ,5 , sharex = ax1 )
309- plt .plot (self .t , V , 'k' )
310- plt .ylabel ('V (mV)' )
311- plt .xlabel ('t (ms)' )
312- if not self .is_vclamp (): plt .ylim (- 85 ,60 )
313- #plt.ylim(-1, 40)
283+ if self .injected_current_plot :
284+ ax1 = plt .subplot (5 ,1 ,1 )
285+ plt .xlim ([np .min (self .t ),np .max (self .t )]) #for all subplots
286+ plt .title ('Simulation of Hodgkin Huxley model neuron' )
287+
288+ if self .is_vclamp ():
289+ i_inj_values = [self .I_inj_vclamp (t ,v ) for t ,v in zip (self .t ,V )]
290+ else :
291+ i_inj_values = [self .I_inj (t ) for t in self .t ]
292+
293+ plt .plot (self .t , i_inj_values , 'k' )
294+ plt .ylabel ('$I_{inj}$ ($\\ mu{A}/cm^2$)' )
295+ if self .is_vclamp (): plt .ylim (- 2000 ,3000 )
296+
297+
298+ if self .gating_plot :
299+ plt .subplot (5 ,1 ,2 , sharex = ax1 )
300+ plt .plot (self .t , m , 'r' , label = 'm' )
301+ plt .plot (self .t , h , 'g' , label = 'h' )
302+ plt .plot (self .t , n , 'b' , label = 'n' )
303+ plt .ylabel ('Gating Variable' )
304+ plt .legend ()
305+
306+ if self .cond_dens_plot :
307+ plt .subplot (5 ,1 ,3 , sharex = ax1 )
308+ plt .plot (self .t , gna , 'c' , label = '$g_{Na}$' )
309+ plt .plot (self .t , gk , 'y' , label = '$g_{K}$' )
310+ plt .ylabel ('Cond. dens' )
311+ plt .legend ()
312+
313+ if self .current_plot :
314+ plt .subplot (5 ,1 ,4 , sharex = ax1 )
315+ plt .plot (self .t , ina , 'c' , label = '$I_{Na}$' )
316+ plt .plot (self .t , ik , 'y' , label = '$I_{K}$' )
317+ plt .plot (self .t , il , 'm' , label = '$I_{L}$' )
318+ plt .ylabel ('Current' )
319+ plt .legend ()
320+
321+ if self .memb_pot_plot :
322+ plt .subplot (5 ,1 ,5 , sharex = ax1 )
323+ plt .plot (self .t , V , 'k' )
324+ plt .ylabel ('V (mV)' )
325+ plt .xlabel ('t (ms)' )
326+ if not self .is_vclamp (): plt .ylim (- 85 ,60 )
327+ #plt.ylim(-1, 40)
314328
315329 plt .tight_layout ()
316330
0 commit comments