|
16 | 16 | from src import box, constants, util
|
17 | 17 | from src import modularity as mod
|
18 | 18 |
|
19 |
| -dflist = util.get_box_files(constants.DATA_HOME) |
| 19 | +dflist = util.get_box_files(constants.DATA_HOME, "txt") |
20 | 20 | util.ensure_date_in_filenames(dflist)
|
21 |
| -dflist = util.get_box_files(constants.DATA_HOME) |
| 21 | +dflist = util.get_box_files(constants.DATA_HOME, "txt") |
22 | 22 |
|
23 | 23 | ot_events = []
|
24 | 24 | lds = []
|
| 25 | +total_num_OC = 0 |
25 | 26 |
|
26 | 27 | for csv_file in dflist:
|
27 | 28 | print(csv_file, flush=True)
|
|
32 | 33 | ldata = box.make_ldata(csvr) # CSV data as a list
|
33 | 34 | # presses
|
34 | 35 | press_starts, press_lengths = box.get_press_lengths_and_starts(ldata)
|
35 |
| - |
| 36 | + |
| 37 | + for pl in press_lengths: |
| 38 | + if pl < 10: |
| 39 | + total_num_OC += 1 |
| 40 | + |
36 | 41 | b_partitions, a_partitions, b_modularities, a_modularities = mod.get_partitions(ldata, press_starts, press_lengths)
|
37 | 42 |
|
38 | 43 | for j, b_parts in enumerate(b_partitions):
|
|
107 | 112 | plt.clf()
|
108 | 113 |
|
109 | 114 | print("Number of OT events:", len(ot_events))
|
110 |
| - |
| 115 | +print("Number of Oncoming:", total_num_OC) |
111 | 116 | lds_trimmed_means = [stats.trim_mean(ld, 0.1)-20 for ld in lds]
|
112 | 117 | lds_trimmed_mins = []
|
113 | 118 | for ld in lds:
|
|
358 | 363 | # plt.legend(loc='upper right')
|
359 | 364 | # plt.savefig("figures/OT-vs-OC_events-hist.png")
|
360 | 365 | """
|
| 366 | + |
| 367 | +""" |
| 368 | +# -------------------------- TEST fit.py ---------------------------- |
| 369 | +import datetime |
| 370 | +from src import fit, util, constants |
| 371 | +filenames_list = util.get_box_files(constants.DATA_HOME, "fit") |
| 372 | +
|
| 373 | +ride_durations_wahoo = [] |
| 374 | +ride_distances_wahoo = [] |
| 375 | +
|
| 376 | +for filename in filenames_list: |
| 377 | + print(filename) |
| 378 | + msgs = fit.fit_file_messages(filename) |
| 379 | + session = fit.fit_get_session(msgs) |
| 380 | + if "Wahoo" in filename: |
| 381 | + ride_durations_wahoo.append(session[0]["total_elapsed_time"]) |
| 382 | + ride_distances_wahoo.append(session[0]["total_distance"]) |
| 383 | +
|
| 384 | +
|
| 385 | +print("total durations (wahoo):", str(datetime.timedelta(seconds = sum(ride_durations_wahoo)))) |
| 386 | +print("total distances (wahoo):", sum(ride_distances_wahoo)) |
| 387 | +""" |
361 | 388 | """
|
362 | 389 | # -------------------------- TEST radar.py ----------------------------
|
363 | 390 | from src import radar
|
364 | 391 | #radar.radar_decode()
|
365 | 392 | all_events = radar.radar_unload()
|
366 |
| -# radar.radar_events_to_csv("radar_out.csv", all_events) |
367 |
| -radar.plot_radar_data() |
| 393 | +radar.radar_events_to_csv("radar_out.csv", all_events) |
| 394 | +#radar.plot_radar_data() |
368 | 395 | """
|
369 | 396 | """
|
370 | 397 | # -------------------------- TEST util.py ----------------------------
|
371 | 398 |
|
372 |
| -for f in util.get_box_files(constants.DATA_HOME): |
| 399 | +for f in util.get_box_files(constants.DATA_HOME, "TXT"): |
373 | 400 | print(f)
|
374 | 401 |
|
375 | 402 | print()
|
|
0 commit comments