Skip to main content

Babon kinematics-as-a-service client. Video in, movement data out.

Project description

babon

Kinematics-as-a-service client. Video in, movement data out.

pip install babon
from babon import Babon

client = Babon()                                              # picks up BABON_API_KEY
analysis = client.analyses.create(video="trial.mp4", wait=True)
print(analysis.metrics["gait_speed_m_s"])                     # 1.32
print(analysis.angles)                                        # DataFrame

That's it. Three lines.

A bit more

# Fire and forget, retrieve later
analysis = client.analyses.create(video="trial.mp4")
# ... save analysis.id somewhere, exit, come back ...
analysis = client.analyses.retrieve("YOUR_ANALYSIS_ID")
print(analysis.status)                                        # queued|processing|completed|failed|canceled

# Cohort
batch = client.batches.create(requests=[
    {"video": "a.mp4"},
    {"video": "b.mp4", "label": "cohort-3"},
    {"video": "c.mp4", "model": "gemx"},
])
for analysis in batch.results(as_completed=True):             # yields as each finishes
    save(analysis.angles)

# Lazy projections (each is one cheap HTTP GET, cached per instance)
analysis.angles                       # DataFrame, all joints
analysis.angles(joint="knee_R")       # filtered
analysis.grf                          # GRF waveform, None for non-walking clips
analysis.events                       # heel-strike / toe-off
analysis.metrics                      # cadence, gait_speed, symmetry_index, ...
analysis.quality                      # tier + z-scores
analysis.skeleton                     # 3D viewer payload
analysis.download("out.zip", include=["angles", "grf"])

# Big files? The SDK auto-switches to presigned PUT above 100 MB.
client.analyses.create(video="4gb_video.mp4")                 # transparent

CLI

babon login                                                   # interactive: paste key
babon analyses create trial.mp4 --wait
babon analyses get YOUR_ANALYSIS_ID
babon analyses list --status completed --limit 20
babon batches create ./study/ --label baseline
babon usage                                                   # seconds used this month

Errors

The client raises typed exceptions:

  • BabonAuthError — bad key, wrong environment, DPA not accepted.
  • BabonQuotaExceeded — monthly limit, concurrent limit, or rate-limited.
  • BabonInvalidVideo — file is not a recognised container.
  • BabonInvalidLabel — label looks like a real name (ADR-0002).
  • BabonRunFailed — pipeline failed.
  • BabonTimeoutwait() exceeded its timeout.

All carry .code (the API error code) and .request_id (the support handle).

The HTTP transport retries 429 (honoring Retry-After), 5xx, and network errors with exponential backoff. POST requests are only retried when sent with Idempotency-Key (the SDK auto-generates one per file). 4xx errors raise immediately.

What we are and are not

  • Measurement only. Output is kinematics; clinical interpretation is yours.
  • EU-cloud (Scaleway fr-par). Videos never leave the EU.
  • Don't put real patient names in label or in your filenames. We reject name-shaped labels server-side.

Configure

client = Babon(
    key="YOUR_KEY",                       # optional, else BABON_API_KEY env
    base_url="https://api.babon.eu",      # optional, override for staging
    timeout_s=600,                        # optional, per-request timeout
    max_retries=5,                        # optional, set 0 to disable retries
)

v0.x → v1.0 migration

The v0.x surface (bb.submit, bb.runs.list, Run.data, Run.angles("knee")) is preserved as a thin shim — your existing code keeps working — but new code should target the v1 resource verbs (client.analyses.create, client.analyses.list, Analysis.metrics, Analysis.angles(joint="knee_R")). The v0.x shims will be removed in v2.0.

Contact

daan@babon.eu — onboarding, quota, bugs.

Docs: https://app.babon.eu/developers/docs

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

babon-1.2.0.tar.gz (53.2 kB view details)

Uploaded Source

Built Distribution

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

babon-1.2.0-py3-none-any.whl (61.1 kB view details)

Uploaded Python 3

File details

Details for the file babon-1.2.0.tar.gz.

File metadata

  • Download URL: babon-1.2.0.tar.gz
  • Upload date:
  • Size: 53.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for babon-1.2.0.tar.gz
Algorithm Hash digest
SHA256 8ec799b62e8584294eaa391ed65b6807bab01fb745e834146a46aa687a02efc9
MD5 a79ee4d66df5b9a58c9e898f063cdc50
BLAKE2b-256 f1d2232ef3d4cb8fcbce5fdd4d0c06a96b1b3884c30e9cabc8d26ea556ffb493

See more details on using hashes here.

File details

Details for the file babon-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: babon-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 61.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for babon-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5240463efd867b6c0e7f6b1e3bd7bf430e5768b97e084238cf401ad93c18e1f
MD5 6f0abacf1a077b02604847dd4700b0e0
BLAKE2b-256 d2bfc2f26183ad6f9aec2c4890a163f711b9f973a626eb0b42e35159f1473d02

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