Warning:  Due to planned infrastructure maintenance, the EBRAINS Wiki and EBRAINS Support system will be unavailable for up to three days starting Monday, 14 July. During this period, both services will be inaccessible, and any emails sent to the support address will not be received.

Attention: We are currently experiencing some issues with the EBRAINS Drive. Please bear with us as we fix this issue. We apologise for any inconvenience caused.


Widget PhasePlane

Version 5.2 by teodoramisan on 2023/01/03 13:39

Source code: https://github.com/the-virtual-brain/tvb-widgets

Immediate testing: https://lab.ch.ebrains.eu/user/teodoramisan/lab/workspaces/auto-3/tree/shared/TVB%20Widgets/REPO/tvb-widgets/notebooks/PhasePlane.ipynb

Purpose

It is a Jupyter Widget intended for the visualization of the interactive phase-plane.

It provides sliders for setting:

  •  The value of all parameters of the Model.

  •  The extent of the axes.

  •  A fixed value for the state-variables which aren't currently selected.

  •  The noise strength, if a stochastic integrator is specified.

and dropdown lists for selecting:

  •  Which state-variables to show on each axis.

  •  Which mode to show, if the Model has them.

Entering the coordinates in the X,Y Coordinate Boxes will generate a sample
trajectory, originating from the coordinates entered.

Inputs

Phase-Plane viewer will be represented in the beginning based on the parameters that it receives:

  • Model (Generic2dOscillator, Epileptor, Hopfield, etc.)
  • Integrator (HeunDeterministic, HeunStochastic, Identity, etc.)

Requirements and installation

Before installing the tvb-widgets library containing the PhasePlane widget, the following python library and Jupyter extensions should be installed:

  • Libraries:​​​​​
  • Extensions:

jupyter labextension install @jupyter-widgets/jupyterlab-manager

jupyter labextension install jupyter-matplotlib

Then, to install the tvb-widgets library, just type:

pip install tvb-widgets

API usage

First, the correct matplotlib backend must be set, which enables the interaction with the PhasePlane widget, by running the following command:

%matplotlib widget

Then, the PhasePlaneWidget (from the tvb-widgets API), the package lab (from tvb simulator) and the display function should be imported:

from tvbwidgets.api import PhasePlaneWidget
from tvb.simulator.lab import *
from IPython.core.display_functions import display

The widget can be initialized with the required parameters (Model and Integrator) as it shows below:

w = PhasePlaneWidget(model=models.Generic2dOscillator(),
                     integrator=integrators.HeunDeterministic())

Finally, to display and interact with the PhasePlane widget, the get_widget method is used inside the display function: 

display(w.get_widget(plot_size=(6,7)))
Public

TVB Widgets