Skip to main content

A Python toolbox for biomechanical movement simulation and optimal control

Project description

biosym

Tests Lint Docs Python 3.11+ Code style: black

Installation:

For a standard install from PyPI:

  1. Install IPOPT and ensure cyipopt can build or link against it: https://cyipopt.readthedocs.io/en/stable/install.html
  2. Install biosym:
pip install biosym

If you want the iteration dashboard features, install the dashboard extra:

pip install "biosym[dashboard]"

For local development in this repository, use:

uv sync --group dev

Usage

biosym is a Python toolbox for building biomechanical models, exploring their structure and dynamics, and solving movement optimization problems. The examples cover three core workflows: loading and inspecting models for forward computations, setting up predictive gait optimal control problems from configuration files, and batching model evaluations with JAX for high-throughput or learning-based applications.

Load and inspect a model:

from biosym.model.model import load_model

# Load a simple pendulum model and rebuild the cached functions from source.
model = load_model("tests/models/pendulum.xml", force_rebuild=True)

# Inspect the generalized coordinates, speeds, and overall problem size.
print(model.coordinates["names"])
print(model.speeds["names"])
print(model.n_states, model.n_constants)

Set up and solve an optimal control problem from a YAML file:

from biosym.ocp import collocation

# Read model, objectives, constraints, and solver settings from YAML.
ocp = collocation.Collocation("examples/standing2d.yaml")
# Solve the optimal control problem and open the default visualization.
solution = ocp.solve(visualize=True)

Batch model evaluations with JAX:

import jax

from biosym.model.model import load_model
from biosym.utils import states

# Load a gait model with contact and actuator dynamics.
model = load_model("tests/models/gait2d_torque/gait2d_torque.yaml")
# Replicate the default input state into a batch for vectorized evaluation.
batched_inputs = states.stack_dataclasses([model.default_inputs] * 128)

# Vectorize the model constraint function across the batch dimension.
dynamics_fn = jax.vmap(model.run["confun"], in_axes=(0, None))
batched_output = dynamics_fn(batched_inputs.states, batched_inputs.constants)

# The result contains one dynamics evaluation per batch element.
print(batched_output.shape)

Near-term roadmap

We are actively developing biosym and welcome contributions from the community. Currently, we work on making it easier to install and use, which also means that some structural changes should be expected. Contact us if you want to contribute or have suggestions for improvements.

Additionally, here is what to expect from biosym in the near future:

  1. Deep learning integration.
  2. Differentiability with respect to musculoskeletal model parameters.
  3. 3D-ready optimal control simulations.
  4. Continued documentation improvements.

Follow our group's LinkedIn page for updates on new features and releases.

Citation

If you use biosym in academic work, please cite it as software:

@software{biosym_2026,
  title = {biosym: A Python toolbox for biomechanical movement simulation and optimal control},
  author = {Markus Gambietz and Theodoros Balougias and Yipeng Zhang and Anne Koelewijn},
  year = {2026},
  version = {0.1.0},
  url = {https://github.com/biomac-group/biosym}
}

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

biosym-0.1.5.tar.gz (104.4 kB view details)

Uploaded Source

Built Distribution

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

biosym-0.1.5-py3-none-any.whl (123.2 kB view details)

Uploaded Python 3

File details

Details for the file biosym-0.1.5.tar.gz.

File metadata

  • Download URL: biosym-0.1.5.tar.gz
  • Upload date:
  • Size: 104.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for biosym-0.1.5.tar.gz
Algorithm Hash digest
SHA256 e26509f2ffe4bd42e72b0076da527a27da081b0c8b7891af4354f7930a98ef89
MD5 0bf21271105620d80b25c6c36efd4c14
BLAKE2b-256 a005e8dd699620f1c1cea82a477c5c0d5671fe5e60026869acc97c4b2a51df85

See more details on using hashes here.

Provenance

The following attestation bundles were made for biosym-0.1.5.tar.gz:

Publisher: publish.yml on biomac-group/biosym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biosym-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: biosym-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 123.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for biosym-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 eb40ba9c5d2015246254db1822101b236a85cf11fc0cf3e2f44269fee951726a
MD5 6a73e8ae490c353fb6c5acac62f0956e
BLAKE2b-256 a94e6fb8b3cabbb01b32f0b99058d81e8daa46c29ce0c473bcbf9ef51d95ef3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for biosym-0.1.5-py3-none-any.whl:

Publisher: publish.yml on biomac-group/biosym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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