Changes for page Widget PhasePlane
Last modified by ldomide on 2023/03/08 17:28
From version 1.1
edited by teodoramisan
on 2023/01/03 12:02
on 2023/01/03 12:02
Change comment:
There is no comment for this version
To version 2.1
edited by teodoramisan
on 2023/01/03 13:34
on 2023/01/03 13:34
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -2,7 +2,6 @@ 2 2 3 3 Immediate testing: [[https:~~/~~/lab.ch.ebrains.eu/user/teodoramisan/lab/workspaces/auto-3/tree/shared/TVB%20Widgets/REPO/tvb-widgets/notebooks/PhasePlane.ipynb>>https://lab.ch.ebrains.eu/user/teodoramisan/lab/workspaces/auto-3/tree/shared/TVB%20Widgets/REPO/tvb-widgets/notebooks/PhasePlane.ipynb]] 4 4 5 - 6 6 == Purpose == 7 7 8 8 It is a Jupyter Widget intended for the visualization of the interactive phase-plane. ... ... @@ -9,29 +9,91 @@ 9 9 10 10 It provides sliders for setting: 11 11 12 -* 11 +* ((( 12 + The value of all parameters of the Model. 13 +))) 14 +* ((( 15 + The extent of the axes. 16 +))) 17 +* ((( 18 + A fixed value for the state-variables which aren't currently selected. 19 +))) 20 +* ((( 21 + The noise strength, if a stochastic integrator is specified. 22 +))) 13 13 14 -{{{ The value of all parameters of the Model.}}} 15 -* 24 +and dropdown lists for selecting: 16 16 17 -{{{ The extent of the axes.}}} 18 -* 26 +* ((( 27 + Which state-variables to show on each axis. 28 +))) 29 +* ((( 30 + Which mode to show, if the Model has them. 31 +))) 19 19 20 - {{{ A fixedvalueforheate-variables whicharen't currentlyselected.}}}21 - *33 +Entering the coordinates in the X,Y Coordinate Boxes will generate a sample 34 +trajectory, originating from the coordinates entered. 22 22 23 - {{{Thenoise strength, if astochasticintegrator is specified.}}}36 +== Inputs == 24 24 25 -an ddropdownlistsforselecting:38 +Phase-Plane viewer will be represented in the beginning based on the parameters that it receives: 26 26 27 -* 40 +* Model (Generic2dOscillator, Epileptor, Hopfield, etc.) 41 +* Integrator (HeunDeterministic, HeunStochastic, Identity, etc.) 28 28 29 -{{{ Which state-variables to show on each axis. 43 +== Requirements and installation == 44 + 45 +Before installing the tvb-widgets library containing the PhasePlane widget, the following python libraries and Jupyter extensions should be installed: 46 + 47 +* **Libraries:** 48 +** [[ipympl>>https://github.com/matplotlib/ipympl#installation]] 49 +* **Extensions:** 50 + 51 +(% class="box" %) 52 +((( 53 +jupyter labextension install @jupyter-widgets/jupyterlab-manager 54 + 55 +jupyter labextension install jupyter-matplotlib 56 +))) 57 + 58 +Then, to install the tvb-widgets library, just type: 59 + 60 +(% class="box" %) 61 +((( 62 +pip install tvb-widgets 63 +))) 64 + 65 +== API usage == 66 + 67 +First, the correct matplotlib backend must be set, which enables the interaction with the TimeSeries widget, by running the following command: 68 + 69 +(% class="box" %) 70 +((( 71 +%matplotlib widget 72 +))) 73 + 74 +Then, the PhasePlaneWidget (from the tvb-widgets API), the package lab (from tvb simulator) and the display function should be imported: 75 + 76 +(% class="box" %) 77 +((( 78 +{{{from tvbwidgets.api import PhasePlaneWidget 79 +from tvb.simulator.lab import * 30 30 }}} 31 -* 32 32 33 -{{{ Which mode to show, if the Model has them.}}} 82 +{{{from IPython.core.display_functions import display}}} 83 +))) 34 34 85 +The widget can be initialized with the required parameters (Model and Integrator) as it shows below: 35 35 36 -{{{Entering the coordinates in the X,Y Coordinate Boxes will generate a sample 37 -trajectory, originating from the coordinates entered.}}} 87 +(% class="box" %) 88 +((( 89 +{{{w = PhasePlaneWidget(model=models.Generic2dOscillator(), 90 + integrator=integrators.HeunDeterministic())}}} 91 +))) 92 + 93 +Finally, to display and interact with the PhasePlane widget, the **//get_widget//**// //method is used inside the //**display **//function: 94 + 95 +(% class="box" %) 96 +((( 97 +{{{display(w.get_widget(plot_size=(6,7)))}}} 98 +)))