crossbridge
crossbridge is a Python library for simulating cardiac myofilament activation and crossbridge dynamics.
The Mathematical Models
crossbridge implements several reduced-order models of cardiac myofilament activation
(RDQ18, RDQ20-MF, Land2017,
Lewalle2024, Tewari2016,
Marzban2020, Musgrave2025, Rice2008, Tran2010), all sharing a common interface so that a coupled electromechanics simulation can swap between them with minimal code
changes. See docs/models for a description and reference for each model.
Installation
You can install the base package and its dependencies using pip.
To install the library you can use pip:
python3 -m pip install crossbridge
To install with optional dependencies (for running demos, tests, or building docs):
python3 -m pip install "crossbridge[demos]" # Installs scipy, matplotlib, gotranx, numba, zero-mech, etc.
python3 -m pip install "crossbridge[test]" # Installs pytest and coverage tools
python3 -m pip install "crossbridge[docs]" # Installs jupyter-book and sphinx plugins
python3 -m pip install "crossbridge[all]" # Installs everything
AI agent skill
crossbridge ships an agent skill that helps you choose and run a contraction model: it checks your environment, asks what you need the tension for (tissue, calcium source, length, scale), proposes a model and a coupling scheme, and builds and checks the simulation.
- Claude Code:
/plugin marketplace add ComputationalPhysiology/crossbridgethen/plugin install crossbridge@crossbridge - Other agents (Codex, Gemini CLI, GitHub Copilot, Cursor, OpenCode, ...):
npx skills add ComputationalPhysiology/crossbridge --skill crossbridge-models - Manually: copy
plugins/crossbridge/skills/crossbridge-modelsinto your agent's skills directory (e.g.~/.claude/skills/).
See the section "Using crossbridge with an AI agent" below.
Documentation
Documentation is available at https://computationalphysiology.github.io/crossbridge. It includes a user guide, API reference, and model background/references.
Basic Usage
Every model takes the intracellular calcium concentration [µM] and the sarcomere length [µm], and
returns the active tension [kPa]. One instance holds num_cells independent cells (for example the
integration points of a mesh), vectorized with NumPy. An isometric twitch with Land2017:
import numpy as np
import matplotlib.pyplot as plt
from crossbridge import Land2017, calcium_trace
dt = 1e-3 # [s]
t = np.arange(0, 1, dt)
Ca = calcium_trace(t) # a synthetic calcium transient [µM]
model = Land2017(num_cells=1)
Ta = np.zeros_like(t)
for i, Cai in enumerate(Ca):
model.advance_step(dt, Cai, 2.2) # dt [s], calcium [µM], sarcomere length [µm]
Ta[i] = model.get_active_tension()[0] # [kPa], one value per cell
fig, ax = plt.subplots(2, 1, sharex=True)
ax[0].plot(t, Ca)
ax[0].set_ylabel("Calcium [µM]")
ax[1].plot(t, Ta)
ax[1].set_ylabel("Active tension [kPa]")
ax[1].set_xlabel("Time [s]")
plt.show()
The tension peaks at 4.8 kPa. Land2017's defaults are its calibration to skinned cells; for an
intact cell's calcium transient use Land2017.whole_organ_parameters() or
Land2017.torord_land_parameters() (Land2017(num_cells=1, params=...)). Any other model is used
the same way, by class or by name (crossbridge.get_model("Rice2008")); a params key that is not
in the model's default_parameters() raises ValueError.
Coupling to Electrophysiology and Mechanics
In a coupled simulation the calcium comes from a cell model and the sarcomere length from a
mechanics solver, both as a scalar or as one value per cell, and advance_step is called once per
time step of the larger loop (it sub-steps internally, so 1 ms is fine):
model = Land2017(num_cells=num_cells, params=Land2017.torord_land_parameters())
for t in time_steps:
Cai = 1000.0 * compute_calcium(t) # a cell model's calcium, mM -> µM
model.advance_step(dt, Cai, SL_ref * stretch) # dt in s, not ms
Ta = model.get_active_tension()
Ka = model.get_active_stiffness()
stretch = solve_mechanics(Ta, Ka)
Cell models (for example from gotranx or
odezoo) usually work in ms and mM; convert at
the boundary. Pass the active stiffness Ka to the mechanics solve as well: a segregated scheme
that holds the tension fixed oscillates, and more so at smaller time steps. For two-way calcium
coupling, get_calcium_binding_rate() gives the troponin flux to hand back to the cell model. See
the documentation for both.
Examples & Demos
The demo/ folder contains several scripts demonstrating how to couple the crossbridge model to different physics scales. See demos for a description of each demo and how to run them.
Testing and Development
We use pytest for unit testing. To run the test suite and check code coverage:
pytest
To run the pre-commit linters (Ruff and MyPy):
pre-commit run --all-files
Using crossbridge with an AI agent
The crossbridge-models skill (installed as above) turns a coding agent into a guide for
contraction models. It
- checks that crossbridge is installed (by its models, not its version string), and what else the plan needs (numba, gotranx and a cell model, zero-mech, dolfinx with fenicsx-pulse or simcardemsx);
- asks you, one question at a time, about your goal, the tissue, where the calcium and the sarcomere length come from, and how many cells;
- proposes alternatives with measured trade-offs (which of the nine models, at what cost; which
parameter set; segregated coupling with the active stiffness or a monolithic one; one- or
two-way calcium coupling; the class or code generated from its
.odefile) and recommends one; - writes the simulation as a script, checks the tension, its convergence in
dtand its physics, and hands over the numbers with the units at every boundary; - knows the common pitfalls (calcium in mM, skinned-cell default parameters,
Ta_maxignored by most models, misspelled parameters ignored, segregated coupling withoutKa, troponin buffered twice); - never installs anything without asking.
Describe what you want, for example
Run an isometric twitch with the Land model driven by a ToR-ORd calcium transient
and the agent loads the skill on its own; or invoke it explicitly (/crossbridge:crossbridge-models
in Claude Code, /crossbridge-models if you copied the folder). Update it with
/plugin marketplace update crossbridge or npx skills update.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for crossbridge 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| crossbridge-0.7.0.tar.gz | 171.7 kB | With provenance | Details for crossbridge-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| crossbridge-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for crossbridge-0.7.0-py3-none-any.whl |
Total release size: 289.5 kB
Release files / crossbridge-0.7.0.tar.gz
| Download URL | crossbridge-0.7.0.tar.gz |
|---|---|
| Size | 171.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed18caf9379185be56616063fa97100677a431095169e8409faa196c630ec8a7
|
|
BLAKE2b-256 checksum How to use checksums |
7298b7a0eb914ca63dc3fe5b16292ad6b939eab9947d3583054040f31ccfb1ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / crossbridge-0.7.0-py3-none-any.whl
| Download URL | crossbridge-0.7.0-py3-none-any.whl |
|---|---|
| Size | 117.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5adf03a241223a8925ad75dff86950e9f3f58c778e50a0f77794a40829c7fa51
|
|
BLAKE2b-256 checksum How to use checksums |
d21e4a692f9a5376644613b5b73dbefe7ba476ddbd44fbd6de8d75d4036f2db6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for crossbridge 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for crossbridge-0.7.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.