Skip to main content

Training metrics for endurance sports: CTL/ATL/TSB, ACWR, decoupling, and more

Project description

endurance-metrics

Training metrics for endurance sports: CTL/ATL/TSB, ACWR, decoupling, and more.

Zero external dependencies — uses Python standard library only.

Installation

pip install endurance-metrics

Quick start

from endurance_metrics import compute_ctl_atl_tsb, calculate_acwr

# Compute fitness/fatigue/form from daily training loads
activities = [
    {"date": "2026-01-01", "load": 80},
    {"date": "2026-01-02", "load": 65},
    {"date": "2026-01-03", "load": 0},
    {"date": "2026-01-04", "load": 90},
]
ctl, atl, tsb = compute_ctl_atl_tsb(activities)
print(f"CTL={ctl:.1f}, ATL={atl:.1f}, TSB={tsb:.1f}")

# Compute Acute:Chronic Workload Ratio
acwr = calculate_acwr(activities)
print(f"ACWR={acwr:.2f}")

Features

Fitness metrics (endurance_metrics.fitness)

  • compute_ctl_atl_tsb() — Chronic/Acute Training Load and Training Stress Balance
  • compute_ctl_history() — CTL progression over time
  • compute_atl_history() — ATL progression over time
  • compute_tsb_history() — TSB progression over time
  • compute_fitness_summary() — Complete fitness summary
  • compute_form_trend() — Form trend analysis

Advanced metrics (endurance_metrics.advanced)

  • compute_ramp_rate() — CTL ramp rate (fitness loading speed)
  • compute_fitness_trend() — Multi-period fitness trend
  • compute_peak_fitness() — Peak CTL identification
  • detect_overtraining_risk() — Overtraining risk detection
  • compute_training_zones_distribution() — Training zones distribution
  • compute_periodization_score() — Periodization quality score

Workload metrics (endurance_metrics.workload)

  • calculate_acwr() — Acute:Chronic Workload Ratio
  • calculate_monotony_strain() — Training monotony and strain

Decoupling analysis (endurance_metrics.decoupling)

  • calculate_decoupling() — Effort:Cardio decoupling percentage
  • analyze_overtime() — Detailed overtime analysis with pacing assessment
  • compute_normalized_power() — Normalized Power (cycling)

Decoupling supports multiple effort types:

from endurance_metrics import calculate_decoupling

# Cycling (power-based, uses Normalized Power)
dec = calculate_decoupling(watts, hr, effort_type="power")

# Running (pace-based, uses rolling average)
dec = calculate_decoupling(pace, hr, effort_type="pace")

# Pre-normalized data
dec = calculate_decoupling(effort, hr, effort_type="raw")

API reference

Field names

Workload functions accept customizable field names:

from endurance_metrics import calculate_acwr

# Default: looks for "load" and "date" fields
acwr = calculate_acwr(activities)

# Custom field names
acwr = calculate_acwr(
    activities,
    load_field="tss",
    date_field="start_date",
)

Decoupling with threshold

from endurance_metrics import analyze_overtime

result = analyze_overtime(
    effort_data=watts,
    cardio_data=hr,
    prescribed_seconds=3600,
    effort_type="power",
    threshold=280,  # FTP or threshold value
)

Development

git clone https://github.com/stephanejouve/endurance-metrics.git
cd endurance-metrics
poetry install --with dev
poetry run pytest tests/ -v
poetry run black src/ tests/ --check --line-length=100
poetry run ruff check src/
poetry run isort src/ tests/ --check-only --profile black --line-length=100

License

MIT

Project details


Download files

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

Source Distribution

endurance_metrics-0.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

endurance_metrics-0.1.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file endurance_metrics-0.1.0.tar.gz.

File metadata

  • Download URL: endurance_metrics-0.1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.11 Darwin/20.6.0

File hashes

Hashes for endurance_metrics-0.1.0.tar.gz
Algorithm Hash digest
SHA256 73e67e46cf9fbefab1789445a9877aad11fde6893a7247d18c9623b7d0b34f83
MD5 aeac9f1485dee9e44c1c9c2f4bc1c5d7
BLAKE2b-256 8d7d5041260ce287725a25aa1482397cf4e97ffbb705b1ec3ee642e9ac99dee1

See more details on using hashes here.

File details

Details for the file endurance_metrics-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: endurance_metrics-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.11 Darwin/20.6.0

File hashes

Hashes for endurance_metrics-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 663f7556e4ef386a4c79433feb22076f58b0802406090a7ec9b5e6569a9c6b43
MD5 b47195834af173c4193d3ccbf74712ca
BLAKE2b-256 d3dbdabf15504a58d6556ac8e42eb6a110f3dfdfd4422dd131b7a442fb7bef92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page