Skip to content

agustinfitipaldi/ridestats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ride Data Analyzer

Python tool for analyzing cycling FIT files. Generates distribution charts, statistics, and zone-based analysis for power, heart rate, and cadence. Includes Strava integration for downloading and analyzing rides directly from your account.

Demo Charts

Heart Rate

heart_rate_distribution

Power

power_distribution

Cadence

cadence_distribution

Summary Table

summary_stats

Time Series

timeseries_heart_rate

Setup

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Strava API Setup (Optional)

To use Strava integration features:

  1. Create a Strava API Application

  2. Create Configuration File

    cat > .strava_config.json << EOF
    {
      "client_id": "YOUR_CLIENT_ID",
      "client_secret": "YOUR_CLIENT_SECRET"
    }
    EOF
  3. Authorize the Application

    python analyze_ride.py --strava-auth

    This will open a browser for authorization and save your tokens.

For more details on creating a Strava app, see the Strava API documentation.

Usage

Local FIT Files

Analyze a single FIT file:

python analyze_ride.py <fit_file>

Analyze all FIT files in current directory (timeseries):

python analyze_ride.py --timeseries

Strava Integration

Interactive ride selection (browse by name):

python analyze_ride.py --strava-select                # Single ride
python analyze_ride.py --strava-select-timeseries     # Multi-select for trends

Analyze by activity ID:

python analyze_ride.py --strava-activity 123456789

Analyze recent rides:

python analyze_ride.py --strava-recent 5              # Last 5 rides
python analyze_ride.py --strava-timeseries 10         # Last 10 rides (trends)

Output

Single Ride Analysis

Creates a directory ride_YYYY-MM-DD/ containing:

Distribution Charts:

  • power_distribution.png - Power histogram with mean/median
  • heart_rate_distribution.png - HR histogram with mean/median
  • cadence_distribution.png - Cadence histogram with mean/median

Statistics Tables:

  • summary_stats.png - Combined table with mean, median, SD for all metrics
  • power_stats.png - Detailed power statistics
  • heart_rate_stats.png - Detailed HR statistics
  • cadence_stats.png - Detailed cadence statistics

Zone Analysis:

  • power_zones.png - Distribution across FTP-based training zones
  • heart_rate_zones.png - Distribution across max HR-based zones

Timeseries Analysis

Creates a timeseries_analysis/ directory containing:

  • timeseries_power.png - Power trends over time (mean, median, IQR, max)
  • timeseries_heart_rate.png - Heart rate trends over time
  • timeseries_cadence.png - Cadence trends over time

Configuration

Edit zones_config.json to set your FTP and max heart rate:

{
  "ftp": 185,
  "max_heart_rate": 195,
  ...
}

Power Zones (% of FTP)

  • Z1 Recovery: 0-55%
  • Z2 Endurance: 55-75%
  • Z3 Tempo: 75-90%
  • Z4 Threshold: 90-105%
  • Z5 VO2Max: 105-120%
  • Z6 Anaerobic: >120%

Heart Rate Zones (% of Max HR)

  • Z1 Recovery: 0-60%
  • Z2 Endurance: 60-70%
  • Z3 Tempo: 70-80%
  • Z4 Threshold: 80-90%
  • Z5 Max: >90%

About

cli interface to get stats from strava rides

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages