Page 1 of 1

different section names, morphology - h.Section

Posted: Fri Jan 10, 2020 4:53 pm
by bremen
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.

Re: different section names, morphology - h.Section

Posted: Mon Jan 13, 2020 1:43 pm
by ramcdougal
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

Re: different section names, morphology - h.Section

Posted: Thu Jan 16, 2020 4:10 pm
by bremen
Hi.

Thank you very much, it solved my Netcon issue.

Best
Stefano