Skip to content
Snippets Groups Projects
Select Git revision
  • 175c4eab4b3677a163c958ee42d445494a467ff9
  • master default protected
2 results

average-sql.py

Blame
  • plot_labmeeting.py 2.57 KiB
    import matplotlib.pyplot as plt
    import numpy as np
    from plothelpers import *
    
    c_elegans = c_elegans_helper()
    bbp = bbp_helper()
    mouse_v1 = mouse_v1_helper(0.33)
    mouse_v1_e = mouse_v1_helper(0.33, allowed_neuron_types='e')
    mouse_v1_i = mouse_v1_helper(0.33, allowed_neuron_types='i')
    q_rewiring = q_rewiring_helper(tr='trained_full')
    random = random_helper(N=5000, p=0.05)
    michael_hebbian_3d_grid = michael_helper(rule='hebbian', p=0.05, grid='3d_grid')
    michael_hebbian_no_grid = michael_helper(rule='hebbian', p=0.05, grid='no_grid')
    zenke2015all = zenke2015_helper(con_group='all', fraction=0.95)
    zenke2015ee = zenke2015_helper(con_group='ee', fraction=0.95)
    zenke2015ee['pscp2_mean'][4] = None  #no real data point there
    zenke2015all['pscp2_mean'][4] = None  #no real data point there
    
    c1, c2 = 'xkcd:tomato', 'xkcd:green'
    data = [
            (c_elegans, c2, 'C.elegans', 'o'),
            (mouse_v1, c2, 'mouse v1', 's'),
            (mouse_v1_e, c2, 'mouse v1 ex only', 'v'),
            (mouse_v1_i, c2, 'mouse v1 inh only', '>'),
            (bbp, c2, 'bbp', 'D'),
            (michael_hebbian_3d_grid, c1, 'hebbian (3d grid)', 'D'),
            (michael_hebbian_no_grid, c1, 'hebbian (no grid)', 's'),
            (q_rewiring, c1, 'q-rewiring', 'o'),
            (zenke2015all, c1, 'multiple (Zenke et al., 2015)', '^'),
    #        (zenke2015ee, c1, 'multiple (Zenke et al., 2015), just ee', 'v'),
            (random, 'gray', 'random (no grid)', 'o'),
            ]
    
    # begin plot
    fig, ax = plt.subplots(1, figsize=(9,6))
    max_dim = 5
    x = np.asarray(range(max_dim))+1
    
    # actual data and hline
    for d,c,l,m in data:
        y = d['pscp2_mean'][:max_dim] * 100
        ax.errorbar(x, y, d['pscp2_std'][:max_dim], color=c, linewidth=0.3)
        ax.plot(x, y, color=c, label=l, linewidth=0.3, marker=m)
    ax.axhline(y=0, linestyle='dashed', c='k', lw=0.7)
    
    # polishing labels and spines
    ax.set_xlabel('dimension (1)')
    ax.set_ylabel(r'$\hat{p}^{(2)}$ (%-points)')
    ax.spines['top'].set_visible(False)
    ax.spines['right'].set_visible(False)
    ax.locator_params(axis='y', nbins=3)
    ax.locator_params(axis='x', nbins=max_dim)
    ax.set_ylim(bottom=-8, top=15)
    
    # fancy, no, legendary legend
    #handles = ph[:1] + h[::2] + ph[1:] + h[1::2]
    #labels = ["data:"] + l[::2] + ["simulation:"] + l[1::2]
    #leg = plt.legend(handles, labels, ncol=2)
    #
    #for vpack in leg._legend_handle_box.get_children():
    #    for hpack in vpack.get_children()[:1]:
    #        hpack.get_children()[0].set_width(0)
    #
    ax.annotate('', (3, 6), (3, 8), arrowprops=dict(width=1, headwidth=10, headlength=12, ec='k', fc='k'))
    ax.legend()
    plt.tight_layout()
    plt.savefig('/home/florian/platon_public_html/simplexstuff/lab_meeting_02.png')