Playing vector into SEClamp

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
tab
Posts: 2
Joined: Mon Oct 28, 2013 10:04 am

Playing vector into SEClamp

Post 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
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Playing vector into SEClamp

Post by ted »

Was an error message generated when you executed your code?
tab
Posts: 2
Joined: Mon Oct 28, 2013 10:04 am

Re: Playing vector into SEClamp

Post by tab »

No, there wasn't one.

Thanks
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Playing vector into SEClamp

Post 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
Tom Close

Re: Playing vector into SEClamp

Post 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.
Post Reply