TVB-O API Documentation

Welcome to the TVB-O project!

TVB-O is a Python package for understanding and generating large-scale brain network models.

This module contains adapters for different simulation backends:

julia
pyrates PyRates backend adapter for SimulationExperiment.

TVB-O API

This module provides the API for the TVB Ontology.

direct_ontology_api Direct RDF/SPARQL-based ontology API.
main
ontology_api This module provides a set of methods, through the OntologyAPI interface, which

Benchmark Module

This module provides utilities for benchmarking TVB-O models.

utils

Data Module

Access and manage TVB-O data.

types

tvbo.data.db

tvbo.data.tvbo_data

atlases
bids_utils
connectomes
tractograms

tvbo.data.tvbo_data.atlas

tvbo.data.tvbo_data.connectome

TVB-O Data Model

This module contains the data model for TVB-O. {seealso} https://bss.git-pages.bihealth.org/tvb-o/tvbo-datamodel

tvbo_datamodel
tvbopydantic

TVB-O Export

Provides export functionality for TVBO models to various formats: - TVB (The Virtual Brain) - JAX (autodiff) - Julia (DifferentialEquations.jl, BifurcationKit.jl) - PyRates (YAML templates) - LEMS (NeuroML) - PDE-FEM (scikit-fem)

code
experiment
functions Function Code Generation
lemsgenerator # LEMS-Generator
openminds OpenMINDS JSON-LD conversion utilities for TVBO.
pyrates PyRates Integration Module
report Report Module
templater
tvbids Brain Imaging Data Structure (BIDS) Export for TVB-O

BIDS BEP034 Export Module

tvbo.knowledge

config TVB-O Model Configuration Module
constants Constants
db
function Function Classes
graph # Graph-based representation of the ontology.
ontology
query
study

tvbo.knowledge.atlas

freesurfer

tvbo.knowledge.semanticweb

tvbgo TVB-GO Module

knowledge.simulation

This module contains the simulation knowledge base for TVB-O. {seealso} - [Simulation](![wiki]/Simulation/index.html)

equations # Handling Equations and Expressions
integration
localdynamics
network TVB-O wrapper for Coupling functions
observation
parcellation This module provides functions for loading and accessing parcellation data.
perturbation

TVB-O Parse

expression
lems_loader This module deals with loading elements from LEMS-generated files.
literature # Handling studies
llm
metadata
misc_loader This module deals with loading simulation components from different sources, other than the ontology and LEMS files.
nlp Natural Language Processing with TVB-O.
pdf

TVB-O’s plotting utilities

This module contains utilities for plotting TVB-O models. {python} from tvbo.plot import graph graph.plot_model('JansenRit')

analysis
bifurcation_diagram
functions
network Plotting functions for visualizing networks
utils

tvbo.run

compgraph

tvbo.summary

properties
summary_table

Templates

Templates for generating code.

TVB-Optim Templates

Mako templates for generating tvboptim Network Dynamics code from TVBO models. Templates: - tvbo-tvboptim-dfun.py.mako: Dynamics class generation - tvbo-tvboptim-cfun.py.mako: Coupling function generation - tvbo-tvboptim-solver.py.mako: Solver/integrator generation - tvbo-tvboptim-noise.py.mako: Noise model generation - tvbo-tvboptim-observation.py.mako: Observation/monitor generation (metadata-driven pipelines) - tvbo-tvboptim-optim.py.mako: Optimizer configuration generation - tvbo-tvboptim-exploration.py.mako: Parameter exploration (grid search) generation - tvbo-tvboptim-sim.py.mako: Full simulation workflow generation - tvbo-tvboptim-experiment.py.mako: Complete experiment generation (fully metadata-driven) Usage: —— From a TVBO SimulationExperiment: from tvbo import SimulationExperiment from tvbo.templates import lookup experiment = SimulationExperiment.from_file(“my_experiment.yaml”) template = lookup.get_template(“tvboptim/tvbo-tvboptim-sim.py.mako”) code = template.render(experiment=experiment) dfun_template = lookup.get_template(“tvboptim/tvbo-tvboptim-dfun.py.mako”) dfun_code = dfun_template.render(model=experiment.local_dynamics) expl_template = lookup.get_template(“tvboptim/tvbo-tvboptim-exploration.py.mako”) expl_code = expl_template.render(experiment=experiment) optim_template = lookup.get_template(“tvboptim/tvbo-tvboptim-optim.py.mako”) optim_code = optim_template.render(experiment=experiment) Template Context Variables: ————————— All templates accept: - experiment: SimulationExperiment instance Individual component templates also accept: - model: Dynamics instance (for dfun) - coupling: Coupling instance (for cfun) - integration: Integration instance (for solver, noise) - monitors: List of Monitor instances (for observation) - fitting: ModelFitting instance (for target, loss, optim) Output Format: ————– Templates generate Python code compatible with tvboptim.experimental.network_dynamics which provides: - JAX-based differentiable simulation - Support for both instantaneous and delayed coupling - Stochastic (SDE) and deterministic (ODE) modes - BOLD signal monitoring and FC computation - Integration with optax for parameter optimization - Grid exploration and parallel execution

utils TVB-Optim Template Utilities

Utilities Module for TVB-O

This module provides a set of utility functions for various tasks related to TVB-O simulations. It includes functions to: - Retrieve the TVB-O logo. - Convert color formats. - Compute postsynaptic potential (PSP) for the Jansen-Rit model. - Define hierarchical positions for nodes in a graph. - Generate specific colormaps. - Display multiple views of brain regions. Usage: —— >>> from utils import get_logo >>> logo = get_logo() Author: Leon K. Martin (2023) Copyright: Copyright (c) 2023 Charité Universitätsmedizin Berlin

computation_utils This module contains utility functions used for computations for TVB Simulations, simulation results,
ontology_utils This module contains helper functions for interacting with the TVBO ontology.