def test_is_single_tree_bad_data(self): f = os.path.join(SWC_PATH, 'Neuron_disconnected_components.swc') ok = chk.is_single_tree(self.load_data(f)) nt.ok_(not ok) nt.eq_(ok.info, [6, 217, 428, 639])
def test_is_single_tree_good_data(self): f = os.path.join(SWC_PATH, 'Neuron.swc') ok = chk.is_single_tree(self.load_data(f)) nt.ok_(ok) nt.eq_(len(ok.info), 0)
def test_is_single_tree_bad_data(self): f = Path(SWC_PATH, 'Neuron_disconnected_components.swc') ok = chk.is_single_tree(self.load_data(f)) nt.ok_(not ok) nt.eq_(list(ok.info), [6, 217, 428, 639])
def test_is_single_tree_good_data(self): f = Path(SWC_PATH, 'Neuron.swc') ok = chk.is_single_tree(self.load_data(f)) nt.ok_(ok) nt.eq_(len(ok.info), 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
def time_is_single_tree(self): sc.is_single_tree(self.data_wrapper)