Better conductance input idiom?

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

Moderator: hines

Post Reply
emuller
Posts: 15
Joined: Thu Mar 02, 2006 5:26 am
Location: Lausanne

Better conductance input idiom?

Post by emuller » Fri Aug 22, 2008 1:50 pm

Is there a better way to play a specified conductance input than what I'm doing below?

Code: Select all

# create an SEClamp object which is accessible in both python and NEURON
soma.push()
h('objref estim')
h('estim = new SEClamp(0.5)')
h.pop_section()
estim = h.estim

# Create a stimulus Vector
rs_exc = neuron.Vector(1000.0/g_exc)
#This is not possbile:
#rs_exc.play(estim,'rs')
#So I have to do this:
h('%s.play(&estim.rs,0.1)'%rs_exc.name)

csh
Posts: 52
Joined: Mon Feb 06, 2006 12:45 pm
Location: University College London
Contact:

Re: Better conductance input idiom?

Post by csh » Sat Aug 23, 2008 4:07 am

The following code worked fine for me:

Code: Select all

#! /usr/bin/python
from neuron import h
import numpy
h("""load_file("stdrun.hoc")""")
h.tstop = 10; h.dt = 0.01; h.steps_per_ms = 1.0/h.dt
soma = h.Section()
estim = h.SEClamp( soma(0.5) )
g_exc = numpy.arange( 10, 10+h.tstop, h.dt )
rs_exc = h.Vector()
rs_exc.from_python( 1000.0/g_exc )
rs_exc.play( estim._ref_rs, h.dt )
h.run()
The syntax is eplained here:
http://www.neuron.yale.edu/neuron/stati ... #HocObject
I have used the latest development code (rev. 2194) from the svn repository.
Best,
Christoph

Post Reply