def test_resample_neuron_section__double_density(): """If we have points 1um apart with a density of 1 points per um then the result should the same as the input. """ section = Mock( points=np.array([[0., 0., 0.], [1., 0., 0.], [2., 0., 0.]]), diameters=np.array([3., 2., 1.]) ) tested._resample_neuron_section(section, linear_density=2.) npt.assert_allclose( section.points, [[0.0, 0., 0.], [0.5, 0., 0.], [1.0, 0., 0.], [1.5, 0., 0.], [2.0, 0., 0.]]) npt.assert_allclose(section.diameters, [3., 2.5, 2., 1.5, 1.]) # let's do a full cycle now! tested._resample_neuron_section(section, linear_density=1.) npt.assert_allclose( section.points, [[0.0, 0., 0.], [1.0, 0., 0.], [2.0, 0., 0.]]) npt.assert_allclose(section.diameters, [3., 2., 1.])
def test_resample_neuron_section_strip(): """Check that only the first and last points and diameters remain if linear_density is zero. """ section = Mock(points=np.array([[0., 0., 0.], [1., 1., 1.], [2., 2., 2.]]), diameters=np.array([3., 2., 1.])) tested._resample_neuron_section(section, linear_density=0.) npt.assert_allclose(section.points, [[0., 0., 0.], [2., 2., 2.]]) npt.assert_allclose(section.diameters, [3., 1.])