Skip to content
This repository has been archived by the owner on Feb 26, 2025. It is now read-only.

Commit

Permalink
fix _neuron_population for sholl_frequency over a neuron populati…
Browse files Browse the repository at this point in the history
…on (#944)
  • Loading branch information
asanin-epfl authored Jun 22, 2021
1 parent 978d39f commit fdcfd95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion neurom/features/neuronfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import numpy as np

from neurom import morphmath
from neurom.core import Population
from neurom.core.neuron import iter_neurites, iter_segments
from neurom.core.dataformat import COLS
from neurom.core.types import NeuriteType
Expand All @@ -57,7 +58,7 @@

def _neuron_population(nrns):
"""Makes sure `nrns` behaves like a neuron population."""
return nrns.neurons if hasattr(nrns, 'neurons') else (nrns,)
return nrns if isinstance(nrns, Population) else (nrns,)


@feature(shape=())
Expand Down
2 changes: 2 additions & 0 deletions tests/features/test_get_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,8 @@ def test_sholl_frequency():
assert_allclose(get_feature('sholl_frequency', NEURON, neurite_type=NeuriteType.axon),
[1, 2, 2, 6, 2, 2, 2, 2, 2])

assert len(get_feature('sholl_frequency', POP)) == 108


@pytest.mark.skip('test_get_segment_lengths is disabled in test_get_features')
def test_section_path_distances_endpoint():
Expand Down

0 comments on commit fdcfd95

Please sign in to comment.