The Virtual Brain Project

Previous topic

simulator Package

Next topic


This Page


Class diagram for tvb.simulator.simulator

This is the main module of the simulator. It defines the Simulator class which brings together all the structural and dynamic components necessary to define a simulation and the method for running the simulation.


A Simulator assembles components required to perform simulations. traits on this class:

conduction_speed (Conduction Speed)
Conduction speed for Long-range connectivity (mm/ms)
default: 3.0
range: low = 0.01 ; high = 100.0
connectivity (Long-range connectivity)
A tvb.datatypes.Connectivity object which contains the structural long-range connectivity data (i.e., white-matter tracts). In combination with the Long-range coupling function it defines the inter-regional connections. These couplings undergo a time delay via signal propagation with a propagation speed of Conduction Speed
default: None
coupling (Long-range coupling function)
The coupling function is applied to the activity propagated between regions by the Long-range connectivity before it enters the local dynamic equations of the Model. Its primary purpose is to ‘rescale’ the incoming activity to a level appropriate to Model.
default: Linear(a=0.00390625, b=0)
initial_conditions (Initial Conditions)
Initial conditions from which the simulation will begin. By default, random initial conditions are provided. Needs to be the same shape as simulator ‘history’, ie, initial history function which defines the minimal initial state of the network with time delays before time t=0. If the number of time points in the provided array is insufficient the array will be padded with random values based on the ‘state_variables_range’ attribute.
default: None
integrator (Integration scheme)
A tvb.simulator.Integrator object which is an integration scheme with supporting attributes such as integration step size and noise specification for stochastic methods. It is used to compute the time courses of the model state variables.
default: <class ‘tvb.simulator.integrators.HeunDeterministic’>
model (Local dynamic model)
A tvb.simulator.Model object which describe the local dynamic equations, their parameters, and, to some extent, where connectivity (local and long-range) enters and which state-variables the Monitors monitor. By default the ‘Generic2dOscillator’ model is used. Read the Scientific documentation to learn more about this model.
default: <class ‘tvb.simulator.models.oscillator.Generic2dOscillator’>
monitors (Monitor(s))
A tvb.simulator.Monitor or a list of tvb.simulator.Monitor objects that ‘know’ how to record relevant data from the simulation. Two main types exist: 1) simple, spatial and temporal, reductions (subsets or averages); 2) physiological measurements, such as EEG, MEG and fMRI. By default the Model’s specified variables_of_interest are returned, temporally downsampled from the raw integration rate to a sample rate of 1024Hz.
default: <class ‘tvb.simulator.monitors.TemporalAverage’>
simulation_length (Simulation Length (ms, s, m, h))
The length of a simulation (default in milliseconds).
default: 1000.0
stimulus (Spatiotemporal stimulus)
A Spatiotemporal stimulus can be defined at the region or surface level. It’s composed of spatial and temporal components. For region defined stimuli the spatial component is just the strength with which the temporal component is applied to each region. For surface defined stimuli, a (spatial) function, with finite-support, is used to define the strength of the stimuli on the surface centred around one or more focal points. In the current version of TVB, stimuli are applied to the first state variable of the Local dynamic model.
default: None
surface (Cortical surface)
By default, a Cortex object which represents the cortical surface defined by points in the 3D physical space and their neighborhood relationship. In the current TVB version, when setting up a surface-based simulation, the option to configure the spatial spread of the Local Connectivity is available.
default: None

at(a, indices, b=None)

Performs unbuffered in place operation on operand ‘a’ for elements specified by ‘indices’. For addition ufunc, this method is equivalent to a[indices] += b, except that results are accumulated for elements that are indexed more than once. For example, a[[0,0]] += 1 will only increment the first element once because of buffering, whereas, [0,0], 1) will increment the first element twice.

New in version 1.8.0.

a : array_like
The array to perform in place operation on.
indices : array_like or tuple
Array like index object or slice object for indexing into first operand. If first operand has multiple dimensions, indices can be a tuple of array like index objects or slice objects.
b : array_like
Second operand for ufuncs requiring two operands. Operand must be broadcastable over first operand after indexing or slicing.

Set items 0 and 1 to their negative values:

>>> a = np.array([1, 2, 3, 4])
>>>, [0, 1])
>>> print(a)
array([-1, -2, 3, 4])

Increment items 0 and 1, and increment item 2 twice:

>>> a = np.array([1, 2, 3, 4])
>>>, [0, 1, 2, 2], 1)
>>> print(a)
array([2, 3, 5, 4])

Add items 0 and 1 in first array to second array, and store results in first array:

>>> a = np.array([1, 2, 3, 4])
>>> b = np.array([1, 2])
>>>, [0, 1], b)
>>> print(a)
array([2, 4, 3, 4])