Skip to content

comp

Best guess whether object comes from NEURON.

Source code in navis/interfaces/neuron/utils.py
16
17
18
19
20
21
22
23
24
25
def is_NEURON_object(x):
    """Best guess whether object comes from NEURON."""
    # Note:
    # NEURON objects also have a `.hname()` method that
    # might be useful
    if not hasattr(x, '__module__'):
        return False
    if x.__module__ == 'nrn' or x.__module__ == 'hoc':
        return True
    return False

Check if object is a section.

Source code in navis/interfaces/neuron/utils.py
35
36
37
38
39
def is_section(x):
    """Check if object is a section."""
    if 'nrn.Section' in str(type(x)):
        return True
    return False

Check if object is a segment.

Source code in navis/interfaces/neuron/utils.py
28
29
30
31
32
def is_segment(x):
    """Check if object is a segment."""
    if 'nrn.Segment' in str(type(x)):
        return True
    return False