Selecting segments with custom code

Anything that doesn't fit elsewhere.
Post Reply
Posts: 1
Joined: Mon Jan 22, 2018 11:11 pm

Selecting segments with custom code

Post by ecobb » Tue Jan 23, 2018 10:16 pm


I have the following code that graphs a specific, hardcoded segment in Neuron:

Code: Select all

b = new VBox()
g = new Graph()
g.addvar("apical[80].v(rel)",2,2,2*tstop,0,2)  /////graphs apical[80] each time
xpanel(" ",1)
xbutton("current ", "runc()")
xbutton("AMPA", "runa()")
xbutton("AMPA+NMDA", "runm()")
I would like to be able to choose the segment to graph from a visual representation of the neuron (like the one found under Tools -> Point Processes -> Electrode) instead of hardcoding the segment, so that I can dynamically change the segment being graphed at runtime.

Is there an object/variable that I can use to access the current segment selected from the Electrode window?


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

Re: Selecting segments with custom code

Post by ted » Wed Jan 24, 2018 12:49 am

After model setup is complete, but before a simulation is launched (i.e. before calling run()), do the following:

1. Bring up a new Shape plot, either by executing code
objref sp
sp = new Shape()
or by clicking on
NEURON Main Menu / Graph / Shape plot

2. If you need to plot something other than membrane potential, use the "Plot What?" tool from the Shape plot's primary menu to specify the desired variable.

3. Use the Shape plot's zoom rotate (in its primary menu), zoom, and translate (latter two in its secondary menu) to expose the section of interest.

4. Use the Shape plot's primary menu to specify "Time Plot"

5. Click on the location of interest

Frankly, it's much easier to just bring up an ordinary Voltage or Current axis graph, and then enter the fully qualified name of the variable of interest, i.e. for a range variable that would be something of the form
If you need help discovering the name of a section, use the "Shape Name" tool
NEURON Main Menu / Tools / Distributed Mechanisms /Viewers / Shape Name
and either click on the section of interest in this tool's shape plot, or scroll through the Shape Name tool's list of section names to find a name of possible interest and click on it (the corresponding section will turn red in the Shape Name tool's shape plot).

Post Reply