def test_has_no_missing_parents_good_data(self):

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

        ok = chk.no_missing_parents(self.load_data(f))
        nt.ok_(ok)
        nt.eq_(len(ok.info), 0)
    def test_has_no_missing_parents_bad_data(self):

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

        ok = chk.no_missing_parents(self.load_data(f))
        nt.ok_(not ok)
        nt.eq_(list(ok.info), [6, 217, 428, 639])
Beispiel #3
0
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
Beispiel #4
0
 def time_no_missing_parents(self):
     sc.no_missing_parents(self.data_wrapper)
Beispiel #5
0
 def time_no_missing_parents(self):
     sc.no_missing_parents(self.data_wrapper)