Since there is only one instance of stim_vec, I would have expected every segment to get the same last external_voltage 1d array.
Perhaps you need an array of stim_vec as in
stim_vec = []
...........
stim_vec.append(Vector(external_voltage[:,i])
stim_vec[-1].play(seg....)
However, I would not have expected that last external voltage to be alternating +-0 so perhaps there is a bug in the
transfer of the numpy 1-d array to a Vector. Your fragment does not exhibit the creation of the 2-d numpy array. A complete
fragment would help me see the problem and work on a diagnosis. The following test
Code: Select all
import numpy
a=numpy.matrix([[1,2],[3,4]])
from neuron import h
v = h.Vector(a[:,0])
v.printf()
for i in range(0,2):
v.from_python(a[:,i])
v.printf()
produces the correct output