],
                 bins=15,
                 color=[RIGHTCOLOR, LEFTCOLOR],
                 normed=True)

dstr_axs[0].set_xlabel('change in number of wingbeats')
dstr_axs[0].set_ylabel('probability')
dstr_axs[1].set_xlabel('change in |L-R|')
dstr_axs[1].set_ylabel('probability')

# perform t-test between right motion and left motion triggered wbs
_, p_lr_wbf = ttest_ind(triggered_wbs[right_motion_idxs],
                        triggered_wbs[left_motion_idxs])
_, p_lr_lmr = ttest_ind(triggered_mean_lmrs[right_motion_idxs],
                        triggered_mean_lmrs[left_motion_idxs])

print 'P-value between WBF response to left and right motion: {}'.format(
    p_lr_wbf)
print 'P-value between LMR response to left and right motion: {}'.format(
    p_lr_lmr)

for ax in trig_avg_axs.flatten():
    ax.set_xlim(-1, 3)
    set_colors(ax, AXCOLOR)
    set_fontsize(ax, FONTSIZE)

for ax in dstr_axs:
    set_colors(ax, AXCOLOR)
    set_fontsize(ax, FONTSIZE)

plt.show()
            heading_ensemble.fetch_data(session)
            if heading_ensemble._data is None:
                continue

            time_vector = np.arange(len(heading_ensemble.mean))

            ax = axs[s_ctr, o_ctr]
            ax.errorbar(time_vector, heading_ensemble.mean, lw=3,
                        yerr=heading_ensemble.sem, color=COLORS_EXPT[expt])

            ax.set_ylim(Y_LIM)
            ax.set_xlim(X_LIM)

            if s_ctr == 1:
                ax.set_xlabel('timesteps')
            if o_ctr == 0:
                ax.set_ylabel('heading (degree)')

            if s_ctr == 0 and o_ctr == 1:
                ax.set_title('empirical')
            if s_ctr == 1 and o_ctr == 1:
                ax.set_title('infotaxis')


for ax in axs.flatten():
    set_fontsize(ax, FONT_SIZE)

axs[0, 0].legend(['0.3 m/s', '0.4 m/s', '0.6 m/s'], fontsize=24)

plt.show(block=True)
                        break

                heading_ensemble.fetch_data(session)
                if heading_ensemble._data is None:
                    continue

                time_vector = np.arange(len(heading_ensemble.mean))
                axs = axss[e_ctr]
                ax = axs[s_ctr, o_ctr]
                ax.errorbar(time_vector, heading_ensemble.mean, lw=3,
                            yerr=heading_ensemble.sem, color=COLORS[c])
                ax.set_xlim(X_LIM)
                ax.set_ylim(Y_LIM)

                if s_ctr == o_ctr == 0:
                    ax.legend(['early', 'late'], fontsize=FONT_SIZE)
                if s_ctr == 0 and o_ctr == 1:
                    ax.set_title('wind {} \n empirical \n'.format(WIND_SPEEDS[e_ctr]))
                elif s_ctr == 1 and o_ctr == 1:
                    ax.set_title('infotaxis \n'.format(WIND_SPEEDS[e_ctr]))

                if s_ctr == 1:
                    ax.set_xlabel('timesteps')
                if o_ctr == 0:
                    ax.set_ylabel('heading (deg)')


for axs in axss:
    [set_fontsize(ax, FONT_SIZE) for ax in axs.flatten()]

plt.show(block=True)
                if heading_ensemble._data is None:
                    continue

                time_vector = np.arange(len(heading_ensemble.mean))
                axs = axss[e_ctr]
                ax = axs[s_ctr, o_ctr]
                ax.errorbar(time_vector,
                            heading_ensemble.mean,
                            lw=3,
                            yerr=heading_ensemble.sem,
                            color=COLORS[c])
                ax.set_xlim(X_LIM)
                ax.set_ylim(Y_LIM)

                if s_ctr == o_ctr == 0:
                    ax.legend(['early', 'late'], fontsize=FONT_SIZE)
                if s_ctr == 0 and o_ctr == 1:
                    ax.set_title('wind {} \n empirical \n'.format(
                        WIND_SPEEDS[e_ctr]))
                elif s_ctr == 1 and o_ctr == 1:
                    ax.set_title('infotaxis \n'.format(WIND_SPEEDS[e_ctr]))

                if s_ctr == 1:
                    ax.set_xlabel('timesteps')
                if o_ctr == 0:
                    ax.set_ylabel('heading (deg)')

for axs in axss:
    [set_fontsize(ax, FONT_SIZE) for ax in axs.flatten()]

plt.show(block=True)