Skip to main content

Silhouette is the Python library for intensity duration modelling in endurance sports.

Project description

Silhouette

A Python library for fitting power-duration curves to cycling data. Scikit-learn compatible.

Models

Model Parameters
TwoParameterRegressor CP, W'
ThreeParameterRegressor CP, W', P_max
OmniDurationRegressor CP, W', P_max, a, tcp_max

Installation

uv add silhouette

Or with pip:

pip install silhouette

Quick start

import numpy as np
from silhouette import OmniDurationRegressor

durations = np.array([5, 10, 30, 60, 120, 300, 600, 1200, 1800, 3600])
power = np.array([1050, 850, 600, 480, 400, 340, 310, 290, 275, 255])

reg = OmniDurationRegressor()
reg.fit(durations.reshape(-1, 1), power)

reg.cp_       # critical power (W)
reg.p_max_    # peak power (W)
reg.w_prime_  # anaerobic work capacity (J)

reg.predict(np.array([[300]]))  # predicted power at 5 minutes

All three models share the same interface. Swap OmniDurationRegressor for TwoParameterRegressor or ThreeParameterRegressor and the code works the same way.

Known parameters

When parameters are already known, use curve directly without fitting:

from silhouette import TwoParameterRegressor

t = np.arange(1, 3601)
power = TwoParameterRegressor.curve(t, cp=250, w_prime=20_000)

Custom bounds

reg = OmniDurationRegressor(
    bounds={"cp": (200, 400), "p_max": (800, 1500)},
    initial_params={"cp": 280},
)

Time to exhaustion

power, tte = reg.predict_inverse()
# power: array of watt values
# tte: corresponding time to exhaustion in seconds

References

  • Monod, H., & Scherrer, J. (1965). The work capacity of a synergic muscular group. Ergonomics, 8(3), 329-338.
  • Morton, R. H. (1996). A 3-parameter critical power model. Ergonomics, 39(4), 611-619.
  • Puchowicz, M. J., Baker, J., & Clarke, D. C. (2020). Development and field validation of an omni-domain power-duration model. Journal of Sports Sciences, 38(7), 801-813.

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

silhouette-0.2.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

silhouette-0.2.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file silhouette-0.2.0.tar.gz.

File metadata

  • Download URL: silhouette-0.2.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.10

File hashes

Hashes for silhouette-0.2.0.tar.gz
Algorithm Hash digest
SHA256 040ce5649b4bd17cf12fba4ed0a91628c148ad5841cd30df1b6a3ece844a0a16
MD5 fde5de7f286db13d8422760978e32605
BLAKE2b-256 6b70ec02895a3fe77927a167c463fbbe5b18acff845518f4f741655946481eb8

See more details on using hashes here.

File details

Details for the file silhouette-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: silhouette-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.10

File hashes

Hashes for silhouette-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c01ac091464f3ff10384187883089ed42f1d2b4eb05df2d053709971090c865
MD5 bec5735692de64f2576e23d5f7ae62a5
BLAKE2b-256 36fa885dc9280e013fd58642835c22d69f46e4a57036492647e3a78dc5fc321d

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