I try to run a simulation step by step, using 'fadvance()' with a loop instead of 'run()'. Here is a minimal code of what I am trying to do :
Code: Select all
import neuron
from neuron import h
h.load_file('stdrun.hoc')
import numpy as np
v_init = -65
axon1 = h.Section(name='U_axon')
axon1.L = 5000
axon1.diam = 1
axon1.nseg = 100
axon1.insert('pas')
axon1.insert('hh')
h.define_shape()
h.tstop = 2
h.celsius = 33
h.finitialize(v_init)
h.v_init=v_init
h.dt = 0.001
h.fcurrent()
timeVector = h.Vector()
timeVector.record(h._ref_t)
#neuron.h.run()
while h.t < h.tstop:
h.fadvance()
t = np.array(timeVector)
print(t)
by the end of the example there is nothing recorded in the variable 't', it is an empty numpy array...if I comment the while and the content of the loop to replace it with the 'run', I get the correct time vector... What did I miss so that the steps (and all possible other variables) are not stored by using fadvance ?
I thank you in advance for your time and consideration.
all the best