本文整理汇总了Python中neurom.io.utils.load_neuron函数的典型用法代码示例。如果您正苦于以下问题:Python load_neuron函数的具体用法?Python load_neuron怎么用?Python load_neuron使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_neuron函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_load_neuron_mixed_tree_swc
def test_load_neuron_mixed_tree_swc():
nrn_mix = utils.load_neuron(os.path.join(SWC_ORD_PATH, 'sample_mixed_tree_sections.swc'))
nt.assert_items_equal(get('number_of_sections_per_neurite', nrn_mix), [5, 3])
nt.assert_items_equal(get('number_of_sections_per_neurite', nrn_mix),
get('number_of_sections_per_neurite', SWC_ORD_REF))
nt.assert_items_equal(get('number_of_segments', nrn_mix),
get('number_of_segments', SWC_ORD_REF))
nt.assert_items_equal(get('total_length', nrn_mix),
get('total_length', SWC_ORD_REF))
示例2: test_load_neuron_section_order_break_swc
def test_load_neuron_section_order_break_swc():
nrn_mix = utils.load_neuron(os.path.join(SWC_ORD_PATH, 'sample_disordered.swc'))
assert_items_equal(get('number_of_sections_per_neurite', nrn_mix), [5, 3])
assert_items_equal(get('number_of_sections_per_neurite', nrn_mix),
get('number_of_sections_per_neurite', SWC_ORD_REF))
assert_items_equal(get('number_of_segments', nrn_mix),
get('number_of_segments', SWC_ORD_REF))
assert_items_equal(get('total_length', nrn_mix),
get('total_length', SWC_ORD_REF))
示例3: test_load_h5_trunk_points_regression
def test_load_h5_trunk_points_regression():
# regression test for issue encoutnered wile
# implementing PR #479, related to H5 unpacking
# of files with non-standard soma structure.
# See #480.
nrn = utils.load_neuron(os.path.join(DATA_PATH, 'h5', 'v1', 'Neuron.h5'))
nt.ok_(np.allclose(nrn.neurites[0].root_node.points[1],
[0., 0. , 0.1, 0.31646374, 4., 4., 3.]))
nt.ok_(np.allclose(nrn.neurites[1].root_node.points[1],
[0., 0., 0.1, 1.84130445e-01, 3.0, 235., 234.]))
nt.ok_(np.allclose(nrn.neurites[2].root_node.points[1],
[0., 0., 0.1, 5.62225521e-01, 3., 466, 465]))
nt.ok_(np.allclose(nrn.neurites[3].root_node.points[1],
[0., 0., 0.1, 7.28555262e-01, 2., 697, 696]))
示例4: test_load_trees_good_neuron
def test_load_trees_good_neuron():
'''Check trees in good neuron are the same as trees from loaded neuron'''
filepath = os.path.join(SWC_PATH, 'Neuron.swc')
nrn = utils.load_neuron(filepath)
trees = utils.load_trees(filepath)
nt.eq_(len(nrn.neurites), 4)
nt.eq_(len(nrn.neurites), len(trees))
nrn2 = MockNeuron(trees)
@pts.point_function(as_tree=False)
def elem(point):
return point
# Check data are the same in tree collection and neuron's neurites
for a, b in izip(iter_neurites(nrn, elem), iter_neurites(nrn2, elem)):
nt.ok_(np.all(a == b))
示例5: test_load_neuron_deep_neuron
def test_load_neuron_deep_neuron():
'''make sure that neurons with deep (ie: larger than the python
recursion limit can be loaded)
'''
deep_neuron = os.path.join(DATA_PATH, 'h5/v1/deep_neuron.h5')
utils.load_neuron(deep_neuron)
示例6: test_load_neuron
def test_load_neuron():
nrn = utils.load_neuron(FILES[0])
nt.ok_(nrn.name == FILES[0].strip('.swc').split('/')[-1])
示例7: _load_neuron
def _load_neuron(name):
if name.endswith('.swc'):
path = os.path.join(SWC_PATH, name)
elif name.endswith('.h5'):
path = os.path.join(H5V1_PATH, name)
return name, load_neuron(path)
示例8: test_load_neuron_invalid_id_sequence_raises
def test_load_neuron_invalid_id_sequence_raises():
utils.load_neuron(INVALID_ID_SEQUENCE_FILE);
示例9: test_load_neuron_missing_parents_raises
def test_load_neuron_missing_parents_raises():
utils.load_neuron(MISSING_PARENTS_FILE)
示例10: test_load_bifurcating_soma_points_raises_SomaError
def test_load_bifurcating_soma_points_raises_SomaError():
utils.load_neuron(os.path.join(SWC_PATH, 'soma', 'bifurcating_soma.swc'))
示例11: test_load_neuromorpho_3pt_soma
def test_load_neuromorpho_3pt_soma():
nrn = utils.load_neuron(os.path.join(SWC_PATH, 'soma', 'three_pt_soma.swc'))
nt.eq_(len(nrn.neurites), 4)
nt.eq_(len(nrn.soma.points), 3)
nt.eq_(nrn.soma.radius, 2)
_check_neurites_have_no_parent(nrn)
示例12: test_load_contour_split_1st_soma_neuron
def test_load_contour_split_1st_soma_neuron():
nrn = utils.load_neuron(os.path.join(SWC_PATH, 'soma', 'contour_split_1st_soma_neuron.swc'))
nt.eq_(len(nrn.neurites), 3)
nt.eq_(len(nrn.soma.points), 6)
nt.eq_(nrn.soma.radius, 2.0)
_check_neurites_have_no_parent(nrn)
示例13: test_neuron_name
def test_neuron_name():
for fn, nn in zip(FILENAMES, NRN_NAMES):
nrn = utils.load_neuron(fn)
nt.eq_(nrn.name, nn)
示例14: test_load_neuron
def test_load_neuron():
nrn = utils.load_neuron(FILENAMES[0])
nt.assert_true(isinstance(NRN, Neuron))
nt.assert_equal(NRN.name, 'Neuron')
_check_neurites_have_no_parent(nrn)
示例15: test_load_neuron_no_consecutive_ids_raises_NonConsecutiveIDsError
def test_load_neuron_no_consecutive_ids_raises_NonConsecutiveIDsError():
utils.load_neuron(NON_CONSECUTIVE_ID_FILE);