Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEURON 7.6.3 support #113

Closed
espenhgn opened this issue Nov 26, 2018 · 12 comments
Closed

NEURON 7.6.3 support #113

espenhgn opened this issue Nov 26, 2018 · 12 comments
Assignees
Milestone

Comments

@espenhgn
Copy link
Collaborator

espenhgn commented Nov 26, 2018

It appears that the allsec method of neuron.h.SectionList has been removed in NEURON 7.6.3. The method is used in quite a few unittests and probably other places in the codebase. From the look of it we have to either support only older versions of NEURON or force users onto the new NEURON version. Tested with NEURON 7.6.3 and 7.5 HEAD (7eb3e93).

@espenhgn espenhgn added the bug label Nov 26, 2018
@espenhgn espenhgn added this to the v2.0 milestone Nov 26, 2018
@espenhgn espenhgn self-assigned this Nov 26, 2018
@espenhgn
Copy link
Collaborator Author

espenhgn commented Nov 26, 2018

Could be related: Some if not all example files can only be run once, before resulting in various Hoc errors while reading in morphology files that has already been read once. This issue arose w. Python3 provided by Anaconda on Ubuntu 18.04.1 LTS. Doesn't occur with the system installation of Python3.

@torbjone
Copy link
Contributor

I could not find any mentioning of the allsec method being removed, which seems weird. I would have expected it to at least be mentioned here:
https://www.neuron.yale.edu/neuron/news/neuron-762-now-available-download

Perhaps start by asking on the NEURON forum?

@espenhgn
Copy link
Collaborator Author

@torbjone , yes we can inquire Hines. I don't quite remember why we used that method in the first place though, as the SectionList object instance (filled with Section references) is itself an iterable meaning that the method was kind of redundant anyway. Can try and remove usage of this allsec() method and see what happens.

@espenhgn
Copy link
Collaborator Author

I see the SectionList has a wholetree method which appears to be doing what we typically want (build sectionlists for entire single morphologies):

In [2]: l = neuron.h.SectionList()

In [3]: l.wholetree?
Type:            HocObject
String form:     SectionList[0].wholetree()
Docstring:      
Syntax:
    ``sl.wholetree(sec=section)``


Description:
    Appends all sections which have a path to the ``section``. 
    (including the currently accessed section). The section list has the 
    important property that the sections are in root to leaf order. 
Class docstring: class neuron.hoc.HocObject - Hoc Object wrapper

@espenhgn
Copy link
Collaborator Author

I will make an attempt to fix this issue.

@alejoe91
Copy link
Contributor

thanks @espenhgn this would be awesome

@espenhgn
Copy link
Collaborator Author

espenhgn commented Nov 27, 2018

This commit appears to be the culprit: neuronsimulator/nrn@25482fa

As this commit is newer than 7.6.2, it appears as though tests pass with the official 7.6.2 release (tested w. Ubuntu 18.04, system python3, anaconda python 2.7 & 3.6).

Simply replacing for sec in self.allseclist.allsec() with for sec in neuron.h.allsec(), however, causes a whole bunch of broken tests and a segfault. Same with for sec in self.allseclist even if the correct sections appear to be present in the list.

@espenhgn
Copy link
Collaborator Author

espenhgn commented Nov 27, 2018

The failing tests are all related to computiting the axial currents. The basic issue is that LFPy.Cell.get_axial_currents_from_vmem() calls LFPy.Cell.get_idx() inside a for loop over self.allseclist.allsec(). The latter function also has a similar for loop (over allseclist). You can't do a nested for loop over SectionList objects:

import neuron
neuron.h('forall delete_section()')
neuron.h.load_file(1, 'example_morphology.hoc')
seclist = neuron.h.SectionList()
for sec in neuron.h.allsec():
    seclist.append(sec=sec)
print('test nested loop 1:')
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 seclist:
    for sec_inner in seclist:
        print(sec_outer.name(), sec_inner.name())
print('test nested loop 3 (ok):')
for sec_outer in seclist.allsec():
    for sec_inner in seclist.allsec():
        print(sec_outer.name(), sec_inner.name())

which results in:

test nested loop 1:
('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):
('soma[0]', 'soma[0]')
('soma[0]', 'dend[0]')
('soma[0]', 'dend[1]')
('soma[0]', 'dend[2]')
test nested loop 3 (ok):
('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]')

I'll inquire what is the best semantic to use in this case. We don't want to call neuron.h.allsec() as we should only iterate over sections that belong to a particular cell object

@espenhgn
Copy link
Collaborator Author

Posted this on the NEURON forum: https://www.neuron.yale.edu/phpBB/viewtopic.php?f=2&t=3990

@espenhgn espenhgn changed the title NEURON 7.6.x support NEURON 7.6.3 support Nov 27, 2018
@espenhgn
Copy link
Collaborator Author

Ok, I think the main issue with the SectionList iteration in NEURON is now resolved through neuronsimulator/nrn@5174b0b

I updated the Travis build system in PR #114 to use the current master from the NEURON repository. There are a couple of tests that fail but I think that is something we can investigate and work around. Py2.7 tests fail now on Travis due to some other reason.

What this then means is that older versions of LFPy only support NEURON 7.5-7.6.2, current version of LFPy NEURON > 7.6.3

@espenhgn
Copy link
Collaborator Author

espenhgn commented Jan 3, 2019

Looks like the latest official NEURON release is v7.6.4 at https://neuron.yale.edu/ftp/neuron/versions/v7.6/ , even if the main homepage lists 7.6.3 as the latest (but download link points to the newer release). With this, I'll merge PR #114 and make bugfix release v2.0.1 available on PyPI.

espenhgn added a commit that referenced this issue Jan 3, 2019
* updated/added install instructions for Ubuntu 18.04 LTS

* docstring fformatting

* adding Python 3.7 to travis testing

* 3.7 not ready for prime time

* documentation updates, updated recipe for NEURON source install on Ubuntu

* removed use of h.SectionList.allsec method

* build NEURON against github master

* fix test with NEURON@github:master

* prep next release 2.0.1

* debug py27 travis build

* debug travis python27

* send NEURON .configure output to null

* v2.0.1 version number

* removed csa from dependency_links list

* neuron 7.6.4 a requirement for this version

* add NEURON >= v7.6.4 version testing

* Update README.md

* Update README.md

* LFPy.__version__ = '2.0.1'
@espenhgn
Copy link
Collaborator Author

espenhgn commented Jan 3, 2019

Merged #114, closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants