@@ -9,7 +9,7 @@ class HodgkinHuxley():
99 """ __init__ uses optional arguments """
1010 """ when no argument is passed default values are used """
1111
12- def __init__ (self , C_m = 1 , g_Na = 120 , g_K = 36 , g_L = 0.3 , E_Na = 50 , E_K = - 77 , E_L = - 54.387 , t_0 = 0 , t_n = 450 , delta_t = 0.01 ):
12+ def __init__ (self , C_m = 1 , g_Na = 120 , g_K = 36 , g_L = 0.3 , E_Na = 50 , E_K = - 77 , E_L = - 54.387 , t_0 = 0 , t_n = 450 , delta_t = 0.01 , I_inj_max = 0 , I_inj_width = 0 , I_inj_trans = 0 ):
1313
1414 self .C_m = C_m
1515 """ membrane capacitance, in uF/cm^2 """
@@ -33,7 +33,18 @@ def __init__(self, C_m=1, g_Na=120, g_K=36, g_L=0.3, E_Na=50, E_K=-77, E_L=-54.3
3333 """ Leak Nernst reversal potentials, in mV """
3434
3535 self .t = np .arange (t_0 , t_n , delta_t )
36- """ The time to integrate over """
36+ """ The time to integrate over """
37+
38+ """ Advanced input - injection current (single rectangular pulse only) """
39+
40+ self .I_inj_max = I_inj_max
41+ """ maximum value or amplitude of injection pulse """
42+
43+ self .I_inj_width = I_inj_width
44+ """ duration or width of injection pulse """
45+
46+ self .I_inj_trans = I_inj_trans
47+ """ strart time of injection pulse or tranlation about time axis """
3748
3849 def alpha_m (self , V ):
3950 """Channel gating kinetics. Functions of membrane voltage"""
@@ -103,7 +114,19 @@ def I_inj(self, t):
103114 | step up to 35 uA/cm^2 at t>300
104115 | step down to 0 uA/cm^2 at t>400
105116 """
106- return 10 * (t > 100 ) - 10 * (t > 200 ) + 35 * (t > 300 ) - 35 * (t > 400 )
117+
118+ """ running standalone python script """
119+ if __name__ == '__main__' :
120+ return 10 * (t > 100 ) - 10 * (t > 200 ) + 35 * (t > 300 ) - 35 * (t > 400 )
121+
122+ #""" running jupyterLab notebook """
123+ #advanced input (if checkbox selected)
124+ elif self .I_inj_width > 0 :
125+ return self .I_inj_max * (t > self .I_inj_trans ) - self .I_inj_max * (t > self .I_inj_trans + self .I_inj_width )
126+
127+ #basic input
128+ else :
129+ return 10 * (t > 100 ) - 10 * (t > 200 ) + 35 * (t > 300 ) - 35 * (t > 400 )
107130
108131 @staticmethod
109132 def dALLdt (X , t , self ):
0 commit comments