Here is a small example:
Code: Select all
from neuron import h
# adaptive integration
h.load_file("stdrun.hoc") # reverse order between this and the following two lines
cvode = h.CVode()
cvode.active(1)
# create cell
h.nrn_load_dll('../demo/channels/i686/.libs/libnrnmech.so')
soma = h.Section(name='soma')
soma.insert('pas')
# insert IClamp
iclamp = h.IClamp(soma(.5))
iclamp.amp = 1
iclamp.delay = 20.0
iclamp.dur = 40.0
# record the time
t_rec = h.Vector()
t_rec.record(h._ref_t)
# run simulation
dt = 0.01
tstop = 100
h.v_init = -60
h.tstop = tstop
h.steps_per_ms = 1.0 / dt
h.dt = dt
h.run()
# output
print tstop
print t_rec[-1]
assert tstop == t_rec[-1]