Does Section have something like `id` attribute?

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

Moderator: hines

Post Reply
vogdb
Posts: 37
Joined: Sun Aug 13, 2017 9:51 am

Does Section have something like `id` attribute?

Post by vogdb »

Hello everyone!

I'm trying to launch a Sonata network in NEURON. According to their documentation they store synapses locations as some section id. I suspect that it is a Section's index in h.allsec() collection. I've looked over Section's documentation and have some questions.
1. Am I correct that there is no such thing as Section's id? At least publicly available in NEURON API.
2. Is there a shortcut method to get a section by its index? Currently I transform h.allsec() into a list, and access the necessary section by the list's index.
3. I've tried to create a synapse by h.Exp2Syn(sec=section_id) but it didn't work. However in this documentation a method h.this_section is mentioned that allows to get something that looks like Section's id.
ramcdougal
Posts: 267
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: Does Section have something like `id` attribute?

Post by ramcdougal »

Internally, the Sections are stored in a linked list. There is thus no direct, consistent-across-runs section indexing scheme... but as you've observed, there's no advantage for NEURON storing such a list since you can create it quickly in the non-parallel case:

Code: Select all

seclist = list(h.allsec())
Once you have that, you are free to use that to position synapses, e.g. the following code places a synapse at the midpoint of the ith entry in seclist:

Code: Select all

mysyn = h.ExpSyn(seclist[i](0.5))
A few comments:
  • Don't use this_section. It's not guaranteed to work on 64-bit machines, which nowadays is all machines.
  • Remember, Python semantics don't copy the sections when creating a list, they only store a reference to the section, so constructing seclist above is fast.
  • Synapses are positioned at normalized locations within a Section (remember: there can be many segments associated with a given section ).
  • Sections have name and cell attributes that can be used to provide unique identifiers.
  • A seclist created in the above way would not be suitable for use in parallel simulation since different machines would have different section 0s. You'd have to work with the name/cell (or ideally through a cell class) to uniquely identify sections in a parallel environment.
vogdb
Posts: 37
Joined: Sun Aug 13, 2017 9:51 am

Re: Does Section have something like `id` attribute?

Post by vogdb »

Thank you for such a thorough answer! By any chance, do you have an example of identifying sections in parallel environment?
Post Reply