Page 1 of 1

RangeVarPlot and access

Posted: Wed Feb 24, 2010 6:11 pm
by adamimos
Hello,

I am trying to make a very simple simulation where I have two sections which are connected. I put in constant DC current in the end of one of the sections, and I want to look at the steady state membrane potential distribution across both sections. I am using neuron in python. I have made a simple function which looks like this (the funtion make_section() is a very basic one I made housed in simpleNrnLib):

Code: Select all

from simpleNrnLib import *

def simpleComputational():


    dend = make_section("dend")
    dend.L = 1000
    dend.diam = 10
    dend.nseg = 21
    dend.insert('pas')

    soma = make_section("soma")
    soma.L = 1000
    soma.diam = 10
    soma.nseg = 21
    soma.insert('pas')



    soma.connect(dend,1,0)  # connect dend(1) to soma(0)

    for sec in h.allsec():
        sec.Ra = 200
        sec.cm = 5.001
        for seg in sec:
            seg.pas.g = 5e-5
            seg.pas.e = 0



    iClamp = make_iClamp(dend(0))
    iClamp.delay = 10
    iClamp.amp = 1.2
    iClamp.dur = 500000
    
    voltage = h.RangeVarPlot("v")
    voltage.begin(0)
    voltage.end(1)

    tstop = 5000
    v_init = -60
    h.dt = 0.025

    h.finitialize(v_init)
    h.fcurrent()
    run(tstop)

    vVec = h.Vector()
    pVec = h.Vector()
    voltage.to_vector(vVec,pVec)

    return pVec,vVec
I am wondering how I can control if the RangeVarPlot accesses the soma or dendrite. I tried using h.access("soma") but I get an error: "TypeError: no HocObject interface for access (hoc type 306)". Is there a way I can do it directly when I call RangeVarPlot?

Thanks

Re: RangeVarPlot and access

Posted: Thu Feb 25, 2010 12:14 pm
by ted
soma.connect(dend,1,0) # connect dend(1) to soma(0)
does not do what you think it does. It connects soma(0) to dend(1).

But you don't want to connect dend(1) to soma(0) either, because NEURON's range variable plots interpret the "direction of increasing distance from the root of the tree" as being from the 0 to the 1 end. Connecting soma(0) to dend(1) will force the plots of v in soma and dend to be drawn on top of each other, not end to end.

Instead, connect dend(0) to soma(1), which is done by
dend.connect(soma,1,0)
(read NEURON and Python by Hines et al. 2009, available from the "Publications about NEURON" page
http://www.neuron.yale.edu/neuron/nrnpubs
)

Somebody else is going to have to help you with RangeVarPlot.

Re: RangeVarPlot and access

Posted: Thu Feb 25, 2010 2:04 pm
by hines
There is no direct python equivalent of the hoc access statement in python although you can
always h('access ...'). The nearest is
section.push()
but there is a limited amount of section stack space and there should always be a
h.pop_section()
when one is done with the section.

The RangeVarPlot methods are described at
http://www.neuron.yale.edu/neuron/stati ... arplt.html
and can all be directly used from Python (if a cwd is needed, use a last named argument of
sec = ...)