02b The Virtual Brain (TVB-GUI)
02b The Virtual Brain (TVB-GUI)
(TVB)
A Whole‐Brain modelling tool
Gustavo Patow
IMAE ‐ UdG
1
What is TVB?
2
What is TVB?
3
What is TVB?
• Various neural mass models are available in the repertoire of
TheVirtualBrain and define the dynamics of a network node
• Together, the neural mass models at the network nodes and
the connectivity matrix define the Virtual Brain
4
What is TVB?
5
What is TVB?
• TheVirtualBrain is foremost a scientific simulation platform
• Provides all means necessary to generate, manipulate and
visualize connectivity and network dynamics
• In addition, TheVirtualBrain comprises
• classical time series analysis tools
• structural and functional
connectivity analysis tools
• parameter exploration facilities
by launching parallel simulations
on a cluster.
6
Working with TVB
• Two possible ways… GUI vs Scripting
7
Getting Started
8
Resources on TVB
• All official TVB tutorials:
https://docs.thevirtualbrain.org/tutorials/Tutorials.html
• All official TVB demos:
https://docs.thevirtualbrain.org/demos/Demos.html
9
User guides
• GUI Guide:
https://docs.thevirtualbrain.org/manuals/UserGuide/UserGuide‐UI.html
• Console Guide
https://docs.thevirtualbrain.org/manuals/UserGuide/UserGuide‐Shell.html
10
Data
• We are going to use tvb‐data which can be downloaded from:
https://zenodo.org/record/4263723#.Y‐klrXbMKMp
• Other than that, please follow this link:
https://www.thevirtualbrain.org/tvb/zwei/client‐
area/public?&_ga=2.181154980.207792273.1676199337‐
1370691999.1675639510#
to download the ModelingEpilepsy.zip project.
11
Setup
• Let’s assume you have installed the software
• And registered a user (yourself)
12
Building Your Own Brain Network Model
• TVB allows for a systematic exploration and manipulation of
every underlying component of a large‐scale brain network
model such as
• the neural mass model governing the local dynamics
• the structural connectivity constraining the space‐time structure of
the network couplings
13
Objectives
• Today we will present the basic anatomy of a brain network
model at the region level using TVB’s graphical interface
• We will be using the Default Project that should be imported
when you start TVB
• We’ll only go through the necessary steps required to reproduce some
simulations
• You can always start over, click along and/or try to change parameters
14
Building A Discrete Brain Network Model
• A basic simulation at the region level uses a coarse
representation of the brain
• Consists of five main configurable components:
• Model or Local population model: a set of differential
equations describing the local neuronal dynamics
• Connectivity: the large scale structural connectivity of the brain
• Long range Coupling: a function that is used to join the local
dynamics at distinct locations over the connections
• Integrator: integration scheme for the (coupled) differential
equations
• Monitors: attached to a simulation, to record the output data
15
The simulator
16
Parameters
• Connectivity: define some structure for your network
• Here, we’ll rely on TVB’s default matrix
• Conduction speed: alter the speed of signal propagation through
the network to 4 mm/ms
• Set a Long range coupling function. For our present purposes, we
happen to know that for the parameters we will use through TVB’s
default Connectivity matrix, a linear function with a slope of
a=0.0042 is a reasonable thing to use
• Local dynamics: then define a Model for the local dynamics
• We’ll use the generic 2 dimensional oscillator with the parameters shown in
the following table.
17
Parameters
• Integration scheme: We’ll use Heun
• Step Size: use a step size that is small enough for the integration to be numerically stable
• Here, we chose a value of dt = 0.1 ms
• Select the Temporal Average monitor
• It averages over a time window of length sampling period returning one time point every
period
• By default, only returns those state‐variables flagged in the Models definition as Model
Variables to watch
• For our example the Monitor’s sampling period is 1 ms.
• Here we’ll select only one simple monitor just to show the idea
• The Raw Monitor takes no arguments and simply returns all the simulated data
• There are monitors which apply a biophysical measurement process to the simulated
neural activity, such as EEG, MEG, SEEG, etc.
• Simulation length: We’ll use the default value of 1000 ms.
• Choose a simulation: AnatomyOfARegionSimulation_a
18
Parameters
19
And play! ;‐)
• Launch!
• Go to Projects > Operations dashboard
• Click on the icon of the time‐series
• From the metadata overlay’s visualizers tab, launch the
Animated Time Series Visualizer
20
And play! ;‐)
Transient (imperfect staring conditions) 21
Another simulation
• Same parameters as
AnatomyOfARegionSimulation_a
• Except that the coupling strength has been
increased by an order of magnitude.
Hence, the slope of the linear coupling
function is a=0.042
• Rename to
AnatomyOfARegionSimulation_b
22
Result (b): Self‐sustained oscillations!
23
Oscillations
• Observe:
• a=0.0042 ‐> No oscillation
• a=0.042 ‐> Oscillation
• At which value of coupling strength occurs this
“bifurcation”?
24
Analyze the simulation results
25
Fourier Spectral Analysis > Fourier
Visualizer
26
Parameter Space Exploration (PSE)
• Allows to study a full parameter space in TVB
• A PSE simulation means that TVB will launch a simulation for
every value from a range specified of one or two chosen
parameters
27
Parameters
• Copy the AnatomyOfARegionSimulation_b and name the new
simulation AnatomyOfARegionSimulation_pse
• Set the simulation length to 2000 ms
• Click on the Setup PSE button
• Select Coupling.A as PSE param1 and Conduction_Speed as PSE
param2. Click on Next
• For Coupling.A set the range between 0.012 and 0.042 and the step
to 0.002
• For Conduction_Speed set the range between 1−10 and the step to
1 mm/ms
• Click on the Launch PSE button
28
Parameters
29
Result (Discreete)
30
Result (Continuous)
31
Simulation continuation or Branching
• Remember the transient period? We could solve this problem!
• Let’s use the phase plane
• Ideal for studying local dynamics
32
Parameters as before
Phase plane Click to draw trajectories
Fixed point @ (V, W) ≈ (0.0, 2.75)
33
Phase plane
• Set your model with fixed point dynamics and a weak coupling
strength (e.g., AnatomyOfARegionSimulation_a)
• Run a simulation for 1000 ms
• TVB has a branching mechanism that allows you to use the data
of a simulation as the initial history for a new simulation
• The only thing you need to know is that the spatio‐temporal structure
of the network should remain unchanged
• e.g., the number of nodes, conduction speed, the recorded state‐variables,
integration time‐step size and selected monitors should be the same
• Set a=0.042 in the long‐range coupling function
34
Stochastic Simulations
• Let’s see the basics of running a simulation driven by noise (i.e.,
using a stochastic integration scheme)
• Here we’ll also use a region level simulation, but the considerations
for surface simulations are the same
• In a stochastic integration scheme Noise enters through the
integration scheme
• We’ll define a simple constant level of noise that enters all nodes and
all state variables
• The noise is configurable on a per node and per state variable level
35
Stochastic Simulations
• The Noise functions are fed by a random process generated by
a pseudo‐random number generator (PRNG)
• The random processes used have Gaussian amplitude and can
potentially be given a temporal correlation
• The random process is defined using two parameters plus the
seed of the PRNG.
• The two parameters are:
• D, defining the standard deviation of the noise amplitude
• τ, which defines the correlation time of the noise source, with τ=0
corresponding to white noise and any value greater than zero producing
coloured noise
36
Stochastic Simulations: Parameters
37
Results: Spectrogram of the Wavelet
Transform AnatomyOfARegionSimulation_b
38
Results: Spectrogram of the Wavelet
Transform AnatomyOfARegionSimulation_stochastic
39
Modeling the Neural Activity on the
Folded Cortex
In addition to the components discussed for a region simulation here we
introduce three major components, that is:
• Cortical Surface, which is a mesh surface defining a 2d representation of
the convoluted cortical surface embedded in 3d space.
• Local Connectivity, that represents the probability of the interactions
between neighbouring nodes on a local patch.
• Region Mapping, a breakup that defines to which anatomical region in the
Connectivity each vertex of the mesh belongs to.
1. The connectivity, speed, coupling strength and and its parameters are the same
described in AnatomyOfARegionSimulation_b].
2. Select the TVB’s default Cortical Surface, which has 16384 nodes.
3. We rely on TVB’s default Local Connectivity.
4. Rescale the Local Connectivity with Local coupling strength equal to 0.1
5. For the integration we’ll use Heun. Here, integration time step size is the default:
dt=0.1220703125 ms.
40
Modeling the Neural Activity on the
Folded Cortex
We’ll introduce a couple of new Monitors here:
• First: SpatialAverage
• average over the space (nodes) of the simulation
• Second: EEG, an instantiation of a biophysical measurement process
• Returns the EEG signals resulting from the simulated neural dynamics using a
lead‐field or Projection Matrix
• Third: Temporal Average monitor
The Sampling period (ms) for all three monitors is 1.953125 ms which
is equivalent to a sampling frequency of 256 Hz
The simulation length is 500 ms
41
Modeling the Neural Activity on the
Folded Cortex
42
Define Your Own Local Connectivity
• TVB allows for a detailed investigation of the local
connectivity’s effects on larger scale dynamics modeled by
neural fields coupled across the realistic surface geometry
• Connectivity > Local Connectivity
• Gaussian Kernel: Select the equation defining the spatial profile of
your local connectivity
• We’ll set sigma to 15 mm
• Cutoff distance is set to 40 mm
• The distance up to which a given node is connected to its neighbourhood
43
Define Your Own Local Connectivity
44
And run more simulations!
• Can change to any local connectivity
• And any Kernel
• Gaussian
• Mexican hat
•…
45
Next
• We will discuss the scripting Python interface
46
THEVIRTUALBRAIN. (TVB)
A Whole‐Brain modelling tool
Thanks!
47