Skip to content

Commit

Permalink
Fix 'section_path_lengths' feature for Population (#927)
Browse files Browse the repository at this point in the history
  • Loading branch information
asanin-epfl authored Jun 7, 2021
1 parent 8aa8813 commit 3599701
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

Version 2.2.1
-------------
- Fix 'section_path_lengths' feature for Population

Version 2.2.0
-------------
- Don't force loading of neurons into memory for Population (#922). See new API of
Expand Down
8 changes: 1 addition & 7 deletions neurom/features/neuritefunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,9 @@ def section_path_lengths(neurites, neurite_type=NeuriteType.all):
# then queries the lengths in the path length iterations.
# This avoids repeatedly calculating the lengths of the
# same sections.
dist = {}
neurite_filter = is_type(neurite_type)

for s in iter_sections(neurites, neurite_filter=neurite_filter):
dist[s] = s.length

def pl2(node):
"""Calculate the path length using cached section lengths."""
return sum(dist[n] for n in node.iupstream())
return sum(n.length for n in node.iupstream())

return _map_sections(pl2, neurites, neurite_type=neurite_type)

Expand Down
6 changes: 6 additions & 0 deletions tests/features/test_get_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,12 @@ def test_section_path_distances_axon():
assert len(path_lengths) == 21


def test_section_path_distances_pop():
path_distances = get_feature('section_path_distances', POP)
assert len(path_distances) == 328
assert sum(len(get_feature('section_path_distances', nrn)) for nrn in POP) == 328


def test_segment_lengths():
ref_seglen = nf.segment_lengths(NEURON)
seglen = get_feature('segment_lengths', NEURON)
Expand Down

0 comments on commit 3599701

Please sign in to comment.