def decleration_color_coded_for_post(dataset, plot=True):

    fa.calc_stats_at_deceleration(dataset, keys=None, time_offset=0, return_vals=False)
    angleok = np.where( (dataset.angle_at_deceleration < 2)*(dataset.angle_at_deceleration > .01) )[0].tolist()
    
    fig = plt.figure()
    ax = fig.add_subplot(111)
    
    black_post = []
    checkered_post = []
    for i, p in enumerate(dataset.post_type_at_deceleration):
        if i in angleok:
            if 'black' in p:
                black_post.append(i)
            if 'checkered' in p:
                checkered_post.append(i)
            
    print '*'*40
    print len(black_post), len(checkered_post)
    
    bins, hists, hist_std, curves = floris.histogram(ax, [np.log(dataset.angle_at_deceleration[black_post]), np.log(dataset.angle_at_deceleration[checkered_post])], bins=16, colors=['black', 'teal'], bin_width_ratio=0.9, edgecolor='none', bar_alpha=0.2, curve_fill_alpha=0, curve_line_alpha=0.8, return_vals=True, normed_occurences='total', bootstrap_std=True)
    
    ax.plot(np.log(dataset.angle_at_deceleration[black_post]), dataset.speed_at_deceleration[black_post], '.', color='black', alpha=1)
    ax.plot(np.log(dataset.angle_at_deceleration[checkered_post]), dataset.speed_at_deceleration[checkered_post], '.', color='teal', alpha=1)
    
    #ax.set_ylim(0,1.2)
    fa.fix_angle_log_spine(ax, histograms=True)
    
    fig.savefig('deceleration_color_coded.pdf', format='pdf')
Beispiel #2
0
def t_test_speed_at_deceleration(dataset):
    
    fa.calc_stats_at_deceleration(dataset, keys=None, time_offset=0, return_vals=False)
    angleok = np.where( (dataset.angle_at_deceleration < 2)*(dataset.angle_at_deceleration > .01) )[0].tolist()
    
    
    black_post = []
    checkered_post = []
    for i, p in enumerate(dataset.post_type_at_deceleration):
        if i in angleok:
            if 'black' in p:
                black_post.append(i)
            if 'checkered' in p:
                checkered_post.append(i)
            
    print '*'*40
    print len(black_post), len(checkered_post)
    
    
    print scipy.stats.ttest_ind(dataset.speed_at_deceleration[black_post], dataset.speed_at_deceleration[checkered_post])
    print 'black: ', np.mean(dataset.speed_at_deceleration[black_post]), 'n: ', len(dataset.speed_at_deceleration[black_post])
    print 'checkered: ', np.mean(dataset.speed_at_deceleration[checkered_post]), 'n: ', len(dataset.speed_at_deceleration[checkered_post])
    print 'total n - 2: ', len(black_post) + len(checkered_post) - 2