Play a Unique Vector to Each Model Segment
Posted: Thu Jul 27, 2023 2:46 pm
How can I play a unique vector into an arbitrary variable in each of an arbitrary number of cell segments? For example, in this NMODL file
I would like to play into the variable xx. I've tried several keywords to define xx, as you can see.
This Python script is how I am using vector.play()
Is my .mod file bad? Or my Python? In all the cases except GLOBAL (which functions, but doesn't appear to enable me to play in unique vector to each segment) and POINTER (doesn't function, but I can't determine why), there is no error.
Code: Select all
NEURON {
SUFFIX playtest
:RANGE xx : doesn't work
:NONSPECIFIC_CURRENT xx : doesn't work
:GLOBAL xx : works, but inflexible
:ELECTRODE_CURRENT xx : doesn't work
:POINTER xx : can't figure out proper usage
NONSPECIFIC_CURRENT ixi
}
UNITS {
(mV) = (millivolt)
(mA) = (milliamp)
(mS) = (millisiemens)
(S) = (siemens)
(nW) = (nanowatts)
(uA) = (microamp)
(uF) = (microfarads)
}
PARAMETER {
}
ASSIGNED {
celsius (degC)
v (mV)
xx (mA)
ixi (mA)
}
INITIAL { ixi = 0
}
BREAKPOINT {
ixi = xx*2
}
This Python script is how I am using vector.play()
Code: Select all
from neuron import h
from matplotlib import pyplot as plt
h.load_file("stdrun.hoc")
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])
cell = h.Section(name='neurite')
cell.nseg = 2 # arbitrary
cell.L = 40 # arbitrary
cell.diam = 5 # arbitrary
for sec in h.allsec():
sec.insert(h.playtest)
sec.insert(h.hh)
for seg in sec:
data.play(seg.playtest.xx, time, True)
t = h.Vector().record(h._ref_t)
v = h.Vector().record(cell(0.5)._ref_v)
xxp = h.Vector().record(cell(0.5).playtest._ref_xx)
# xxp = h.Vector().record(h._ref_xx_playtest) # for GLOBAL implementation
# data.play(h._ref_xx_playtest, time, True) # for GLOBAL implementation
h.finitialize(-65)
h.continuerun(10)
plt.plot(t,xxp)
plt.show()