def test_segment_radial_distances_origin(): origin = (-100, -200, -300) ref_segs = nf.segment_radial_distances(NEURON) ref_segs_origin = nf.segment_radial_distances(NEURON, origin=origin) rad_dists = get_feature('segment_radial_distances', NEURON) rad_dists_origin = get_feature('segment_radial_distances', NEURON, origin=origin) nt.ok_(np.all(rad_dists == ref_segs)) nt.ok_(np.all(rad_dists_origin == ref_segs_origin)) nt.ok_(np.all(rad_dists_origin != ref_segs)) nrns = [ nm.load_neuron(Path(SWC_PATH, f)) for f in ('point_soma_single_neurite.swc', 'point_soma_single_neurite2.swc') ] pop = Population(nrns) rad_dist_nrns = [] for nrn in nrns: rad_dist_nrns.extend(nm.get('segment_radial_distances', nrn)) rad_dist_nrns = np.array(rad_dist_nrns) rad_dist_pop = nm.get('segment_radial_distances', pop) assert_allclose(rad_dist_nrns, rad_dist_pop)
def test_segment_radial_distances(): """midpoints on segments.""" radial_distances = _nf.segment_radial_distances(SIMPLE) assert_allclose(radial_distances, [ 2.5, sqrt(2.5**2 + 5**2), sqrt(3**2 + 5**2), 2.0, 5.0, sqrt(2.5**2 + 4**2) ])