예제 #1
0
def test_plot(hdf5_filename):
#extract center data from HDF5
    c_feat,c_data = get_hdf5_data(hdf5_filename,fields=['center'])

    #compute speed features
    s_feat,s_data = speed_feature_extraction(c_data)
    print s_feat
    print s_data

    #compute directional features
    d_feat,d_data = direction_feature_extraction(c_data)
    print d_feat
    print d_data

    #plot data
    import matplotlib.pyplot as plt

    fig = plt.figure()
    ax = fig.add_subplot(111, aspect='equal')
    rank = npy.argsort(d_data[:,0])
    for i,r in enumerate(rank):
        xy = c_data[r]['center']
        p_length = s_data[r,0]
        x0 = xy[0,0]
        y0 = xy[0,1]
        offset_x = s_data[r,6]*10000
        #        offset_x = p_length*10
        #        offset_x = s_data[r,3]*100
        #        offset_x = d_data[r,3]*10
        offset_y = d_data[r,3]*10
        plt.plot(xy[:,0]-x0+offset_x,xy[:,1]-y0+offset_y)
        fxy = filter(xy,sigma=1.)
        plt.plot(fxy[:,0]-x0+offset_x,fxy[:,1]-y0+offset_y)
        plt.plot(offset_x,offset_y,'+k')
예제 #2
0
def test_measures():
    import matplotlib.pyplot as plt
    from hdf5_read import get_hdf5_data

    from measurement import speed_feature_extraction

    hdf5_filename = '../test/data/test_rev.hdf5'
    c_feat,c_data = get_hdf5_data(hdf5_filename,fields=['center'])

    #compute speed features
    feat,data = speed_feature_extraction(c_data)

    print feat
    plt.scatter(data[:,1],data[:,3])
    plt.xlabel('avg speed')
    plt.ylabel('hull speed')
    plt.draw()

    plt.figure()

    plt.hist(data[:,1:4])

    plt.legend(['avg','mrdo','hull speed'])
    plt.show()