The most recent version of NEURON v7.6.3 appears to have caused some problems in LFPy (github.com/LFPy/LFPy) over v7.6.2 as the SectionList class lost its allsec method (in this particular commit from the look of it: https://github.com/neuronsimulator/nrn/ ... 3ea28dc706).
The main problem is a nested for loop over sections put in a SectionList which is attached to a Cell object like demonstrated below. Most likely we were not doing things the right way in the first place, but, my question is: What is the correct way of doing a double for loop over the same SectionList object in NEURON 7.6.3?
Code: Select all
import neuron
neuron.h('forall delete_section()')
class Cell(object):
def __init__(self):
neuron.h.load_file(1, 'example_morphology.hoc') # https://raw.githubusercontent.com/LFPy/LFPy/master/examples/morphologies/example_morphology.hoc
self.seclist = neuron.h.SectionList()
for sec in neuron.h.allsec():
seclist.append(sec=sec)
cell = Cell()
print('test nested loop 1 (ok, but we want to iterate over sections in the cell.seclist object):')
for sec_outer in neuron.h.allsec():
for sec_inner in neuron.h.allsec():
print(sec_outer.name(), sec_inner.name())
print('test nested loop 2 (not ok):')
for sec_outer in cell.seclist:
for sec_inner in cell.seclist:
print(sec_outer.name(), sec_inner.name())
print('test nested loop 3 (ok, up until v7.6.3):')
for sec_outer in cell.seclist.allsec():
for sec_inner in cell.seclist.allsec():
print(sec_outer.name(), sec_inner.name())
Code: Select all
test nested loop 1 (ok, but we want to iterate over sections in the cell sectionlist):
('soma[0]', 'soma[0]')
('soma[0]', 'dend[0]')
('soma[0]', 'dend[1]')
('soma[0]', 'dend[2]')
('dend[0]', 'soma[0]')
('dend[0]', 'dend[0]')
('dend[0]', 'dend[1]')
('dend[0]', 'dend[2]')
('dend[1]', 'soma[0]')
('dend[1]', 'dend[0]')
('dend[1]', 'dend[1]')
('dend[1]', 'dend[2]')
('dend[2]', 'soma[0]')
('dend[2]', 'dend[0]')
('dend[2]', 'dend[1]')
('dend[2]', 'dend[2]')
test nested loop 2 (not ok):
test nested loop 3 (ok, up until v7.6.3):
('soma[0]', 'soma[0]')
('soma[0]', 'dend[0]')
('soma[0]', 'dend[1]')
('soma[0]', 'dend[2]')
('dend[0]', 'soma[0]')
('dend[0]', 'dend[0]')
('dend[0]', 'dend[1]')
('dend[0]', 'dend[2]')
('dend[1]', 'soma[0]')
('dend[1]', 'dend[0]')
('dend[1]', 'dend[1]')
('dend[1]', 'dend[2]')
('dend[2]', 'soma[0]')
('dend[2]', 'dend[0]')
('dend[2]', 'dend[1]')
('dend[2]', 'dend[2]')
Kind regards,
Espen