def test_plots(json): track = RKJSON(json) vels = track.calculate_vels() longsmoo = smooth(vels.vel, window_len=len(vels) / 2) shortsmoo = smooth(vels.vel) fig, (ax1, ax2) = plt.subplots(2) ax1.set_title("Speed and smoothed speed") ax1.yaxis.set_label_text("km/h") ax1.plot(vels.time, shortsmoo, vels.time, longsmoo) ax2.set_title("Speed anomaly") ax2.yaxis.set_label_text("% anomaly") ax2.plot(vels.time, vels.anom * 100) fig.autofmt_xdate() plt.show()
def test_plot_speeds(xml): track = GPX(xml) # validate sanity assert len(track.lat[:-1]) == len(track) - 1 vels = track.calculate_vels() assert len(vels) == len(track) - 1 longsmoo = smooth(vels.vel, window_len=len(vels) / 2) shortsmoo = smooth(vels.vel) assert len(longsmoo) == len(shortsmoo) == len(vels) fig, ax = plt.subplots(1) ax.plot(vels.time, shortsmoo, vels.time, longsmoo) fig.autofmt_xdate() plt.show()