different section names, morphology - h.Section

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

Moderator: hines

Post Reply
bremen
Posts: 37
Joined: Mon Apr 24, 2017 8:15 am
Location: Italy

different section names, morphology - h.Section

Post by bremen » Fri Jan 10, 2020 4:53 pm

Hi.

I was looking at a h.topology() of one of my Python/NEURON models and sow something "odd" in the names of the sections.

Part of the cell uses a neurolucida morphology, which i load with:
cell = h.Import3d_Neurolucida3()
cell.input('morphology.asc')

In this case the sections are called like this:

Code: Select all

<Cellname.cell_regular_firing object at 0x7f3ca3fa7dd8>.dend[24](0-1)
The rest of the cell is built by a series of h.Section() and the sections are named in this way:

Code: Select all

__nrnsec_0x55fc8e2f94a0(0-1)
Is it possible to instantiate the h.Section() with the same notation as the first one?
The model work perfectly, but I'm having an "intermittent" issue, with a parallel Netcon, if the section uses the second notation instead of the first one.

ramcdougal
Posts: 181
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: different section names, morphology - h.Section

Post by ramcdougal » Mon Jan 13, 2020 1:43 pm

Specify the name attribute when creating a section to give them meaningful names:

Code: Select all

soma = h.Section(name='soma')
Specify both name and cell (and give the cell a reasonable __repr__) for meaningful dot notation:

Code: Select all

from neuron import h

class MyCell:
    def __repr__(self):
        return 'MyCell[{}]'.format(self._id)
    def __init__(self, _id):
        self._id = _id
        self.soma = h.Section(name='soma', cell=self)

my_neuron = MyCell(1)
print(my_neuron.soma)  # prints:  MyCell[1].soma

bremen
Posts: 37
Joined: Mon Apr 24, 2017 8:15 am
Location: Italy

Re: different section names, morphology - h.Section

Post by bremen » Thu Jan 16, 2020 4:10 pm

Hi.

Thank you very much, it solved my Netcon issue.

Best
Stefano

Post Reply