"nregions = len(conn.region_labels) # Number of regions\n",
"conn.speed = np.array(np.inf) # Set the conduction speed\n",
"conn.configure()"
...
...
@@ -123,7 +132,7 @@
},
{
"cell_type": "markdown",
"id": "de6dafab",
"id": "61389c0d",
"metadata": {},
"source": [
"*Take a look at some of the properties of the `conn` object: `weights`, `delays`, `region_labels`, etc.*"
...
...
@@ -131,8 +140,8 @@
},
{
"cell_type": "code",
"execution_count": 4,
"id": "a301f70b",
"execution_count": 24,
"id": "06cda1ca",
"metadata": {},
"outputs": [
{
...
...
@@ -158,10 +167,10 @@
"</tbody></table>"
],
"text/plain": [
"<tvb.datatypes.connectivity.Connectivity at 0x7fb69414a6d8>"
"<tvb.datatypes.connectivity.Connectivity at 0x7f04661be6a0>"
]
},
"execution_count": 4,
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -172,8 +181,8 @@
},
{
"cell_type": "code",
"execution_count": 5,
"id": "c82cd475",
"execution_count": 25,
"id": "e3545b57",
"metadata": {},
"outputs": [
{
...
...
@@ -195,7 +204,7 @@
},
{
"cell_type": "markdown",
"id": "e4d3660a",
"id": "08fa4205",
"metadata": {},
"source": [
"### Model"
...
...
@@ -203,7 +212,7 @@
},
{
"cell_type": "markdown",
"id": "0adf2b72",
"id": "efd1f0e9",
"metadata": {},
"source": [
"A set of differential equations describing the local neural dynamics. There are a number of predefined models available in TVB, as an example here we will use the **Generic 2-dimensional Oscillator** model:\n",
...
...
@@ -216,7 +225,7 @@
},
{
"cell_type": "markdown",
"id": "e3f828d7",
"id": "eb5970c2",
"metadata": {},
"source": [
"We can explore it using the **phase-plane** tool in TVB."
"<tr><td>monitors</td><td style=\"text-align:left;\"><pre>(<tvb.simulator.monitors.Raw object at 0x7fb64c6a6550>, <tvb.simulator.monitors.TemporalAverage object at 0x7fb64c6a6588>)</pre></td>\n",
"<tr><td>monitors</td><td style=\"text-align:left;\"><pre>(<tvb.simulator.monitors.Raw object at 0x7f04661befd0>, <tvb.simulator.monitors.TemporalAverage object at 0x7f04661be438>)</pre></td>\n",
"**Functional Connectivity (FC)** describes the connectedness of two brain regions by means of the covariance between their time series. The classic and most widely used method to infer the strength of network interactions or functional connections consists in estimating the linear (Pearson) correlation coefficient between temporal signals. If two regions activate and deactivate at the same time, there is likely a functional connection. \n",
...
...
@@ -708,8 +717,8 @@
},
{
"cell_type": "code",
"execution_count": 17,
"id": "3e7ecaf9",
"execution_count": 18,
"id": "a3462306",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -718,7 +727,7 @@
},
{
"cell_type": "markdown",
"id": "76165909",
"id": "16962d64",
"metadata": {},
"source": [
"And now we display the resulting FC matrix:"
...
...
@@ -726,8 +735,8 @@
},
{
"cell_type": "code",
"execution_count": 18,
"id": "6220213a",
"execution_count": 19,
"id": "1f269e8b",
"metadata": {},
"outputs": [
{
...
...
@@ -758,7 +767,7 @@
},
{
"cell_type": "markdown",
"id": "2189b99b",
"id": "45ddfaa1",
"metadata": {},
"source": [
"# What is next?\n",
...
...
%% Cell type:code id:68ccd22b tags:
%% Cell type:code id:7b069db6 tags:
``` python
%load_ext autoreload
%autoreload 2
```
%% Cell type:markdown id:e5a89d1a tags:
%% Cell type:markdown id:26493873 tags:
# First steps using TVB
**Summer School in Nonlinear Dynamics for the Life Sciences with Applications to Neuroscience and Psychology May 31-June 11, 2021**
**EITN Workshop on Computational Neuroscience in EBRAINS, June 10, 2021**
%% Cell type:markdown id:c669ec16 tags:
%% Cell type:markdown id:7600f537 tags:
# Brain network modeling with TVB
***
Components to be covered
* node dynamics
* connectivity
* coupling functions
* monitors
* integrator
* stimulus
%% Cell type:markdown id:727cf9bf tags:
%% Cell type:markdown id:9611478f tags:
# Objectives
Here we:
* Build a brain network model using subject-specific structural connectivity,
* Simulate resting-state activity,
* Characterize the resting-state activity by calculating the functional connectivity (FC).
%% Cell type:markdown id:48605a2c tags:
%% Cell type:markdown id:68d1fa73 tags:
# How to do it with TVB?
***
In the first part of this tutorial, we presents the basic anatomy of a region simulation using The Virtual Brain's scripting interface.
The first thing we want to do is to import the modules we will need for a simulation.
%% Cell type:code id:48088d0e tags:
%% Cell type:code id:944fa90e tags:
``` python
%%capture
import os
import time as tm
import numpy as np
import matplotlib.pyplot as plt
from tvb.simulator.lab import *
from utils import plot_connectivity
from phase_plane import phase_plane_interactive
```
%% Cell type:markdown id:1a410d7a tags:
%% Cell type:markdown id:844294a1 tags:
A basic simulation of TVB consists of **5 main components**. Each of these components is an object within TVB:
%% Cell type:markdown id:ae302f73 tags:
%% Cell type:markdown id:73e7c33e tags:
### Connectivity
We start by loading and visualizing the structural connectivity matrix that represents the set of all existing connections between brain areas. Having loaded the default dataset, we can then alter the speed of signal propagation through the network:
%% Cell type:code id:710d21e4 tags:
%% Cell type:code id:b64aa207 tags:
``` python
# Import the anatomical structural connectivity.
conn = connectivity.Connectivity().from_file(
os.path.abspath('dataset/connectivity_76.zip')
)
```
%% Cell type:code id:b023951d tags:
``` python
nregions = len(conn.region_labels) # Number of regions
conn.speed = np.array(np.inf) # Set the conduction speed
conn.configure()
```
%% Cell type:markdown id:de6dafab tags:
%% Cell type:markdown id:61389c0d tags:
*Take a look at some of the properties of the `conn` object: `weights`, `delays`, `region_labels`, etc.*
%% Cell type:code id:a301f70b tags:
%% Cell type:code id:06cda1ca tags:
``` python
conn
```
%% Output
<tvb.datatypes.connectivity.Connectivity at 0x7fb69414a6d8>
<tvb.datatypes.connectivity.Connectivity at 0x7f04661be6a0>