Page 1 of 1

Playing vector into SEClamp

Posted: Mon Oct 28, 2013 3:26 pm
by tab
Hi,

I have not been successful in playing a vector into a SEClamp process using Python. Everything works fine when setting amp1-3 and dur1-3, but when I try to play a vector into amp1 it doesn't update it's value (if I don't set amp1 it stays 0; it also doesn't seem to care whether I set any amp and dur). I'm trying:

Code: Select all

model.vclamp = h.SEClamp(model.soma(0.5))
cmd = h.Vector(-40 * np.ones(100))
cmd.play(model.vclamp.amp1)                
 # cmd.play(model.vclamp._ref_amp1, h.Vector(np.arange(0,100)) does the same thing
Any pointers in the right direction would be much appreciated.

Thanks,

Tiago

Re: Playing vector into SEClamp

Posted: Tue Oct 29, 2013 11:39 am
by ted
Was an error message generated when you executed your code?

Re: Playing vector into SEClamp

Posted: Thu Oct 31, 2013 3:05 am
by tab
No, there wasn't one.

Thanks

Re: Playing vector into SEClamp

Posted: Thu Oct 31, 2013 10:10 am
by ted
Are you quite sure there isn't any error message? Did you scroll the xterm back to NEURON's startup message, examining each line that the interpreter prints out after NEURON starts up?

I don't have all the code you're working with, so I can't tell if there are problems elsewhere in it that might interfere with vector play, but maybe you can glean something useful from this working example:

Code: Select all

from neuron import h
import numpy as np

h.load_file("nrngui.hoc") # load standard run system
# load stdgui.hoc instead if you don't want to see the NEURONMainMenu toolbar 

cell = h.Section()
cell.insert('pas')

clamp = h.SEClamp(cell(0.5))
clamp.rs = 1e-3 # series resistance should be much smaller than input resistance of the cell
clamp.dur1 = 1e9

cmd = h.Vector(-40*np.ones(100))
cmd.play(clamp._ref_amp1, h.dt)
h.v_init = -40 # same as initial clamp command
# to prevent a big membrane potential transient right after t=0

h.run() # simulation should demonstrate working vector play

Re: Playing vector into SEClamp

Posted: Sun Jun 29, 2014 5:35 am
by Tom Close
I'm pretty sure the key here is to set the duration of the SEClamp (as in Ted's example) to something very long such as 1e9 and then it should work.