In [1]:
from neuron import h
h.load_file('stdrun.hoc')
Out[1]:
In [2]:
soma = h.Section(name = 'soma')
In [3]:
# morphology
soma.L = 25.55
soma.diam = 25.55
soma.Ra = 125
# passive properties
soma.insert('pas')
soma.g_pas = 6.66667e-05
soma.e_pas = -89 # will be adjusted later accordingly
In [4]:
def mysimulation(tstop, v_init):
"""
Simulates the membrane potential
Arguments:
tstop -- simulation time (i.e h.tstop)
v_init -- starting potential (i.e h.v_init)
Returns:
time and voltage as NumPy arrays
"""
h.tstop = tstop
h.v_init = h.v_init
voltage, time = h.Vector(), h.Vector()
voltage.record( soma(0.5)._ref_v, sec=soma)
time.record(h._ref_t)
h.run()
plt.plot( np.array(time), np.array(voltage) )
In [5]:
from CA3.utils import optimize_e_pas
h.v_init = -89
optimize_e_pas(mysec = soma) # should be -89 mV
Out[5]:
In [6]:
soma.insert('hh')
Out[6]:
In [7]:
optimize_e_pas(mysec = soma)
Out[7]:
In [8]:
stim = h.IClamp(0.5, sec=soma)
stim.dur = 2
stim.amp = 0
stim.delay = 10
In [9]:
soma.e_pas = -245.26937943
stim.amp = 2
In [11]:
mysimulation(tstop = 50, v_init = -89.)
In [ ]: