Skip to content

Instantly share code, notes, and snippets.

@erkolson
Created July 13, 2020 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erkolson/6aa7dac8f89152887a286844e04617ca to your computer and use it in GitHub Desktop.
Save erkolson/6aa7dac8f89152887a286844e04617ca to your computer and use it in GitHub Desktop.
compare hrm from 2 different devices
#!/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