Skip to main content

Overview

Tests

This project allows the generation and calibration of cellml (and soon to be more) circulatory system models from an array of module/vessel names and connections.

The repository is circulatory_autogen; the package it installs is libcuflynx. They are the same project under two names: papers, issues and this repository say circulatory_autogen, while PyPI, pip install and every import say libcuflynx. Searching for either name should find you this page.

Note: Test results and pass percentage are displayed in the GitHub Actions workflow summary. The badge above shows the overall test status (passing/failing) for master of this repository, which is where pull requests are merged.

Installing, and what each extra costs

The package is libcuflynx. A plain install gives you generation, simulation, calibration, sensitivity analysis and the built-in (emcee) MCMC:

pip install libcuflynx

Everything beyond that is an extra, because the optional parts are not small. These are installed sizes on disk, not wheel sizes — measured by installing into a fresh venv on Linux and taking du of site-packages, so they include the shared libraries that show up as companion directories (scipy.libs, numpy.libs) and every transitive dependency:

install on disk what it buys
libcuflynx ≈ 540 MB generation, simulation, calibration, Sobol SA, emcee MCMC, Laplace identifiability
libcuflynx[mpi] +5 MB, and a system MPI toolchain multi-rank runs under mpiexec
libcuflynx[casadi] +221 MB model_type: casadi_python, solver: casadi_integrator, symbolic AD gradients
libcuflynx[libopencor] +37 MB, Python 3.12 or later solver: CVODE_libopencor (libOpenCOR)
libcuflynx[uq] +65 MB the pyMC sampler (UQ_options: library: pymc)
libcuflynx[emulation] +750 MB or more training and using surrogate models (do_emulation / use_emulator)
libcuflynx[cpp] +0 MB model_type: cpp — needs a C++ toolchain, and SUNDIALS for solver: CVODE, which pip cannot install
libcuflynx[all] ≈ 1.6 GB all of the above

[emulation] is the one to think about before typing: autoemulate pulls in torch, which is 734 MB on its own — more than the whole default install — and requires Python >=3.10,<3.13. On Linux, pip's default torch wheel also drags in the bundled NVIDIA CUDA libraries, which can take it past 2 GB; install a CPU-only torch first if you do not want them. Because [all] includes [emulation], [all] inherits that Python range too.

The per-package numbers below do not add up to the total: the long tail of small transitive dependencies (packaging, dateutil, six, typing-extensions, cycler, joblib, threadpoolctl, ...) accounts for the rest.

What makes up the default install: scipy 109 (+27 in scipy.libs), pandas 65, statsmodels 49, scikit-learn 46, numpy 41 (+27 in numpy.libs), matplotlib 28 with fontTools 25 / pillow 21, myokit 13, lxml 12, libcellml 8, kiwisolver 7, nevergrad 5, SALib 5, rdflib 5, libcuflynx itself 4, pint 3, seaborn 3, and emcee / corner / tqdm / numdifftools at about 1 MB each.

The two that are larger than they look are statsmodels (49 MB) and scikit-learn (46 MB). Neither is optional today: statsmodels supplies the Geweke diagnostic run after every emcee MCMC chain, and scikit-learn fits the quadratic used by the Laplace identifiability analysis. Both are on paths a plain install is expected to reach.

[mpi] is an extra, and that is the deliberate part. mpi4py itself is only 5 MB, but it compiles against a system MPI toolchain (libopenmpi-dev, mpich) at install time, and that is the commonest pip install failure on macOS and Windows. A serial calibration needs none of it: libcuflynx.utilities.mpi_utils answers rank/size and supplies the one-rank collectives without ever importing mpi4py. Install the toolchain first, then the extra:

sudo apt install libopenmpi-dev          # or: brew install open-mpi
pip install "libcuflynx[mpi]"

Ask for a model type, solver or analysis whose extra is missing and the error names the extra to install rather than reporting a bare missing module.

Developing on a checkout instead: pip install -e ".[dev]", which adds the test and lint tooling plus mpi4py (tests/conftest.py imports it at module scope, so the suite will not even collect without it) and casadi (whose tests otherwise importorskip themselves into silence).

Quickstart

pip install libcuflynx

No import path setup and no checkout are required — the package is importable, and its commands runnable, from any directory:

from libcuflynx.utilities.utility_funcs import get_default_inp_data_dict
from libcuflynx.scripts.script_generate_with_new_architecture import generate_with_new_architecture
from libcuflynx.solver_wrappers import get_simulation_helper_from_inp_data_dict
from libcuflynx.param_id.paramID import CVS0DParamID

inp = get_default_inp_data_dict(file_prefix, input_param_file, resources_dir)
generate_with_new_architecture(inp_data_dict=inp)     # module array + parameters -> CellML
sim = get_simulation_helper_from_inp_data_dict(inp)   # simulate it
sim.run()
pid = CVS0DParamID.init_from_dict(inp)                # calibrate it

Each pipeline stage also has a console command, all configured from user_run_files/user_inputs.yaml and all taking --help:

Command Stage
cuflynx-generate generate a model from its module array and parameters file
cuflynx-param-id generate + calibrate (mpiexec -n N for parallel)
cuflynx-sensitivity Sobol sensitivity analysis
cuflynx-identifiability Laplace / profile-likelihood identifiability
cuflynx-train-emulator train a surrogate of the obs features
cuflynx-plot plot calibration results
cuflynx-generate-pipeline write a self-contained, movable bundle that reruns the study
cuflynx-couple run a generated C++ model coupled to its external Python models (e.g. FEniCS); --check lists what is exchanged
cuflynx-run-predictions run an obs_data's prediction items on a model with no calibration: traces, features and validation (run_prediction_items)
cuflynx-calibration-workflow run a calibration_workflow.json: ordered calibrations of module-library parameterisations merged into a supermodule (takes the workflow path)
cuflynx-variable-mapping write a model's <prefix>_variable_mapping.csv: the LaTeX symbol of every variable (takes the model or a workflow)
cuflynx-derive evaluate a <name>_derivations.json (parameters calculated from experimental data by a CellML model or a Python function) and check, or with --write update, the values cached in its parameters file
cuflynx-methods-latex write a methods section in LaTeX: equations per module, a flow chart of the calibration, and the methods of each step
cuflynx-provenance write a calibration workflow's provenance from its output directory: provenance_graph.json and an SVG diagram showing what set each value
cuflynx-init write a starter study into a directory: user_run_files/user_inputs.yaml and the 3compartment model's resources (takes a directory and --force, not the yaml)
cuflynx-upgrade convert, once, files in an older form that the readers refuse: module-config, module-array, obs-data, parameter-names, parameters (a parameters CSV to nested JSON), junctions (a model off the module library's removed junction module types); and supermodule-instances, which writes a new supermodule instance's values into a model's parameters file (not a pipeline stage)

CUFLYNX_USER_DIR — where an installed libcuflynx reads and writes

Every stage needs a directory holding user_run_files/user_inputs.yaml, and (unless the config overrides them) resources/, module_config_user/, funcs_user/, generated_models/ and param_id_output/. It is $CUFLYNX_USER_DIR if set; otherwise the circulatory_autogen checkout being run from, if this is one — so a clone or a pip install -e . needs no configuration; otherwise the current working directory.

After a plain pip install libcuflynx there is no checkout, so either run from your working directory or point the variable at it:

export CUFLYNX_USER_DIR=/path/to/my_study
cuflynx-param-id

Nothing is ever written inside the installed package.

Import from the libcuflynx. namespace. The flat names (from param_id.paramID import CVS0DParamID) were deprecated in 0.4.0 and removed in 0.6.0 — they now raise ModuleNotFoundError. Prefix the import with libcuflynx.. See CHANGELOG.md for the migration, including the one for anyone who edited funcs_user/*_funcs_user.py in place.

Tutorial

Follow the instructions in the tutorial to run the project: https://physiomelinks.github.io/circulatory_autogen/

AI-generated interactive tutorial

BETA MODE: This AI-generated tutorial can be used to further understand the code base: https://deepwiki.com/FinbarArgus/circulatory_autogen/1-overview

The CVODE_libopencor solver (optional)

CVODE_libopencor runs CellML models with libOpenCOR, OpenCOR's simulation engine as a Python library. Install it with pip install "libcuflynx[libopencor]"; its wheels need Python 3.12 or later. Without it, asking for the solver raises an error that says how to install it and names CVODE_myokit, the default, which needs nothing extra. See Optional: the libOpenCOR solver for what it supports. The solver name CVODE_opencor is an alias for CVODE_libopencor.

Its tests are marked need_libopencor and skip when libOpenCOR is not installed. benchmarks/solver_comparison.py runs the same models through Myokit, libOpenCOR and CasADi, whichever are installed (see benchmarks/README.md).

Releasing

Releases are cut from a v* tag and published to PyPI by .github/workflows/release.yml using trusted publishing (OIDC) — no API token is stored anywhere. The procedure, the release-notes checklist, and the rules that cannot be undone (the tag must match version in pyproject.toml; a PyPI version can never be re-uploaded) are in CONTRIBUTING.md.

Citing this work

Cite the project as circulatory_autogen — that is the name used by the publications, the repository and any archived DOI. The PyPI distribution libcuflynx is the same software under its packaging name, so a paper citing circulatory_autogen and an environment listing libcuflynx==0.8.0 refer to one artifact, not two. When it helps reproducibility, record both: the citation for the project and the exact package version installed, e.g. "circulatory_autogen (PyPI package libcuflynx, version 0.8.0)".

License

circulatory_autogen is fully open source and distributed under the very permissive Apache License 2.0. See LICENSE for more information.

Optional third-party backends (not part of circulatory_autogen)

circulatory_autogen is complete and fully open source on its own. Every feature works without installing any proprietary software.

Separately, the project ships optional adapters that let users who already hold a licence for certain third-party products plug them in. Those products are not part of circulatory_autogen, are not bundled or installed with it, are not covered by the Apache-2.0 licence above, and are not required by any feature.

Metadata

Release files for libcuflynx 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libcuflynx 0.8.0
File Size Uploaded Provenance Actions
libcuflynx-0.8.0.tar.gz 2.2 MB With provenance Details for libcuflynx-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for libcuflynx 0.8.0
File Interpreter ABI Platform Actions
libcuflynx-0.8.0-py3-none-any.whl Python 3 none any Details for libcuflynx-0.8.0-py3-none-any.whl

Total release size: 3.7 MB

Release files / libcuflynx-0.8.0.tar.gz

Download URL libcuflynx-0.8.0.tar.gz
Size 2.2 MB
Tags Source
SHA-256 checksum
How to use checksums
2165fbdb3600eac77d7aafebdcaa107c76191b94a3529e1043e80bed0b77d22d
BLAKE2b-256 checksum
How to use checksums
87336540b785973285a6258247f414254e3a98cbae77ae2ce85d1bfb0937619f
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 27, 2026.

Transparency log

Release files / libcuflynx-0.8.0-py3-none-any.whl

Download URL libcuflynx-0.8.0-py3-none-any.whl
Size 1.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
84c84d8ddc9ce0fc2d27c4773a5a7770afbd7c14741d052e9906ac6fe1b00bc2
BLAKE2b-256 checksum
How to use checksums
3b0af105fc3a83a9795d55c648e62cbdc38a92ea7409b52564ddcb49facf86f1
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 27, 2026.

Transparency log

Security for libcuflynx 0.8.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.

Select from 2 files

Attestation for libcuflynx-0.8.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 27, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page