data_t[:, 2] = compute.smooth(data_t[:, 2], win_size=WIN_SMOOTH_SIZE) # get the time variable to use in the future T = data_s[:, 0] # compute speed and acceleration (veloc_s, accel_s) = compute.velocity(data_s, win_size=WIN_VELOCITY_SIZE) (veloc_t, accel_t) = compute.velocity(data_t, win_size=WIN_VELOCITY_SIZE) # dchanges = compute.dir_changesX2(data, win_size=100) dchanges_s = compute.dir_changesX3(data_s, win_size=WIN_CHANGE_DIR_SIZE) dchanges_t = compute.dir_changesX3(data_t, win_size=WIN_CHANGE_DIR_SIZE) (fs, es, thy, thv, tha, thdc) = compute.decide3(T, data_s[:, 2], veloc_s, veloc_t, accel_s, accel_t, dchanges_s, THRES_V, THRES_Y, THRESHOLD_DC, THRESHOLD_A) intervals = compute.interval_list(fs, es, T) compute.subtitle(intervals, name_sub) bins = compute.report(fs, es, data_s, 0, name_rep, BIN_SIZE) bins_list[key] = bins if SHOW_3D: utils.plot3d(data_t[:, 1], data_t[:, 2], data_s[:, 2], fs, es, XLIMS, YLIMS, ZLIMS, fname=name_fig2, fdpi=FIG_DPI, style=FIG3D, style_normal=FIG3D_NORMAL, style_erratic=FIG3D_ERRATIC, style_freeze=FIG3D_FREEZE) plt.figure(1) plt.subplot(5, 1, 1) plt.plot(T, data_s[:, 1], 'b') # X plt.plot(T, -data_t[:, 1], 'g') # X plt.subplot(5, 1, 2) plt.plot(T, data_s[:, 2]) # Y plt.axhline(thy)
data_smooth[:, 1] = compute.smooth(data[:, 1], win_size=25) data_smooth[:, 2] = compute.smooth(data[:, 2], win_size=25) # get the time variable to use in the future T = data[:, 0] # compute speed and acceleration (veloc, accel) = compute.velocity(data_smooth, win_size=125) #dchanges = compute.dir_changesX2(data, win_size=100) dchanges = compute.dir_changesX3(data, win_size=10) #(fs, es) = compute.decide(data, veloc, accel, dchanges) (fs, es) = compute.decide2(T, veloc, data[:, 2], accel, dchanges) intervals = compute.interval_list(fs, es, data, 0) compute.subtitle(intervals, name_sub) compute.report(fs, es, data, 0, name_rep) plt.figure(1) plt.subplot(5, 1, 1) plt.plot(T, data[:, 1]) # X plt.subplot(5, 1, 2) plt.plot(T, data[:, 2]) # Y plt.subplot(5, 1, 3) plt.plot(T, veloc, 'r') # veloc plt.axhline(0.1) THRES = 7.5