One specification for a whole brain-network simulation.
From one typed, ontology-grounded spec, tvbo compiles runnable code
across many backends and a methods report — and grounds every parameter in a
knowledge graph. Studies re-run without drift; models compare even when they
share no notation.
Each step opens an overview of the pages beneath it, and every page carries the number of the step it belongs to, in the top-left corner.
One specification, two payoffs — TVB-O compiles code and a methods report across backends (reproducible) and grounds every entity in a knowledge graph (comparable).
Install it, then run a whole brain. What a region does, the connectome the regions sit on, and how the result is drawn are one document. This page runs that document and shows what it produced; it contains no plotting code of its own.
from tvbo import SimulationStudystudy = SimulationStudy.from_file("examples/first-simulation/study.yaml")result = study.run(root="_build/first-simulation")result
* Owlready2 * Warning: ignoring cyclic subclass of/subproperty of, involving:
http://uri.interlex.org/tgbugs/uris/readable/atlas/Space
INFO [tvbo.run] [+0s] STEP 1: Running simulation...
INFO [tvbo.run] [+1s] Simulation period: 800.0 ms, dt: 0.1 ms
INFO [tvbo.run] [+1s] Transient period: 300.0 ms (settled on (-300.0, 0], warm-started via update_history)
INFO [tvbo.run] [+2s] Simulation complete.
INFO [tvbo.run] [+2s] Experiment complete.
INFO [tvbo.cli] done: ExperimentResult
INFO [tvbo.cli] wrote ['/Users/leonmartin_bih/tools/tvbo/docs/_build/first-simulation/derivatives/tvbo/exp-1_model-Generic2dOscillator_result.h5', '/Users/leonmartin_bih/tools/tvbo/docs/_build/first-simulation/derivatives/tvbo/exp-1_model-Generic2dOscillator_result.yaml', '/Users/leonmartin_bih/tools/tvbo/docs/_build/first-simulation/derivatives/tvbo/dataset_description.json']
INFO [tvbo.cli] rendering 1 figure(s) -> /Users/leonmartin_bih/tools/tvbo/docs/_build/first-simulation/docs/figures
wrote /Users/leonmartin_bih/tools/tvbo/docs/_build/first-simulation/docs/figures/first_simulation.gif (24 frames)
INFO [tvbo.cli] wrote /Users/leonmartin_bih/tools/tvbo/docs/_build/first-simulation/docs/figures/first_simulation.gif
INFO [tvbo.cli] wrote /Users/leonmartin_bih/tools/tvbo/docs/_build/first-simulation/docs/figures/scripts/plot_first_simulation.py
INFO [tvbo.cli] wrote /Users/leonmartin_bih/tools/tvbo/docs/_build/first-simulation/docs/figures/first_simulation.caption.qmd
wrote /Users/leonmartin_bih/tools/tvbo/docs/_build/first-simulation/docs/figures/first_simulation.png
Three panels of one movie, and not a line of plotting code behind them. (a) is the connectome the model actually ran on, its nodes coloured by the state they are in. (b) is that same state on the cortical surface, placed by region name rather than by array position, so a value cannot land on its neighbour. (c) is every region’s course, with a cursor marking the instant the other two panels show.
The document behind it
Both halves below are read out of the file the cell above just ran, so this page cannot drift away from what it showed you.
# The landing page's first simulation, run by `tvbo run study.yaml` or by `SimulationStudy.from_file(...).run()`. Its directory is the study root.tvbo_class: tvbo:SimulationStudycitekey: FirstSimulationtitle:"A first whole-brain simulation"label:"Eighty-seven regions on a structural connectome, coupled through their tract lengths"description: >- A Generic2dOscillator in its limit-cycle regime on the Desikan-Killiany connectome, coupled linearly through the tract lengths so regions oscillate at a phase lag set by how far apart they are. The figure it declares is one movie: the state on the graph, the same state on the cortical surface, and every region's course with a cursor on the instant the other two panels show.experiments:-id:1label:"A whole-brain simulation"dynamics:name: Generic2dOscillatoriri: tvbo:Generic2dOscillator # a = 2.0 is TVB's own limit-cycle setting for this model; the rest of the curated set stands.parameters:{a:{value:2.0}}network:iri: tvbo:DesikanKillianytransforms:-name: weightequation:{rhs:"weight / mean(weight[weight > 0])"}coupling:c_glob:iri: tvbo:Lineardelayed:trueincoming_states:[V]parameters:{a:{value:0.05}}integration:{method: Heun,step_size:0.1,duration:800.0,transient_time:300.0}
A figure in TVB-O is data, not a script: a mosaic of panels whose layers bind a field of the result container to a visual channel. The binding that says which data is typed prov:used, so declaring where a mark’s numbers come from is the provenance record. See Specify a figure.
The same specification, three ways to reach it
The recipe above is a file, and a file is only one of the places a specification can live. These are alternatives, not steps.
tvbo run examples/first-simulation/study.yaml # run it, and render the figures it declarestvbo export jax examples/first-simulation/study.yaml -o solve.py
from tvbo import SimulationStudyresult = SimulationStudy.from_file("examples/first-simulation/study.yaml").run()result["exp-1"].integration.sel(node="ctx-lh-precentral")