I am using the Vector.play method to set the values of a parameter inside one of my mod files. I started with a toy example that I found here in the forums viewtopic.php?p=19985&hilit=play+vectors#p19985. I made some minor modifications, mainly using single segment Sections.
For my use case it made sense to have my own function to set the play vectors, so I used the same code but took out the portion setting the play vectors and used it to create a function
Code: Select all
def set_play_vec(cell):
data = h.Vector([0,5,17,2,4,38,22,43,1, 1])
time = h.Vector([1,2,3,4,5,6,7,8,9,10])
data.play(cell(0.5).playtest._ref_xx, time, True)
# Create NEURON Section
my_cell = h.Section("neurite")
# Set play vector
set_play_vec(my_cell)
t = h.Vector().record(h._ref_t)
xxp1 = h.Vector().record(my_cell(0.1).playtest._ref_xx)
xxp2 = h.Vector().record(my_cell(0.9).playtest._ref_xx)
h.finitialize(-65 * mV)
h.continuerun(10 * ms)
plt.plot(t, xxp1, label="xxp1")
plt.plot(t, xxp2, label="xxp2")
plt.legend()
plt.show()
Code: Select all
def set_play_vec(cell):
data = h.Vector([0,5,17,2,4,38,22,43,1, 1])
time = h.Vector([1,2,3,4,5,6,7,8,9,10])
data.play(cell(0.5).playtest.xx, time, True)
return data, time
# Create NEURON Section
my_cell = h.Section(name='neurite')
# Set play vector
data, time = set_play_vec(my_cell)
t = h.Vector().record(h._ref_t)
xxp1 = h.Vector().record(my_cell(0.1).playtest._ref_xx)
xxp2 = h.Vector().record(my_cell(0.9).playtest._ref_xx)
h.finitialize(-65 * mV)
h.continuerun(10 * ms)
plt.plot(t, xxp1, label="xxp1")
plt.plot(t, xxp2, label="xxp2")
plt.legend()
plt.show()
Code: Select all
global data
global time
data = h.Vector([ 1,5,17,2,4,38,22,43,1, 1])
time = h.Vector([1,2,3,4,5,6,7,8,9,10])