def test_trunk_origin_azimuth(): t = Tree((0, 0, 0, 2)) s = make_soma([[0, 0, 1, 4]]) nt.assert_equal(mtr.trunk_origin_azimuth(t, s), -np.pi/2) s = make_soma([[0, 0, -1, 4]]) nt.assert_equal(mtr.trunk_origin_azimuth(t, s), np.pi/2) s = make_soma([[0, 0, 0, 4]]) nt.assert_equal(mtr.trunk_origin_azimuth(t, s), 0.0) s = make_soma([[-1, 0, -1, 4]]) nt.assert_equal(mtr.trunk_origin_azimuth(t, s), np.pi/4) s = make_soma([[-1, 0, 0, 4]]) nt.assert_equal(mtr.trunk_origin_azimuth(t, s), 0.0) s = make_soma([[1, 0, 0, 4]]) nt.assert_equal(mtr.trunk_origin_azimuth(t, s), np.pi)
_min = min(min(data), dmin) _max = max(max(data), dmax) padding = padding * (_max - _min) return _min - padding, _max + padding # Neurite types of interest NEURITES_ = (ezy.TreeType.axon, ezy.TreeType.apical_dendrite, ezy.TreeType.basal_dendrite,) # map feature names to functors that get us arrays of that # feature, for a given tree type GET_NEURITE_FEATURE = { 'trunk_origin_azimuth': lambda nrn, typ: [mt.trunk_origin_azimuth(n, nrn.soma) for n in nrn.neurites if n.type == typ], 'trunk_origin_elevation': lambda nrn, typ: [mt.trunk_origin_elevation(n, nrn.soma) for n in nrn.neurites if n.type == typ], 'segment_length': lambda n, typ: n.get_segment_lengths(typ), 'section_length': lambda n, typ: n.get_section_lengths(typ), } # For now we use all the features in the map FEATURES = GET_NEURITE_FEATURE.keys() def load_neurite_features(filepath): '''Unpack relevant data into megadict''' stuff = defaultdict(lambda: defaultdict(list)) nrns = ezy.load_neurons(filepath)