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 Balancecompute_ctl_history()— CTL progression over timecompute_atl_history()— ATL progression over timecompute_tsb_history()— TSB progression over timecompute_fitness_summary()— Complete fitness summarycompute_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 trendcompute_peak_fitness()— Peak CTL identificationdetect_overtraining_risk()— Overtraining risk detectioncompute_training_zones_distribution()— Training zones distributioncompute_periodization_score()— Periodization quality score
Workload metrics (endurance_metrics.workload)
calculate_acwr()— Acute:Chronic Workload Ratiocalculate_monotony_strain()— Training monotony and strain
Decoupling analysis (endurance_metrics.decoupling)
calculate_decoupling()— Effort:Cardio decoupling percentageanalyze_overtime()— Detailed overtime analysis with pacing assessmentcompute_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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73e67e46cf9fbefab1789445a9877aad11fde6893a7247d18c9623b7d0b34f83
|
|
| MD5 |
aeac9f1485dee9e44c1c9c2f4bc1c5d7
|
|
| BLAKE2b-256 |
8d7d5041260ce287725a25aa1482397cf4e97ffbb705b1ec3ee642e9ac99dee1
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
663f7556e4ef386a4c79433feb22076f58b0802406090a7ec9b5e6569a9c6b43
|
|
| MD5 |
b47195834af173c4193d3ccbf74712ca
|
|
| BLAKE2b-256 |
d3dbdabf15504a58d6556ac8e42eb6a110f3dfdfd4422dd131b7a442fb7bef92
|