Created
July 13, 2020 19:24
-
-
Save erkolson/6aa7dac8f89152887a286844e04617ca to your computer and use it in GitHub Desktop.
compare hrm from 2 different devices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from fitparse import FitFile | |
import matplotlib.pyplot as plt | |
garmin_fitfile = FitFile('./Evening_Ride.fit') | |
wahoo_fitfile = FitFile('./short_scream_into_the_void_race_.fit') | |
garmin_hr = [] | |
garmin_ts = [] | |
wahoo_hr = [] | |
wahoo_ts = [] | |
# Get all data messages that are of type record | |
for record in garmin_fitfile.get_messages('record'): | |
for record_data in record: | |
if record_data.name == "heart_rate": | |
garmin_hr.append(record_data.value) | |
elif record_data.name == "timestamp": | |
garmin_ts.append(record_data.value) | |
# print(garmin) | |
for record in wahoo_fitfile.get_messages('record'): | |
for record_data in record: | |
if record_data.name == "heart_rate": | |
wahoo_hr.append(record_data.value) | |
if record_data.name == "timestamp": | |
wahoo_ts.append(record_data.value) | |
# print(wahoo) | |
plt.plot(garmin_ts, garmin_hr, label='Garmin') | |
plt.plot(wahoo_ts, wahoo_hr, label='Wahoo Tickr') | |
plt.legend() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment