The Virtual Brain Project

Previous topic

Noise

Next topic

Phase-Plane Interactive

This Page

Monitors

Class diagram for tvb.simulator.monitors

Monitors record significant values from the simulation. In their simplest form they return all the simulated data, Raw(), directly subsampled data, SubSample() spatially averaged temporally subsampled, GlobalAverage(), or temporally averaged subsamples, TemporalAverage(). The more elaborate monitors instantiate a physically realistic measurement process on the simulation, such as EEG, MEG, and fMRI (BOLD).

Conversion of power of 2 sample-rates(Hz) to Monitor periods(ms)

4096 Hz => 0.244140625 ms
2048 Hz => 0.48828125 ms
1024 Hz => 0.9765625 ms
 512 Hz => 1.953125 ms
 256 Hz => 3.90625 ms
 128 Hz => 7.8125 ms
tvb.simulator.monitors.Monitor[source]

Abstract base class for monitor implementations.

traits on this class:

period (Sampling period (ms))
Sampling period in milliseconds, must be an integral multiple of integration-step size. As a guide: 2048 Hz => 0.48828125 ms ; 1024 Hz => 0.9765625 ms ; 512 Hz => 1.953125 ms.
default: 0.9765625
variables_of_interest (Model variables to watch)
Indices of model’s variables of interest (VOI) that this monitor should record. Note that the indices should start at zero, so that if a model offers VOIs V, W and V+W, and W is selected, and this monitor should record W, then the correct index is 0.
default: None
tvb.simulator.monitors.Raw[source]

A monitor that records the output raw data from a tvb simulation: It collects:

  • all state variables and modes from class :Model:
  • all nodes of a region or surface based
  • all the integration time steps

traits on this class:

period (Sampling period is ignored for Raw Monitor)

default: None
variables_of_interest (Raw Monitor sees all!!! Resistance is futile...)

default: None
tvb.simulator.monitors.SubSample[source]

Sub-samples or decimates the solution in time.

traits on this class:

period (Sampling period (ms))
Sampling period in milliseconds, must be an integral multiple of integration-step size. As a guide: 2048 Hz => 0.48828125 ms ; 1024 Hz => 0.9765625 ms ; 512 Hz => 1.953125 ms.
default: 0.9765625
variables_of_interest (Model variables to watch)
Indices of model’s variables of interest (VOI) that this monitor should record. Note that the indices should start at zero, so that if a model offers VOIs V, W and V+W, and W is selected, and this monitor should record W, then the correct index is 0.
default: None
tvb.simulator.monitors.SpatialAverage[source]

Monitors the averaged value for the models variable of interest over sets of nodes – defined by spatial_mask. This is primarily intended for use with surface simulations, with a default behaviour, when no spatial_mask is specified, of using surface.region_mapping in order to reduce a surface simulation back to a single average timeseries for each region in the associated Connectivity. However, any vector of length nodes containing integers, from a set contiguous from zero, specifying the new grouping to which each node belongs should work.

Additionally, this monitor temporally sub-samples the simulation every istep integration steps.

traits on this class:

default_mask (Default Mask)
Fallback in case spatial mask is none and no surface provided to use either connectivity hemispheres or cortical attributes.
default: [‘hemispheres’]
period (Sampling period (ms))
Sampling period in milliseconds, must be an integral multiple of integration-step size. As a guide: 2048 Hz => 0.48828125 ms ; 1024 Hz => 0.9765625 ms ; 512 Hz => 1.953125 ms.
default: 0.9765625
spatial_mask (An index mask of nodes into areas)
A vector of length==nodes that assigns an index to each node specifying the “region” to which it belongs. The default usage is for mapping a surface based simulation back to the regions used in its Long-range Connectivity.
default: None
variables_of_interest (Model variables to watch)
Indices of model’s variables of interest (VOI) that this monitor should record. Note that the indices should start at zero, so that if a model offers VOIs V, W and V+W, and W is selected, and this monitor should record W, then the correct index is 0.
default: None
tvb.simulator.monitors.GlobalAverage[source]

Monitors the averaged value for the model’s variables of interest over all the nodes at each sampling period. This mainly exists as a “convenience” monitor for quickly checking the “global” state of a simulation.

traits on this class:

period (Sampling period (ms))
Sampling period in milliseconds, must be an integral multiple of integration-step size. As a guide: 2048 Hz => 0.48828125 ms ; 1024 Hz => 0.9765625 ms ; 512 Hz => 1.953125 ms.
default: 0.9765625
variables_of_interest (Model variables to watch)
Indices of model’s variables of interest (VOI) that this monitor should record. Note that the indices should start at zero, so that if a model offers VOIs V, W and V+W, and W is selected, and this monitor should record W, then the correct index is 0.
default: None
tvb.simulator.monitors.TemporalAverage[source]

Monitors the averaged value for the model’s variable/s of interest over all the nodes at each sampling period. Time steps that are not modulo istep are stored temporarily in the _stock attribute and then that temporary store is averaged and returned when time step is modulo istep.

traits on this class:

period (Sampling period (ms))
Sampling period in milliseconds, must be an integral multiple of integration-step size. As a guide: 2048 Hz => 0.48828125 ms ; 1024 Hz => 0.9765625 ms ; 512 Hz => 1.953125 ms.
default: 0.9765625
variables_of_interest (Model variables to watch)
Indices of model’s variables of interest (VOI) that this monitor should record. Note that the indices should start at zero, so that if a model offers VOIs V, W and V+W, and W is selected, and this monitor should record W, then the correct index is 0.
default: None
tvb.simulator.monitors.Projection[source]

Base class monitor providing lead field suppport. traits on this class:

period (Sampling period (ms))
Sampling period in milliseconds, must be an integral multiple of integration-step size. As a guide: 2048 Hz => 0.48828125 ms ; 1024 Hz => 0.9765625 ms ; 512 Hz => 1.953125 ms.
default: 0.9765625
region_mapping (region mapping)
A region mapping specifies how vertices of a surface correspond to given regions in the connectivity. For iEEG/EEG/MEG monitors, this must be specified when performing a region simulation but is optional for a surface simulation.
default: None
variables_of_interest (Model variables to watch)
Indices of model’s variables of interest (VOI) that this monitor should record. Note that the indices should start at zero, so that if a model offers VOIs V, W and V+W, and W is selected, and this monitor should record W, then the correct index is 0.
default: None
tvb.simulator.monitors.EEG[source]

Forward solution monitor for electroencephalogy (EEG). If a precomputed lead field is not available, a single sphere analytic formula due to Sarvas 1987 is used.

References:

[Sarvas_1987]Sarvas, J., Basic mathematical and electromagnetic concepts of the biomagnetic inverse problem, Physics in Medicine and Biology, 1987.

traits on this class:

period (Sampling period (ms))
Sampling period in milliseconds, must be an integral multiple of integration-step size. As a guide: 2048 Hz => 0.48828125 ms ; 1024 Hz => 0.9765625 ms ; 512 Hz => 1.953125 ms.
default: 0.9765625
projection (Projection matrix)
Projection matrix to apply to sources.
default: None
reference (EEG Reference)
EEG Electrode to be used as reference, or “average” to apply an average reference. If none is provided, the produced time-series are the idealized or reference-free.
default: None
region_mapping (region mapping)
A region mapping specifies how vertices of a surface correspond to given regions in the connectivity. For iEEG/EEG/MEG monitors, this must be specified when performing a region simulation but is optional for a surface simulation.
default: None
sensors (EEG Sensors)
Sensors to use for this EEG monitor
default: None
sigma (Conductivity (w/o projection))
When a projection matrix is not used, this provides the value of conductivity in the formula for the single sphere approximation of the head (Sarvas 1987).
default: 1.0
variables_of_interest (Model variables to watch)
Indices of model’s variables of interest (VOI) that this monitor should record. Note that the indices should start at zero, so that if a model offers VOIs V, W and V+W, and W is selected, and this monitor should record W, then the correct index is 0.
default: None
tvb.simulator.monitors.MEG[source]

Forward solution monitor for magnetoencephalography (MEG). traits on this class:

period (Sampling period (ms))
Sampling period in milliseconds, must be an integral multiple of integration-step size. As a guide: 2048 Hz => 0.48828125 ms ; 1024 Hz => 0.9765625 ms ; 512 Hz => 1.953125 ms.
default: 0.9765625
projection (Projection matrix)
Projection matrix to apply to sources.
default: None
region_mapping (region mapping)
A region mapping specifies how vertices of a surface correspond to given regions in the connectivity. For iEEG/EEG/MEG monitors, this must be specified when performing a region simulation but is optional for a surface simulation.
default: None
sensors (MEG Sensors)
The set of MEG sensors for which the forward solution will be calculated.
default: None
variables_of_interest (Model variables to watch)
Indices of model’s variables of interest (VOI) that this monitor should record. Note that the indices should start at zero, so that if a model offers VOIs V, W and V+W, and W is selected, and this monitor should record W, then the correct index is 0.
default: None
tvb.simulator.monitors.iEEG[source]

Forward solution for intracranial EEG (not ECoG!). traits on this class:

period (Sampling period (ms))
Sampling period in milliseconds, must be an integral multiple of integration-step size. As a guide: 2048 Hz => 0.48828125 ms ; 1024 Hz => 0.9765625 ms ; 512 Hz => 1.953125 ms.
default: 0.9765625
projection (Projection matrix)
Projection matrix to apply to sources.
default: None
region_mapping (region mapping)
A region mapping specifies how vertices of a surface correspond to given regions in the connectivity. For iEEG/EEG/MEG monitors, this must be specified when performing a region simulation but is optional for a surface simulation.
default: None
sensors (Internal brain sensors)
The set of SEEG sensors for which the forward solution will be calculated.
default: None
sigma (conductivity)

default: 1.0
variables_of_interest (Model variables to watch)
Indices of model’s variables of interest (VOI) that this monitor should record. Note that the indices should start at zero, so that if a model offers VOIs V, W and V+W, and W is selected, and this monitor should record W, then the correct index is 0.
default: None
tvb.simulator.monitors.Bold[source]

Base class for the Bold monitor.

Attributes

hrf_kernel: the haemodynamic response function (HRF) used to compute
the BOLD (Blood Oxygenation Level Dependent) signal.

length : duration of the hrf in seconds.

period : the monitor’s period

References:

[B_1997]Buxton, R. and Frank, L., A Model for the Coupling between Cerebral Blood Flow and Oxygen Metabolism During Neural Stimulation, 17:64-72, 1997.
[Fr_2000]Friston, K., Mechelli, A., Turner, R., and Price, C., Nonlinear Responses in fMRI: The Balloon Model, Volterra Kernels, and Other Hemodynamics, NeuroImage, 12, 466 - 477, 2000.
[Bo_1996]Geoffrey M. Boynton, Stephen A. Engel, Gary H. Glover and David J. Heeger (1996). Linear Systems Analysis of Functional Magnetic Resonance Imaging in Human V1. J Neurosci 16: 4207-4221
[Po_2000]Alex Polonsky, Randolph Blake, Jochen Braun and David J. Heeger (2000). Neuronal activity in human primary visual cortex correlates with perception during binocular rivalry. Nature Neuroscience 3: 1153-1159
[Gl_1999]Glover, G. Deconvolution of Impulse Response in Event-Related BOLD fMRI. NeuroImage 9, 416-429, 1999.

Note

gamma and polonsky are based on the nitime implementation http://nipy.org/nitime/api/generated/nitime.fmri.hrf.html

Note

see Tutorial_Exploring_The_Bold_Monitor

traits on this class:

hrf_kernel (Haemodynamic Response Function)
A tvb.datatypes.equation object which describe the haemodynamic response function used to compute the BOLD signal.
default: <class ‘tvb.datatypes.equations.FirstOrderVolterra’>
hrf_length (Duration (ms))
Duration of the hrf kernel
default: 20000.0
period (Sampling period (ms))
For the BOLD monitor, sampling period in milliseconds must be an integral multiple of 500. Typical measurment interval (repetition time TR) is between 1-3 s. If TR is 2s, then Bold period is 2000ms.
default: 2000.0
variables_of_interest (Model variables to watch)
Indices of model’s variables of interest (VOI) that this monitor should record. Note that the indices should start at zero, so that if a model offers VOIs V, W and V+W, and W is selected, and this monitor should record W, then the correct index is 0.
default: None
tvb.simulator.monitors.BoldRegionROI[source]

The BoldRegionROI monitor assumes that it is being used on a surface and uses the region mapping of the surface to generate regional signals which are the spatial average of all vertices in the region.

This was originated to compare the results of a Bold monitor with a region level simulation with that of an otherwise identical surface simulation.

traits on this class:

hrf_kernel (Haemodynamic Response Function)
A tvb.datatypes.equation object which describe the haemodynamic response function used to compute the BOLD signal.
default: <class ‘tvb.datatypes.equations.FirstOrderVolterra’>
hrf_length (Duration (ms))
Duration of the hrf kernel
default: 20000.0
period (Sampling period (ms))
For the BOLD monitor, sampling period in milliseconds must be an integral multiple of 500. Typical measurment interval (repetition time TR) is between 1-3 s. If TR is 2s, then Bold period is 2000ms.
default: 2000.0
variables_of_interest (Model variables to watch)
Indices of model’s variables of interest (VOI) that this monitor should record. Note that the indices should start at zero, so that if a model offers VOIs V, W and V+W, and W is selected, and this monitor should record W, then the correct index is 0.
default: None
tvb.simulator.monitors.ProgressLogger[source]

Logs progress of simulation; only for use in console scripts. traits on this class:

period (Sampling period (ms))
Sampling period in milliseconds, must be an integral multiple of integration-step size. As a guide: 2048 Hz => 0.48828125 ms ; 1024 Hz => 0.9765625 ms ; 512 Hz => 1.953125 ms.
default: 0.9765625
variables_of_interest (Model variables to watch)
Indices of model’s variables of interest (VOI) that this monitor should record. Note that the indices should start at zero, so that if a model offers VOIs V, W and V+W, and W is selected, and this monitor should record W, then the correct index is 0.
default: None
tvb.simulator.monitors.numpy_add_at()

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 add.at(a, [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])
>>> np.negative.at(a, [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])
>>> np.add.at(a, [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])
>>> np.add.at(a, [0, 1], b)
>>> print(a)
array([2, 4, 3, 4])