Skip to main content

Python library for analysis of ANT/Garmin .fit files

Project description


Python library for analysis of running data files.

Python 3.6 License

Table of Contents


heartandsole is designed to work with running or walking activity files. It allows for extraction of data from a .fit file as well as calculations, such as the following:

  • elapsed time
  • moving time
  • average heart rate
  • running power (based on Dr. Philip Friere Skiba's GOVSS algorithm)
  • average running power
  • normalized running power (based on information publicly available about TrainingPeaks' NP® and NGP®, and Dr. Philip Friere Skiba's GOVSS algorithm)
  • intensity (based on information publicly available about TrainingPeaks' IF®)
  • training stress (based on information publicly available about TrainingPeaks' TSS® and Dr. Philip Friere Skiba's GOVSS algorithm)

My impetus for this project was to implement a version of Philip Friere Skiba's GOVSS algorithm (with tweaks to better align with the underlying research). The end result will be a free, open-source version of proprietary calculations found in platforms like Strava and Training Peaks. My hope is that other runners will benefit as I have from taking these secret algorithms out of their black box, by understanding the science behind these calculations and training smarter.

This package was originally forked from Michael Traver's fitanalysis package, but the two projects diverged significantly enough for me to move my fork to a separate repository. I am indebted to Michael for writing such a clean, useful, easy-to-understand package that served as heartandsole's starting point.

Dependencies and Installation

Pandas, NumPy, fitparse, and spatialfriend are required.

pip install heartandsole to install.


heartandsole provides the Activity class.

import heartandsole

fit = heartandsole.FitActivity('')
activity = heartandsole.Activity(, fit.elapsed_time)


# Also available for power, equivalent-power flat-ground speed,
# cadence, and heart rate:

# Calculates running power from speed, and elevation data.
power = activity.power

# 30-second moving average power is a more suitable
# proxy for metabolic intensity than instantaneous power.
power_smooth = activity.power_smooth

# Summarizing activity power with the 4-norm is more representative
# of intensity than average power.

# Intensity and training stress calculations require a threshold 
# power value (in Watts/kg), which the utility functions can calculate
# from flat-ground threshold pace (min/mile).
pwr = heartandsole.powerutils.flat_run_power('6:30')

# Intensity and training stress may also be calculated from
# HR data. This calculation requires a threshold HR value in BPM.

Construction of a FitActivity parses the .fit file and detects periods of inactivity. The decision to remove inactive periods is left to the user.

Construction of an Activity accepts a pandas DataFrame formatted by a FitActivity, plus an elapsed time value (which may not be possible to calculate from the formatted DataFrame).

Project Status

Current Activities

  • Showcase package functionality on my website.

  • Make a project wiki so I can be as verbose as I please.

  • Make life a little easier with Travis CI.

Future Work

  • Expand file-reading ability to gpx, .tcx, .pwx, and maybe more.


Coggan, A. (2012, June 20). Re: Calculate Normalised Power for an Interval [Online forum comment]. Retrieved June 14, 2017, from

Coggan, A. (2016, February 10). Normalized Power, Intensity Factor and Training Stress Score. TrainingPeaks. Retrieved June 14, 2017, from

Coggan, A. (2003, March 13). TSS and IF - at last! [Online forum post]. Retrieved June 14, 2017, from

Di Prampero, P. E., Atchou, G., Brückner, J. C., & Moia, C. (1986). The energetics of endurance running. European Journal of Applied Physiology and Occupational Physiology, 55(3), 259-266.

Di Prampero, P. E., Capelli, C., Pagliaro, P., Antonutto, G., Girardis, M., Zamparo, P., & Soule, R. G. (1993). Energetics of best performances in middle-distance running. Journal of Applied Physiology, 74(5), 2318-2324.

Eckner, A. (2017, April 3). Algorithms for Unevenly Spaced Time Series: Moving Averages and Other Rolling Operators. Retrieved June 14, 2017, from

Friel, J. (2009, September 21). Estimating Training Stress Score (TSS). TrainingPeaks. Retrieved June 22, 2017, from

Minetti, A. E., Moia, C., Roi, G. S., Susta, D., & Ferretti, G. (2002). Energy cost of walking and running at extreme uphill and downhill slopes. Journal of Applied Physiology, 93(3), 1039-1046.

Pugh, L. G. E. (1971). The influence of wind resistance in running and walking and the mechanical efficiency of work against horizontal or vertical forces. The Journal of Physiology, 213(2), 255-276.

Skiba, P. F. (2006, September 16). Calculation of Power Output and Quantification of Training Stress in Distance Runners: The Development of the GOVSS Algorithm. RunScribe. Retrieved August 20, 2019, from


Reach out to me at one of the following places!



This project is licensed under the MIT License. See LICENSE file for details.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for heartandsole, version 0.0.12
Filename, size File type Python version Upload date Hashes
Filename, size heartandsole-0.0.12-py3-none-any.whl (18.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size heartandsole-0.0.12.tar.gz (15.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page