Transient voltage clamp to assess action potential stability.
Force a discontinuous change in potential during an Action Potential
To work properly with variable time step methods, models that change states and/or parameters discontinuously during a simulation must notify NEURON when such events take place. This exercise illustrates the kinds of problems that occur when a model is changed without reinitializing the variable step integrator.
Start with a current pulse stimulated HH patch. We recommend that you try creating this yourself with a brief current pulse at t = 0.1, either in Python or with the GUI tools. Our Python solution is hh_patch.py.
def change():
print('change at %g' % h.t)
soma.v += 20
def setup_discontinuities():
h.cvode.event(2, change)
fih = h.FInitializeHandler(setup_discontinuities)
Note the difference between the fixed and variable step methods.
change()
function with the following and try again:
def change():
print('change at %g' % h.t)
soma.v += 20
h.cvode.re_init()
def change(action):
print('change at %g: %s' % (h.t, action))
if action == 'raise':
soma(0.5).hh.gnabar *= 2
else:
soma(0.5).hh.gnabar /= 2
# h.cvode.re_init() # should be here for cvode, but see below
def setup_discontinuities():
h.cvode.event(2, (change, 'raise'))
h.cvode.event(3, (change, 'lower'))
fih = h.FInitializeHandler(setup_discontinuities)
It will be helpful to use the Crank-Nicholson fixed step method and compare the variable step method with and without the cvode.re_init()
. Zoom in around the discontinuity at 2 ms.