PYPI PACKAGE AUDIT v0.5.1 Healthy Package

tvboptim

Optimization tools for The Virtual Brain

PyPkgScore tvboptim
Methodology & Criteria ♥ Donate
670 / 1000
Quick Install
pip install tvboptim
1. Governance
50/200
2. PEP Metadata
200/200
3. Security
150/200
4. Docs & SEO
105/200
5. CI Engineering
165/200
📣 Share Audit: Share this report and visual preview in the current language
Advertisement
PYPI TELEMETRY

Downloads & Community Adoption

Last 30 days (without mirrors)
Last 7 days
382
Last 30 days
618
Total (180 days)
8765
Metric / Ecosystem Status / Value Source
Downloads (30d / 180d) — PyPI Stats (without mirrors)
Trusted Publishing (PEP 740) ✕ Not detected PyPI Integrity / Sigstore
Django Packages — djangopackages.org
PyTech / PyPkgScore 670 / 1000 PyPkgScore Engine

Health & Engineering Analysis (5 Pillars)

1. Governance & Community50 / 200 ▾
LICENSE✓ 50 pts
SECURITY.md✕ 0 pts
CONTRIBUTING.md✕ 0 pts
CODE_OF_CONDUCT.md✕ 0 pts
2. PEP Metadata & Packaging200 / 200 ▾
Wheel (.whl)✓ 50 pts
pyproject.toml✓ 50 pts
Project URLs✓ 50 pts
Trove Classifiers✓ 50 pts
3. Security & Supply Chain150 / 200 ▾
Zero CVEs (OSV)✓ 60 pts
Trusted Publishing (OIDC)✕ 0 pts
Snyk / Audit Link✓ 40 pts
HTTPS Repository✓ 50 pts
4. Documentation, SEO & Ecosystem105 / 200 ▾
Structured README✓ 60 pts
Read the Docs✕ 0 pts
Django Packages✕ 0 pts
Website / Technical Articles✓ 45 pts
5. Engineering, CI & Quality165 / 200 ▾
Automated Tests✓ 65 pts
GitHub Actions CI✓ 65 pts
CHANGELOG.md✓ 35 pts
Env & Lockfile (uv/rye/poetry/pdm/hatch)✕ 0 pts
Advertisement
README & DOCS

Official Documentation & Usage Guide — tvboptim

PyPI Metadata v0.5.1
Show full original documentation (English README) ▾

TVB-Optim

Tests Python 3.11+ PyPI version Documentation

Fast, differentiable, and parallel whole-brain simulation and inference in JAX.

Use the same brain network model code on CPUs and GPUs. Evaluate parameter ensembles in parallel and choose the inference strategy that fits your problem, from end-to-end automatic differentiation to simulation-based and evolutionary methods.

Why TVB-Optim?

  • Accelerated simulation: JIT-compile brain network models and run them on CPUs and GPUs.
  • Parallel inference: Batch parameter sets, stochastic realizations, and candidate populations with vmap, then distribute them across devices with pmap.
  • End-to-end automatic differentiation: Differentiate through dynamics, coupling, transmission delays, observation models, and summary statistics.
  • Inference-method agnostic: Use the same simulator for gradient descent, Bayesian and simulation-based inference, genetic algorithms, parameter sweeps, and ensemble analysis.
  • Composable whole-brain models: Combine neural dynamics, connectivity, delays, coupling, noise, external inputs, solvers, and observation models with Network Dynamics.
  • Structured parameter exploration: Mark trainable values with Parameter and express Cartesian, zipped, grouped, or sampled parameter spaces with Axes and Spaces. Existing TVB workflows are supported through TVB-O.

Installation

Requires Python 3.11 or above

# Using uv (recommended)
uv pip install tvboptim

# Using pip
pip install tvboptim

Quick Example

Fit the coupling strength of an 84-region whole-brain model to empirical fMRI functional connectivity:

import jax
import jax.numpy as jnp
import optax

from tvboptim.data import load_functional_connectivity, load_structural_connectivity
from tvboptim.experimental.network_dynamics import Network, prepare, solve
from tvboptim.experimental.network_dynamics.coupling import DelayedLinearCoupling
from tvboptim.experimental.network_dynamics.dynamics.tvb import ReducedWongWang
from tvboptim.experimental.network_dynamics.graph import DenseDelayGraph
from tvboptim.experimental.network_dynamics.noise import AdditiveNoise
from tvboptim.experimental.network_dynamics.solvers import BoundedSolver, Heun
from tvboptim.observations import compute_fc, rmse
from tvboptim.observations.tvb_monitors import Bold
from tvboptim.optim import OptaxOptimizer
from tvboptim.types import Parameter
# Bundled structural and functional connectivity for 84 brain regions.
weights, lengths, labels = load_structural_connectivity("dk_average")
weights = weights / jnp.max(weights)
target_fc = load_functional_connectivity("dk_average")

# Build a delayed whole-brain network from the structural connectome.
network = Network(
    dynamics=ReducedWongWang(),
    coupling={"delayed": DelayedLinearCoupling(source="S", G=0.5)},
    graph=DenseDelayGraph(
        weights=weights,
        delays=lengths / 3.0,
        region_labels=labels,
    ),
    noise=AdditiveNoise(sigma=0.01, key=jax.random.key(42)),
)

# Simulate once to initialize the delay history.
solver = BoundedSolver(Heun(), low=0.0, high=1.0)
result = solve(network, solver, t0=0.0, t1=60_000.0, dt=1.0)
network.update_history(result)

# Prepare a differentiable simulator and convert neural activity to BOLD.
simulator, params = prepare(network, solver, t0=0.0, t1=60_000.0, dt=1.0)
params.coupling.delayed.G = Parameter(0.5)
bold = Bold(history=result, period=720.0)

# Compare simulated and empirical functional connectivity.
def loss(params):
    predicted_fc = compute_fc(bold(simulator(params)))
    return rmse(predicted_fc, target_fc)

# Fit the global coupling strength with Adam.
optimizer = OptaxOptimizer(loss, optax.adam(learning_rate=0.03))
fitted_params, history = optimizer.run(params, max_steps=5)

For a complete 84-region model fitting empirical fMRI functional connectivity, see the whole-brain optimization workflow or run it in Google Colab.

Agent Skill

Teach your coding agent the API you actually have installed:

tvboptim skills install --agent claude-code --scope project

Agents then look up Network, Space, or GridAxis instead of guessing at them, and load only the part of the skill a task needs. The skill describes the version you have installed, so you spend less time correcting code written for an older release. See Agent Skill for the other clients, scopes, and the Python API.

Documentation

Contributing

We welcome contributions and questions from the community!

Citation

If you use TVB-Optim in your research, please cite:

@article{2025tvboptim,
  title={Fast and Easy Whole-Brain Network Model Parameter Estimation with Automatic Differentiation},
  author={Pille, Marius and Martin, Leon and Richter, Emilius and Perdikis, Dionysios and Schirner, Michael and Ritter, Petra},
  journal={bioRxiv},
  year={2025},
  doi={10.1101/2025.11.18.689003}
}

Copyright © 2026 Charité Universitätsmedizin Berlin