コード例 #1
0
    def test_has_increasing_ids_bad_data(self):

        f = Path(SWC_PATH, 'non_increasing_trunk_off_1_16pt.swc')

        ok = chk.has_increasing_ids(self.load_data(f))
        nt.ok_(not ok)
        nt.eq_(list(ok.info), [6, 12])
コード例 #2
0
    def test_has_increasing_ids_bad_data(self):

        f = os.path.join(SWC_PATH, 'non_increasing_trunk_off_1_16pt.swc')

        ok = chk.has_increasing_ids(self.load_data(f))
        nt.ok_(not ok)
        nt.assert_items_equal(ok.info, [6, 12])
コード例 #3
0
    def test_has_increasing_ids_bad_data(self):

        f = os.path.join(SWC_PATH, 'non_increasing_trunk_off_1_16pt.swc')

        ok = chk.has_increasing_ids(self.load_data(f))
        nt.ok_(not ok)
        nt.eq_(list(ok.info), [6, 12])
コード例 #4
0
    def test_has_increasing_ids_good_data(self):

        files = [
            Path(SWC_PATH, f) for f in [
                'Neuron.swc', 'Single_apical_no_soma.swc', 'Single_apical.swc',
                'Single_basal.swc', 'Single_axon.swc',
                'Neuron_zero_radius.swc', 'sequential_trunk_off_0_16pt.swc',
                'sequential_trunk_off_1_16pt.swc',
                'sequential_trunk_off_42_16pt.swc',
                'Neuron_no_missing_ids_no_zero_segs.swc'
            ]
        ]

        for f in files:
            ok = chk.has_increasing_ids(self.load_data(f))
            nt.ok_(ok)
            nt.ok_(len(ok.info) == 0)
コード例 #5
0
    def test_has_increasing_ids_good_data(self):

        files = [os.path.join(SWC_PATH, f)
                 for f in ['Neuron.swc',
                           'Single_apical_no_soma.swc',
                           'Single_apical.swc',
                           'Single_basal.swc',
                           'Single_axon.swc',
                           'Neuron_zero_radius.swc',
                           'sequential_trunk_off_0_16pt.swc',
                           'sequential_trunk_off_1_16pt.swc',
                           'sequential_trunk_off_42_16pt.swc',
                           'Neuron_no_missing_ids_no_zero_segs.swc']
                 ]

        for f in files:
            ok = chk.has_increasing_ids(self.load_data(f))
            nt.ok_(ok)
            nt.ok_(len(ok.info) == 0)
コード例 #6
0
ファイル: utils.py プロジェクト: juanchopanza/NeuroM
def load_trees(filename, tree_action=None):
    """Load all trees in an input file

    Loads all trees, regardless of whether they are connected
    Args:
        filename: the path of the file storing morphology data
        tree_action: optional function to run on each of the neuron's
        neurite trees.
    Raises:
        IDSequenceError if filename contains non-incremental ID sequence
    """
    data = load_data(filename)

    if not check.has_increasing_ids(data):
        raise IDSequenceError('Invald ID sequence found in raw data')

    _ids = get_initial_neurite_segment_ids(data)
    _ids.extend(data.get_ids(lambda r: r[COLS.P] == -1 and r[COLS.TYPE] != POINT_TYPE.SOMA))

    return [make_point_tree(data, i, tree_action) for i in _ids]
コード例 #7
0
ファイル: utils.py プロジェクト: juanchopanza/NeuroM
def load_neuron(filename, tree_action=set_tree_type):
    """
    Loads a neuron keeping a record of the filename.
    Args:
        filename: the path of the file storing morphology data
        tree_action: optional function to run on each of the neuron's
        neurite trees.
    Raises:
        SomaError if no soma points in data.
        IDSequenceError if filename contains invalid ID sequence
    """

    data = load_data(filename)
    if not check.has_increasing_ids(data):
        raise IDSequenceError('Invald ID sequence found in raw data')
    if not check.is_single_tree(data):
        raise MultipleTrees('Multiple trees detected')
    if not check.no_missing_parents(data):
        raise MissingParentError('Missing parents detected')

    nrn = make_neuron(data, tree_action)
    nrn.name = os.path.splitext(os.path.basename(filename))[0]

    return nrn
コード例 #8
0
ファイル: benchmarks.py プロジェクト: BlueBrain/NeuroM
 def time_has_increasing_ids(self):
     sc.has_increasing_ids(self.data_wrapper)
コード例 #9
0
ファイル: benchmarks.py プロジェクト: yamagatm/NeuroM
 def time_has_increasing_ids(self):
     sc.has_increasing_ids(self.data_wrapper)