コード例 #1
0
ファイル: test_utils.py プロジェクト: juanchopanza/NeuroM
            [2, 10],
            [43, 51],
            [1, 2, 3]]

INIT_IDS = [[4, 215, 426, 637],
            [],
            [4],
            [4],
            [4],
            [2, 10],
            [3, 11],
            [44, 52],
            [4]]


RAW_DATA = [utils.load_data(f) for f in FILES]
NO_SOMA_RAW_DATA = utils.load_data(NO_SOMA_FILE)


class MockNeuron(object):
    def __init__(self, trees):
        self.neurites = trees


def test_get_soma_ids():
    for i, d in enumerate(RAW_DATA):
        nt.ok_(utils.get_soma_ids(d) == SOMA_IDS[i])


def test_get_initial_neurite_segment_ids():
    for i, d in enumerate(RAW_DATA):
コード例 #2
0
ファイル: test_utils.py プロジェクト: juanchopanza/NeuroM
def test_load_neurolucida_ascii():
    f_ = os.path.join(DATA_PATH, 'neurolucida', 'sample.asc')
    ascii = utils.load_data(f_)
    nt.ok_(isinstance(ascii, DataWrapper))
    nt.eq_(len(ascii.data_block), 18)
コード例 #3
0
ファイル: meander_angles.py プロジェクト: juanchopanza/NeuroM
"""Calculate inter-segment angles"""

import logging
import numpy as np
from neurom.core.dataformat import COLS
from neurom.point_neurite import triplets as trip
from neurom.point_neurite.io.utils import load_data, make_neuron
from neurom.point_neurite.core import iter_neurites


# root level logger. This would be a top level application logger.
logging.basicConfig()
LOG = logging.getLogger()
LOG.setLevel(logging.DEBUG)
fmt = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
LOG.handlers[0].setFormatter(fmt)


if __name__ == "__main__":

    filename = "test_data/swc/Neuron.swc"
    rd = load_data(filename)
    nrn = make_neuron(rd)

    for tt in nrn.neurites:
        print "Tree ID: {0}, type: {1}".format(tt.value[COLS.ID], tt.value[COLS.TYPE])
        for a in iter_neurites(tt, trip.meander_angle):
            LOG.debug("Angle %f", a)
            if np.isnan(a):
                LOG.warn("Found NaN angle. Check for zero length segments!")