Skip to main content

heartandsole: Python library for analysis of running data files

PyPI Latest Release License Supported Python versions

Table of Contents

Introduction

heartandsole is designed to work with running activity files. It reads data from .fit, .tcx, .gpx, and .csv files, converts it to pandas data structures, then performs calculations and summarizes the data, for example:

  • elevation gain
  • elapsed time
  • timer time
  • distance from GPS coordinates

Dependencies

Pandas and NumPy are required.

A number of optional dependencies enable various features, such as reading data from specific activity file formats and performing geospatial calculations:

  • fitparse allows data to be read in from .fit files.
  • activereader allows data to be read in from .tcx and .gpx files.
  • pandas-xyz allows geospatial calculations, like converting GPS coordinates to distance and determining elevation gain along a route.

Installation

pip install heartandsole to install.

Example

heartandsole provides the Activity class.

Activities can be constructed manually with a required records DataFrame and optional summary Series and laps DataFrame, or they can be constructed directly from various activity file formats using Activity.from_* class methods.

from heartandsole import Activity

# Reading from a fit file requires the fitparse package to be
# installed.
activity = heartandsole.Activity.from_fit('my_activity.fit')

# Various field accessors provide methods related to specific data fields
# commonly found in activity files.
print(activity.time.elapsed(source='records'))
print(activity.time.timer(source='summary'))

# Geospatial calculations require pandas-xyz to be installed.
print(activity.elevation.gain(source='records'))  # scalar
print(activity.distance.records_from_position())  # Series

License

License

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

Documentation

The official documentation is hosted on readthedocs.io: https://heartandsole.readthedocs.io/en/stable.

Background

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 (eventually - bear with me). 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.

Contact

You can get in touch with me at the following places:

Release files for heartandsole 0.0.24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for heartandsole 0.0.24
File Size Uploaded
heartandsole-0.0.24.tar.gz 28.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for heartandsole 0.0.24
File Interpreter ABI Platform
heartandsole-0.0.24-py3-none-any.whl Python 3 none any Details

Total release size: 62.3 kB

Release files / heartandsole-0.0.24.tar.gz

Download URL heartandsole-0.0.24.tar.gz
Size 28.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7fac7bccaa889d10864ef061c93e861b4098b56163af7841b6f75c5685e45da8
BLAKE2b-256 checksum
How to use checksums
ba6b54f0e24b6ac913346c733ed1a83c37a385107eab70e3a446ee21f341c627
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release files / heartandsole-0.0.24-py3-none-any.whl

Download URL heartandsole-0.0.24-py3-none-any.whl
Size 33.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
696e738210886ea227f763ada134066910a6688260220bac06bb7037a5ea28a4
BLAKE2b-256 checksum
How to use checksums
56a3c078d1fd50e61a85233e7bf633e885cbb734383dee4589dcb3a2df317b53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release history Release notifications | RSS feed

This release

0.0.24 This release

2 release files

0.0.23

2 release files

0.0.22

2 release files

0.0.21

2 release files

0.0.20

2 release files

0.0.19

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page