RangeVarPlot and access

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

Moderator: hines

Post Reply
Posts: 45
Joined: Mon Jan 25, 2010 4:49 pm

RangeVarPlot and access

Post by adamimos »


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

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

    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")

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


    vVec = h.Vector()
    pVec = h.Vector()

    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?

Site Admin
Posts: 5878
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

Re: RangeVarPlot and access

Post 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
(read NEURON and Python by Hines et al. 2009, available from the "Publications about NEURON" page

Somebody else is going to have to help you with RangeVarPlot.
Site Admin
Posts: 1619
Joined: Wed May 18, 2005 3:32 pm

Re: RangeVarPlot and access

Post by hines »

There is no direct python equivalent of the hoc access statement in python although you can
always h('access ...'). The nearest is
but there is a limited amount of section stack space and there should always be a
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 = ...)
Post Reply