Exemplo n.º 1
0
def test_neurite_volume_density():

    vol = np.array(_nf.total_volume_per_neurite(NRN))
    hull_vol = np.array([convex_hull(n).volume for n in nm.iter_neurites(NRN)])

    vol_density = _nf.neurite_volume_density(NRN)
    nt.eq_(len(vol_density), 4)
    nt.ok_(np.allclose(vol_density, vol / hull_vol))

    ref_density = [
        0.43756606998299519, 0.52464681266899216, 0.24068543213643726,
        0.26289304906104355
    ]
    assert_allclose(vol_density, ref_density)
Exemplo n.º 2
0
def test_neurite_volume_density_failed_convex_hull():
    with patch('neurom.features.neuritefunc.convex_hull',
               side_effect=scipy.spatial.qhull.QhullError('boom')):
        vol_density = _nf.neurite_volume_density(NRN)
        nt.ok_(vol_density, np.nan)