Release 0.4.0 with new running metrics and examples package!
New release of runpandas comes with new features and improved docs!
This current state of the project is
early beta
, which means that features can be added, removed or changed in backwards incompatible ways.
It has beeen a while since our last release, this is because we are working hard in new features in our new release of RunPandas 0.4. Let's highlight them:
- The Activity now provides extra running statistics such as Vertical Altitude Speed (VAM), mean speed, mean pace, gradient, and mean heart rate.
- Now we provide in our
runpandas.MeasureSeries
the capability of conversions such as distance conversion (km - miles), latitudes and longitudes (degrees - radians) and pace conversion (min/km and min/mile). - There is an auxiliar package for loading activity examples for testing and demo purposes:
runpandas.datasets
. The goal is to enrich with several real examples in FIT, GPX and TCX format files. - Finally, there is a CI workflow for uploading automatically a package to Pypi after release.
Runpandas is a python package based on pandas
data analysis library, that makes it easier to perform data analysis from your running sessions stored at tracking files from cellphones and GPS smartwatches or social sports applications such as Strava, MapMyRUn, NikeRunClub, etc. It is designed to enable reading, transforming and running metrics analytics from several tracking files and apps.
First let's explain the differences between mean pace and mean speed. Although both values express similar information, they are the reverse of each other. The Pace is how much time you need to cover a particular distance, while speed is an indicator of the number of meters you are able to cover within one second. These values can be presented different, depending on the measure units used to express these metrics. Pace is given in unit of time per unit of distance, whereas speed is distance over time.
The formulas are:
Speed (m/s) = distance (m) / time (s)
Pace (s/m) = time (sec) / distance (m)
We provide in runpandas new acessors (runpandas.acessors
) for computing those metrics:
#Disable Warnings for a better visualization
import warnings
warnings.filterwarnings('ignore')
# !pip install runpandas
import runpandas as rpd
activity = rpd.read_file('./data/sample.tcx')
#compute the distance using haversine formula between two consecutive latitude, longitudes observations.
activity['distpos'] = activity.compute.distance()
#compute the speed normalized per interval.
activity['speed'] = activity.compute.speed(from_distances=True)
activity['speed'].head()
print('Mean speed m/s:', activity.mean_speed())
print('Mean pace s/m:', activity.mean_pace())
Generally this is shown in different units like speed (km/h) and pace (min/km):
#convert m/s to km/h by multiplying the factor of 3.6
print('Mean speed km/h:', activity.mean_speed() * 3.6)
#We define a auxiliar function to convert the pace from sec/m to min/km:
def convert_pace_secmeters2minkms(seconds):
from pandas import Timedelta
pace_min = int((seconds * 1000) / 60)
pace_sec = int(seconds * 1000 - (pace_min * 60))
total_seconds = (pace_min * 60) + pace_sec
return Timedelta(seconds=total_seconds)
pace_min_km = convert_pace_secmeters2minkms(activity.mean_pace().total_seconds())
print('Mean pace min/km:', pace_min_km)
Gradient is a measure of the route steepness-the magnitude of its incline or slope as compared to the horizontal. Most often presented as a percentage, the gradient of a climb will normally fall somewhere between 3-15 percent. For practical use, it is usually used for estimating the difficulty of the climb during the route.
#Gradient computed through the distance points
activity['grad'] = activity.compute.gradient()
activity['grad']
VAM (Vertical Altitude Speed) similar to speed except it tracks how fast you go up vertically rather than horizontally between two points. While speed is measured in miles or kilometers per hour, VAM is measured in vertical meters per hour (vmh). It tells you how many meters you would climb if you went up a moderate grade for an hour.
#Vertical Altitude Speed (VAM) in m/s
activity['vam'] = activity.compute.vertical_speed()
activity['vam']
#Meart heart rate through the activity
'bpm', int(activity.mean_heart_rate())
#convert the speed m/s to km/h
activity['speed'].kph
#gradient converted from degrees to percent
activity['grad'].pct
#Total Altitude descent and ascent
print('Ascent', sum(activity['alt'].ascent))
print('Descent', sum(activity['alt'].descent))
#distance from meters to kms
activity['dist'].km
The runpandas package also comes with extra batteries, such as our runpandas.datasets package
, which includes a range of example data for testing purposes. There is a dedicated repository with all the data available. An index of the data is kept here.
example_fit = rpd.activity_examples(path='Garmin_Fenix_6S_Pro-Running.fit')
print(example_fit.summary)
print('Included metrics:', example_fit.included_data)
rpd.read_file(example_fit.path).head()
In case of you just only want to see all the activities in a specific file type , you can filter the runpandas.activities_examples
, which returns a filter iterable that you can iterate over:
fit_examples = rpd.activity_examples(file_type=rpd.FileTypeEnum.FIT)
for example in fit_examples:
#Download and play with the filtered examples
print(example.path)
Working hard in advanced running metrics such as power , heart rate zones and the feature of printing the summary of the activity with the main statistics.
We are constantly developing Runpandas improving its existing features and adding new ones. We will be glad to hear from you about what you like or don’t like, what features you may wish to see in upcoming releases. Please feel free to contact us.