Attention: The Keycloak upgrade has been completed. As this was a major upgrade, there may be some unexpected issues occurring. Please report any issues you find to support by using the contact form found at https://www.ebrains.eu/contact/. Thank you for your patience and understanding. 


Widget PhasePlane

Version 1.8 by teodoramisan on 2023/01/03 13:34

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 libraries 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 TimeSeries 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