@@ -15,7 +15,8 @@ def __init__(self, C_m=1, gmax_Na=120, gmax_K=36, gmax_L=0.3, E_Na=50,
1515 I_inj_amplitude = 0 , I_inj_duration = 0 , I_inj_delay = 0 ,
1616 vc_delay = 10 , vc_duration = 30 , vc_condVoltage = - 65 ,
1717 vc_testVoltage = 10 , vc_returnVoltage = - 65 , runMode = 'iclamp' ,
18- injected_current_plot = True , gating_plot = True , cond_dens_plot = True ,
18+ injected_current_plot = True , gating_plot = True , scaling_plot = True ,
19+ cond_dens_plot = True , driving_force_plot = True ,
1920 current_plot = True , memb_pot_plot = True ):
2021
2122 self .C_m = C_m
@@ -78,12 +79,15 @@ def __init__(self, C_m=1, gmax_Na=120, gmax_K=36, gmax_L=0.3, E_Na=50,
7879 # plotting conditionals
7980 self .injected_current_plot = injected_current_plot
8081 self .gating_plot = gating_plot
82+ self .scaling_plot = scaling_plot
8183 self .cond_dens_plot = cond_dens_plot
84+ self .driving_force_plot = driving_force_plot
8285 self .current_plot = current_plot
8386 self .memb_pot_plot = memb_pot_plot
8487
8588 self .num_plots = (int (self .injected_current_plot ) +
86- int (self .gating_plot ) + int (self .cond_dens_plot ) +
89+ int (self .gating_plot )+ int (self .scaling_plot ) +
90+ int (self .cond_dens_plot ) + int (self .driving_force_plot ) +
8791 int (self .current_plot ) + int (self .memb_pot_plot ))
8892
8993 self .plot_count = 0
@@ -310,10 +314,24 @@ def Main(self, init_values=[-64.99584, 0.05296, 0.59590, 0.31773]):
310314 except NameError :
311315 ax1 = plt .subplot (self .num_plots ,1 ,self .plot_count + 1 )
312316 plt .title ('Simulation of Hodgkin Huxley model neuron' )
313- plt .plot (self .t , m , 'r' , label = 'm' )
314- plt .plot (self .t , h , 'g' , label = 'h' )
315- plt .plot (self .t , n , 'b' , label = 'n' )
316- plt .ylabel ('Gating Variable' )
317+ plt .plot (self .t , m , 'r' , label = '$m$' )
318+ plt .plot (self .t , h , 'g' , label = '$h$' )
319+ plt .plot (self .t , n , 'b' , label = '$n$' )
320+ plt .ylabel ('Gating variable' )
321+ plt .legend ()
322+ self .plot_count += 1
323+
324+ if self .scaling_plot :
325+ try :
326+ plt .subplot (self .num_plots ,1 ,self .plot_count + 1 , sharex = ax1 )
327+ except NameError :
328+ ax1 = plt .subplot (self .num_plots ,1 ,self .plot_count + 1 )
329+ plt .title ('Simulation of Hodgkin Huxley model neuron' )
330+ scale_na = m * m * m * h
331+ scale_k = n * n * n * n
332+ plt .plot (self .t , scale_na , 'c' , label = '$m^{3}h$' )
333+ plt .plot (self .t , scale_k , 'y' , label = '$n^{4}$' )
334+ plt .ylabel ('Cond scaling' )
317335 plt .legend ()
318336 self .plot_count += 1
319337
@@ -325,8 +343,34 @@ def Main(self, init_values=[-64.99584, 0.05296, 0.59590, 0.31773]):
325343 plt .title ('Simulation of Hodgkin Huxley model neuron' )
326344 plt .plot (self .t , gna , 'c' , label = '$g_{Na}$' )
327345 plt .plot (self .t , gk , 'y' , label = '$g_{K}$' )
328- plt .ylabel ('Cond. dens ($mS/cm^2$)' )
346+ plt .ylabel ('Cond dens ($mS/cm^2$)' )
347+ plt .legend ()
348+ self .plot_count += 1
349+
350+
351+ if self .driving_force_plot :
352+ try :
353+ ax_here = plt .subplot (self .num_plots ,1 ,self .plot_count + 1 , sharex = ax1 )
354+ except NameError :
355+ ax1 = plt .subplot (self .num_plots ,1 ,self .plot_count + 1 )
356+ plt .title ('Simulation of Hodgkin Huxley model neuron' )
357+ ax_here = ax1
358+
359+ dna = V - self .E_Na
360+ dk = V - self .E_K
361+ zero = [0 for v in V ]
362+
363+ #plt.plot(self.t, dna, 'c', label='$V - E_{Na}$')
364+ ax_here .fill_between (self .t , dna , color = 'c' , alpha = 0.5 )
365+ ax_here .fill_between (self .t , dk , color = 'y' , alpha = 0.5 )
366+
367+ plt .plot (self .t , dna , 'c' , label = '$V - E_{Na}$' , linewidth = 0.8 )
368+ plt .plot (self .t , dk , 'y' , label = '$V - E_{K}$' , linewidth = 0.8 )
369+ plt .plot (self .t , zero , 'k' , linestyle = 'dashed' , linewidth = 0.5 )
370+ plt .ylabel ('Driving force (mV)' )
329371 plt .legend ()
372+ #if not self.is_vclamp(): plt.ylim(-85,60)
373+ #plt.ylim(-1, 40)
330374 self .plot_count += 1
331375
332376 if self .current_plot :
@@ -338,7 +382,7 @@ def Main(self, init_values=[-64.99584, 0.05296, 0.59590, 0.31773]):
338382 plt .plot (self .t , ina , 'c' , label = '$I_{Na}$' )
339383 plt .plot (self .t , ik , 'y' , label = '$I_{K}$' )
340384 plt .plot (self .t , il , 'm' , label = '$I_{L}$' )
341- plt .ylabel ('Current ($\\ mu{A}/cm^2$)' )
385+ plt .ylabel ('Curr dens ($\\ mu{A}/cm^2$)' )
342386 plt .legend ()
343387 self .plot_count += 1
344388
@@ -350,7 +394,7 @@ def Main(self, init_values=[-64.99584, 0.05296, 0.59590, 0.31773]):
350394 plt .title ('Simulation of Hodgkin Huxley model neuron' )
351395 plt .plot (self .t , V , 'k' )
352396 plt .ylabel ('$V_{m}$ (mV)' )
353- plt .xlabel ('t (ms)' )
397+ plt .xlabel ('Time (ms)' )
354398 if not self .is_vclamp (): plt .ylim (- 85 ,60 )
355399 #plt.ylim(-1, 40)
356400 self .plot_count += 1
0 commit comments