Beispiel #1
0
def plot_neuron_on_density(
        population,  # pylint: disable=too-many-arguments
        bins=100,
        new_fig=True,
        subplot=111,
        levels=None,
        plane='xy',
        colorlabel='Nodes per unit area',
        labelfontsize=16,
        color_map='Reds',
        no_colorbar=False,
        threshold=0.01,
        neurite_type=NeuriteType.basal_dendrite,
        **kwargs):
    '''Plots the 2d histogram of the center
       coordinates of segments in the selected plane
       and superimposes the view of the first neurite of the collection.
    '''
    view.tree(population.neurites[0], new_fig=new_fig)

    return plot_density(population,
                        plane=plane,
                        bins=bins,
                        new_fig=False,
                        subplot=subplot,
                        colorlabel=colorlabel,
                        labelfontsize=labelfontsize,
                        levels=levels,
                        color_map=color_map,
                        no_colorbar=no_colorbar,
                        threshold=threshold,
                        neurite_type=neurite_type,
                        **kwargs)
Beispiel #2
0
def test_one_point_branch_without_diameter():
    test_tree = PointTree(np.array([1., 1., 1., 0.5, 2, 1, 0]))
    try:
        view.tree(test_tree, diameter=False)
        nt.ok_(True)
    except:
        nt.ok_(False)
Beispiel #3
0
def plot_neuron_on_density(population, # pylint: disable=too-many-arguments
                           bins=100, new_fig=True, subplot=111, levels=None, plane='xy',
                           colorlabel='Nodes per unit area', labelfontsize=16,
                           color_map='Reds', no_colorbar=False, threshold=0.01,
                           neurite_type=NeuriteType.basal_dendrite, **kwargs):
    '''Plots the 2d histogram of the center
       coordinates of segments in the selected plane
       and superimposes the view of the first neurite of the collection.
    '''
    view.tree(population.neurites[0], new_fig=new_fig)

    return plot_density(population, plane=plane, bins=bins, new_fig=False, subplot=subplot,
                        colorlabel=colorlabel, labelfontsize=labelfontsize, levels=levels,
                        color_map=color_map, no_colorbar=no_colorbar, threshold=threshold,
                        neurite_type=neurite_type, **kwargs)
Beispiel #4
0
def test_tree():
    axes = []
    for tree in pt_neuron.neurites:
        fig, ax = view.tree(tree)
        axes.append(ax)
    nt.ok_(axes[0].get_data_ratio() > 1.00 )
    nt.ok_(axes[1].get_data_ratio() > 0.80 )
    nt.ok_(axes[2].get_data_ratio() > 1.00 )
    nt.ok_(axes[3].get_data_ratio() > 0.85 )
    tree0 = pt_neuron.neurites[0]
    fig, ax = view.tree(tree0, treecolor='black', diameter=False, alpha=1., linewidth=1.2)
    c = ax.collections[0]
    nt.ok_(c.get_linewidth()[0] == 1.2 )
    nt.ok_(np.allclose(c.get_color(), np.array([[ 0.,  0.,  0.,  1.]])) )
    fig, ax = view.tree(tree0, plane='wrong')
    nt.ok_(ax == 'No such plane found! Please select one of: xy, xz, yx, yz, zx, zy.')
    plt.close('all')
Beispiel #5
0
def test_tree():
    axes = []
    for tree in fst_neuron.neurites:
        fig, ax = view.tree(tree)
        axes.append(ax)
    nt.ok_(axes[0].get_data_ratio() > 1.00 )
    nt.ok_(axes[1].get_data_ratio() > 0.80 )
    nt.ok_(axes[2].get_data_ratio() > 1.00 )
    nt.ok_(axes[3].get_data_ratio() > 0.85 )
    tree0 = fst_neuron.neurites[0]
    fig, ax = view.tree(tree0, treecolor='black', diameter=False, alpha=1., linewidth=1.2)
    c = ax.collections[0]
    nt.eq_(c.get_linewidth()[0], 1.2)
    nt.ok_(np.allclose(c.get_color(), np.array([[ 0.,  0.,  0.,  1.]])))
    fig, ax = view.tree(tree0, plane='wrong')
    nt.ok_(ax == 'No such plane found! Please select one of: xy, xz, yx, yz, zx, zy.')
    plt.close('all')
Beispiel #6
0
def test_one_point_branch():
    test_section = Section(points=np.array([[1., 1., 1., 0.5, 2, 1, 0]]))
    for diameter, linewidth in it.product((True, False),
                                          (0.0, 1.2)):
        view.tree(test_section, diameter=diameter, linewidth=linewidth)
        view.tree3d(test_section, diameter=diameter, linewidth=linewidth)