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

fix _neuron_population for sholl_frequency over a neuron population #944

Merged
merged 1 commit into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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