A Python toolbox for biomechanical movement simulation and optimal control
Project description
biosym
Installation:
For a standard install from PyPI:
- Install IPOPT and ensure
cyipoptcan build or link against it: https://cyipopt.readthedocs.io/en/stable/install.html - 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:
- Deep learning integration.
- Differentiability with respect to musculoskeletal model parameters.
- 3D-ready optimal control simulations.
- 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
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 biosym-0.1.2.tar.gz.
File metadata
- Download URL: biosym-0.1.2.tar.gz
- Upload date:
- Size: 103.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09178a858d78ffbeca9d8aae1890f3f6d2ef12ef82569becd6b0d46842118bcf
|
|
| MD5 |
ab7ed241112f42517b440e5e7f92422b
|
|
| BLAKE2b-256 |
4e1838f22a4d435ba9d38acb7b1cf27a532c1150823ee13eaac6d1d032d38f37
|
Provenance
The following attestation bundles were made for biosym-0.1.2.tar.gz:
Publisher:
publish.yml on biomac-group/biosym
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
biosym-0.1.2.tar.gz -
Subject digest:
09178a858d78ffbeca9d8aae1890f3f6d2ef12ef82569becd6b0d46842118bcf - Sigstore transparency entry: 1284308620
- Sigstore integration time:
-
Permalink:
biomac-group/biosym@f9b08ca3b1d1bdcb78ade6dea57efb33f7e14b07 -
Branch / Tag:
refs/tags/v0.1.2a - Owner: https://github.com/biomac-group
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f9b08ca3b1d1bdcb78ade6dea57efb33f7e14b07 -
Trigger Event:
release
-
Statement type:
File details
Details for the file biosym-0.1.2-py3-none-any.whl.
File metadata
- Download URL: biosym-0.1.2-py3-none-any.whl
- Upload date:
- Size: 122.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
443e9c055e168eff8c073fea7749d63acf4cd1ded8edbe27702a854aecf32c81
|
|
| MD5 |
b456809889b8027b1751e96d268fd5e0
|
|
| BLAKE2b-256 |
45953666544ee51a093e7f8a6addbc8ff38602b206b3b4a27192bcf9bdfe8dfb
|
Provenance
The following attestation bundles were made for biosym-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on biomac-group/biosym
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
biosym-0.1.2-py3-none-any.whl -
Subject digest:
443e9c055e168eff8c073fea7749d63acf4cd1ded8edbe27702a854aecf32c81 - Sigstore transparency entry: 1284308714
- Sigstore integration time:
-
Permalink:
biomac-group/biosym@f9b08ca3b1d1bdcb78ade6dea57efb33f7e14b07 -
Branch / Tag:
refs/tags/v0.1.2a - Owner: https://github.com/biomac-group
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f9b08ca3b1d1bdcb78ade6dea57efb33f7e14b07 -
Trigger Event:
release
-
Statement type: