Skip to content

triskadecaepyon/pyworkout-toolkit

Repository files navigation

pyworkout-toolkit

pyworkout-toolkit: Python tools to process workout data and telemetry

Build Status noarch Conda Version Conda Platforms

Summary

The pyworkout-toolkit is a Python package that provides tools for post-workout analysis of data or telemetry. The majority of the tools cater to coaches and invidividuals who wish to utilize the data to generate metrics or exercise machine learning/data mining. The toolkit provides parsing of the popular .TCX and .GPX formats, along with some general purpose functions that help preprocess the data for metrics, visualization, or machine learning.

Features

  • Parsing of .TCX files
  • Caters to the Pandas DataFrame for analysis flexibility and use in Scikit-Learn and other frameworks
  • Helper functions to correct sport-specific errors in recording
  • Handling of missing data
  • Exporting to popular formats such as CSV and HDF5 via Pandas

Planned Features

  • Parsing of .GPX files
  • Conversion/correction of GPS units

Documentation

Examples

With pyworkout-toolkit, parsing of TCX files is simple:

from pyworkout.parsers import tcxtools
workout_data = tcxtools.TCXPandas('pyworkout/tests/data/test_dataset_1.tcx') # Create the Class Object
workout_data.parse() # Returns a dataframe

Other details about the TCX file can be found as well:

workout_data.get_sport()
'Biking'

workout_data.get_workout_startime()
'2016-10-20T22:01:26.000Z'

If opening multiple TCX files for large-scale reporting, it is recommended that Dask and Dask Delayed be used:

import dask.dataframe as dd
from dask import delayed

tcx1 = delayed(tcxtools.TCXPandas('workout_1.tcx').parse()) # Delay these calculations
tcx2 = delayed(tcxtools.TCXPandas('workout_2.tcx').parse()) # Use as many as needed

total = dd.from_delayed([tc1, tc2]) # However many files you need
total.visualize() # Visualize the task graph
total.compute() # Compute it
# This returns a dataframe with all the files

Getting your data

In order to get your data in TCX format, you will need to export the files from the given service.

Please note that the TCX format will make certain workouts absent of important metadata, such as those used to identify swim workouts. In these cases, specifying workout type upon class instantiation is recommended.

In addition to this, the new Run Dynamics data which debuted a few years ago is not exported via TCX format. You must have a relatively expensive Garmin Connect API License for this. A bit more info on this is viewable on stackoverflow. It is unknown whether Suunto's MovesCount allows for this data export. More info on exporting data from MovesCount here and here

Dependencies

  • NumPy
  • Pandas
  • lxml
  • Python 3 (developed originally on 3.5.2)

Installation

Local installation is supported, with pip and conda-build files included. Currently available on pip and conda.

pip installation:

pip install pyworkout-toolkit

conda installation:

pyworkout-toolkit has recently been added to conda-forge. Use the command below to install:

conda install pyworkout-toolkit

If one's conda installation needs the conda-forge channel, use the following command:

conda config --add channels conda-forge

License

BSD

Scope and goals

The pyworkout-toolkit aims to assist in the furthering of research in the health/wearables area by providing the tools necessary to process, correct, and analyze collected data. The project was created to fill the gap between data aquisition on the device to the end-developer, allowing for algorithm creation, data mining, and visualization once the data has been converted. Eventual integration with graphing libraries have been planned, with Matplotlib, Bokeh, and Datashader on the list.

About

Python tools to process workout data and telemetry for metrics and machine learning

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages