Пример #1
0
def test_time_decay():
    #data=np.loadtxt('/Volumes/NO NAME/nn_test/test_file_2015-12-5_17-36-33.txt',delimiter=' ')
    data=np.loadtxt('/Users/subercui/Git/BaikeBalance/New data/nn_test/NNcontrol_2015-12-20_11-39-36.txt')
    #2.lean angle/degree 3.lean angle rate/degree 10.U0 11.turn angle in/rad 13.velocity 20.turn angle out 21.nn turn angle out
    data=data[:,(1,2,3,10,11,13,20,21)]
    #data=select(data)
    #visualize(data)
    predictions=lt.test(data[:,1:6])
    plt.figure('test decay')
    plt.plot(data[:,-2],label='turn angle out')
    plt.plot(data[:,-1],label='network out')
    plt.plot(-data[:,1],label='steering filted')
    #plt.plot(predictions,label='offline network out')
    plt.grid()
    plt.legend(loc='best', fancybox=True, framealpha=0.5)
    plt.xlabel('time(10ms)')
    plt.ylabel('Value')
    plt.show()

    return data 
def test_time_decay(path='/Users/subercui/Git/BaikeBalance/New data/nn_test/NNcontrol_2015-12-20_11-39-36.txt'):
    #data=np.loadtxt('/Volumes/NO NAME/nn_test/test_file_2015-12-5_17-36-33.txt',delimiter=' ')
    data=np.loadtxt(path)
    print data.shape
    #2.lean angle/degree 3.lean angle rate/degree 10.U0 11.turn angle in/rad 13.velocity 18.turn angle out 19.nn turn angle out
    data=data[:,(1,2,9,10,12,18,19)]
    #data=select(data)
    #visualize(data)
    #predictions=lt.test(data[:,0:5],weightfile='MLP_weightsBest.hdf5')
    predictions2=lt.test(data[:,0:5],weightfile='MLP_weightsMultispeed160118.hdf5')
    #simupred=cf.control_func(data[:,0:5],data[:,0:5].shape[0])
    plt.figure('test decay')
    plt.plot(data[:,-2],label='turn angle out')
    plt.plot(data[:,-1],label='network out')
    #plt.plot(simupred[:],label='simulation out')
    #plt.plot(predictions[:],label='offline network out')
    plt.plot(predictions2[:],label='offline mutispeed')
    plt.grid()
    plt.legend(loc='best', fancybox=True, framealpha=0.5)
    plt.xlabel('time(10ms)')
    plt.ylabel('Value')
    plt.show()

    return data