Jupyter notebook to compare heart rate data between devices with Python.
This notebook uses matplotlib.pyplot, numpy, pandas, regex, scipy.stats, sklearn.metrics, and xml to clean, wrangle and analyze heart rate data from both Polar H10 chest-strap monitor and Apple Watch Series 8.
The main steps of the notebook:
- Import Watch & Polar data as DataFrames
- Wrangle both datasets, leveraging timestamps, regex and pandas filtering.
- Reconcile Polar and Watch data, keeping only the data points with synched timestamps.
- Calculate sampling frequencies for both devices.
- Plot rolling mean heart rate graphs for each training date.
- Filter dateframes by heart rate zones and analyze per zone.
- Plot Bland-Altman agreement plots between devices per zone.
- Explore mean absolute error, pearson correlation and intraclass correlation coefficient for each heart rate zone.
This notebook ships assuming the following folder structure. You are welcome to modify this for your needs within the notebook.
├── heart-rate-monitors (repo)
│ ├── analysis.ipynb
│ ├── data
│ │ ├── polar
│ │ ├── watch
│ ├── figs