Modeling Epilepsy

TVB can be used to model large-scale epileptic seizure dynamics. Using relevant neural mass models, TVB allows to ask multiple questions such as the localisation of the epileptogenic zone or the validity of different neuroimaging modalities to assess the epileptogenicity of a brain structure. Here we will present an example of such a modelisation.


The main goal of this tutorial is to provide a clear understanding of how we can reproduce clinically relevant senarios such as the modelisation of propagation of an epileptic seizure in the human brain, electrical stimulation of a brain region that can trigger a seizure, or surgical resection of brain regions.

We will be using the ModelingEpilepsy project. You can download the file in the TVB sharing area. We’ll only go through the necessary steps required to reproduce these simulations, along with the relevant outline. You can always start over, click along and/or try to change parameters. We will use the default subject connectivity matrix and surface.

Exploring the Epileptor model

The Epileptor is a phenomenological neural mass model able to reproduce epileptic seizure dynamics such as recorded with intracranial EEG electrodes (see Jirsa_et_al). Before launching any simulations, we will have a look at the phase space of the Epileptor model to better understand its dynamics. We will use the phase plane interactive tool.

  1. Go to Simulator > burst_menu > Phase plane and select the \(\mathbf{Epileptor}\) model.

  2. Look at the phase space. We have here the first population (variables \(y_0\) in abscissa and \(y_1\) in ordinate). The left most intersection of the nullcline defines a stable fixed point, representing the interictal state, whereas the rightmost intersection is the center of a limit cycle, being the ictal state. Both states are separated by a separatrix, as you can see by drawing different trajectories in this phase space (left click on the figure).

:math:`y_0-y_1` phase plane for the first population.
  1. You can also look at other variables in the phase space, such as the second population \(y_3\)/\(y_4\), responsible for the interictal spikes in the Epileptor model. Change the lower and upper bound of the axis to see the phase space correctly.

:math:`y_3-y_4` phase plane for the second population.
  1. You can continue to play along to explore the dynamics of this model. For instance, try changing the number of integration steps, or choosing a HeunStochastic integrator and varying the scaling of the noise (parameter D).

Region-based modeling of a temporal lobe seizure

We will model temporal lobe epilepsy (TLE) using the Default TVB Subject. Here, using the tools in Set up Region model, we will set different values of epileptogenicity (\(x_0\) parameter in the Epileptor) according to the region positions, thereby introducing heterogeneities in the network parameters. We will set the right limbic areas (right hippocampus (rHC), parahippocampus (rPHC) and amygdala (rAMYG)) as epileptic zones. We will also add two lesser epileptogenic regions: the inferior temporal cortex (rTCI) and the ventral temporal cortex (rTCV).

First, we will configure the different parameter regimes we will use. Go to the Simulator page, click on the burst_menu > Phase plane, in Parameter configuration name give the name Other Nodes, select the Epileptor model, set \(\mathbf{x_0=-2.4}\), and click on Save new parameter configuration on the right menu. Repeat the operation using the name Epileptogenic zone with \(\mathbf{x_0=-1.6}\), and then again using the name Propagation zone with \(\mathbf{x_0=-1.8}\). For each of these set \(\mathbf{r=0.00015}\). All the other model parameters are the default ones and are given in the following table.

Model parameter








  1. Now we will set up the different spatial configurations of these parameters. Go back to Simulator > Simulation Cockpit and keep clicking on the Next button until you reach the model fragment. Click on Set up region Model. On the right of New selection, choose a name, such as Epileptogenic Zone and select the nodes rHC, rPHC, and rAMYG, then click on the Save button. You can use the unselect_all_nodes button to unselect all nodes and select_all_nodes to select all nodes. Add another new selection having the name Propagation Zone with the rTCI and rTCV nodes, and another one with the name Other Nodes selection with all nodes but rHC, rPHC, rAMYG, rTCI, and rTCV.

  2. Now we will assign our parameter configurations to our spatial selections. In the same window, in Select model configuration select Epileptor - Epileptogenic Zone, select you precedent Epileptogenic Zone configuration, and click on Apply to selected nodes. A green label should appear on the right of the nodes assigned. Repeat the operation for the Propagation Zone and Other Nodes, then don’t forget to Submit Region Parameters on the right menu, which will bring you back to the Simulator panel. You can check that your choices have been saved if you see a list of parameters in front of the X0 parameter for the Epileptor model.

choice of parameters for the Epileptor model
  1. We will now configure the simulation parameters. In the Simulator Cockpit panel, choose a Difference Long-range coupling function with \(\mathbf{a=1.0}\). We will add a permittivity coupling and a coupling on the time scale of spike-wave events. For this set \(\mathbf{K_s=-0.2}\) and \(\mathbf{K_f=0.1}\). As state variables choose \(\mathbf{x2-x1;y2}\). Choose a Stochastic Heun integration scheme, set the integration step size to 0.05 ms and an additive noise with \(\mathbf{D=[0.0, 0.0, 0.0, 0.0003, 0.0003, 0.0]}\) (we add noise only on the second population).

  2. For the monitors, we choose a Temporal average, an EEG and an Intracerebral / Stereo Eeg monitor. For all three monitors choose the state variables \(\mathbf{x2-x1;y2}\) (this corresponds to first LFP signal, and second the slow dynamics of the Epileptor). Choose also the right Projection matrix, Region mapping and Sensors for each monitor, and a samplng period of 1 ms.

  3. Choose a simulation length of 6000ms.

  4. Visualize the region time series using the Time SeriesVisualizer (SVG/d3). Click on Select Input Signals and select all the regions. From this same menu, you can select which state variables of interest will be displayed. For instance, visualize \(x_2-x_1\). You will need to increase the scaling by clicking on bm. Use the mouse to zoom in and out in the time series area.

Temporal average time series of the simulation
  1. Now click on bm, select the EEG time series, and Update the Visualizer. Chnage the scaling and the number of channels.

EEG time series of the simulation
  1. Repeat the operation for the SEEG time series, but select only the

    electrodes TB1, A1, B1, C1, and GPH which are in the right temporal lobe.

SEEG time series of the simulation
  1. Visualize the time series using the Brain Activity Visualizer.

    You will need to increase the rendering speed (timesteps per Frame) by clicking on bm.

Modeling surgical resection

Surgical resection is used for around 20% of epileptic patient whose seizures are drug- resistant. We will simulate the hypothetic case of a surgical resection of the amygdala and the hippocampus, but leaving the parahippocampal cortex.

  1. Go to Connectivity > Large scale Connectivity. Click on the Launch button. All nodes of the connectivity matrix are already selected.

  2. Click on Q1 to go to Quadrant 4, and click on rAMYG and rHC to unselect these nodes if they are not already unselected. Give the name Resection at the right of Large Scale Matrix and save it by clicking on star. Here we just created a new connectivity matrix while deleting all edges connected to the right amygdala and hippocampus.

Resected connectivity matrix
  1. Go back to Simulator and copy the Region_TemporalLobe simulation.

  2. Choose the Resection connectivity matrix.

  3. Go in Set up region model, and apply the dynamics of OtherNodes to rAMYG and rHC. (i.e. we replace the dynamics of the resected node by a stable node).

The results are given in resection_Region_TemporalLobe.

  1. Click on Results, then TimeSeries and visualize the spatial average time series with the a Time Series visualizer. Don’t forget to increase the Scaling and Select all channels.

Time series after the resections

Triggering a seizure by stimulation

We are now going to model an electric stimulation and trigger a seizure. We set the whole brain to non-epileptogenic but close to the threshold:

  1. Go to stimulus > Region Stimulus

  2. Give a name to the new stimulus

  3. Choose a PulseTrain stimulation in time with parameters given in the following table:

Temporal parameters










Stimulation pattern
  1. Click on Set Region Scaling, select the Propagation Zone nodes, and apply a scaling of 1.0 , and click on Save New Stimulus on Region in the right menu.

  2. Go to simulator and copy the former simulation.

  3. Choose the Stim_PropagationZone stimulus.

  4. Visualize the time series, zoom in to better see the effect of the stimulation.

Time Series for a stimulation

More Documentation

For more information on the Epileptor model, see Jirsa_et_al, El_Houssaini_et_al, Proix_et_al, Naze_et_al .


The official TVB website is All the documentation and tutorials are hosted on You’ll find our public repository at For questions and bug reports we have a users group!forum/tvb-users


Jirsa VK, Stacey WC, Quilichini PP, Ivanov AI, Bernard, C. On the nature of seizure dynamics. Brain, 2014. 137:2210-2230


El Houssaini K, Ivanov A, Bernard C, Jirsa VK. Seizures, refractory status epilepticus, and depolarization block as endogenous brain activities. Physical Review E, 2015; 91:2-6


Proix T, Bartolomei F, Chauvel P, Bernard C, Jirsa VK. Permittivity Coupling across Brain Regions Determines Seizure Recruitment in Partial Epilepsy. The Journal of Neuroscience, 2014; 34:15009-15021


Naze S, Bernard C, Jirsa VK. Computational Modeling of Seizure Dynamics Using coupled Neuronal Networks: Factors Shaping Epileptiform Activity. PLOS CB, 2015, 11