Last active
July 14, 2020 13:21
-
-
Save erkolson/202c7706ba0205244a1bc3f90d9ba174 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) | |
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) | |
plt.plot(garmin_ts, garmin_hr, label='Garmin') | |
plt.plot(wahoo_ts, wahoo_hr, label='Wahoo Tickr') | |
plt.legend() | |
plt.show() |
Author
erkolson
commented
Jul 13, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment