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. 


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
Change comment: There is no comment for this version
To version 13.1
edited by ldomide
on 2023/03/08 17:28
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.teodoramisan
1 +XWiki.ldomide
Content
... ... @@ -1,37 +1,109 @@
1 1  Source code: [[https:~~/~~/github.com/the-virtual-brain/tvb-widgets>>https://github.com/the-virtual-brain/tvb-widgets]]
2 2  
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]]
3 +This is part of a Pypi release: [[https:~~/~~/pypi.org/project/tvb-widgets/>>url:https://pypi.org/project/tvb-widgets/]]
4 4  
5 +//**tvb-widgets**// is also already installed in the official image released for EBRAINS lab, where you can test it directly.
5 5  
6 6  == Purpose ==
7 7  
8 -It is a Jupyter Widget intended for the visualization of the interactive phase-plane.
9 +It is a Jupyter Widget intended for the visualization of the interactive phase-plane for TVB math models ([[https:~~/~~/docs.thevirtualbrain.org/api/tvb.simulator.models.html#module-tvb.simulator.models>>https://docs.thevirtualbrain.org/api/tvb.simulator.models.html#module-tvb.simulator.models]]).
9 9  
10 -It provides sliders for setting:
11 +It provides **//sliders//** for setting:
11 11  
12 -*
13 +* (((
14 + The value of all parameters of the Model.
15 +)))
16 +* (((
17 + The extent of the axes.
18 +)))
19 +* (((
20 + A fixed value for the state-variables which aren't currently selected.
21 +)))
22 +* (((
23 + The noise strength, if a stochastic integrator is specified.
24 +)))
13 13  
14 -{{{ The value of all parameters of the Model.}}}
15 -*
26 +and **//dropdown lists//** for selecting:
16 16  
17 -{{{ The extent of the axes.}}}
18 -*
28 +* (((
29 + Which state-variables to show on each axis.
30 +)))
31 +* (((
32 + Which mode to show, if the Model has them.
33 +)))
19 19  
20 -{{{ A fixed value for the state-variables which aren't currently selected.}}}
21 -*
35 +Entering the coordinates in the X,Y Coordinate Boxes will generate a sample
36 +trajectory, originating from the coordinates entered.
22 22  
23 -{{{ The noise strength, if a stochastic integrator is specified.}}}
38 +== Inputs ==
24 24  
25 -and dropdown lists for selecting:
40 +Phase-Plane viewer will be represented in the beginning based on the parameters that it receives:
26 26  
27 -*
42 +* Model (Generic2dOscillator, Epileptor, Hopfield, etc.)
43 +* Integrator (HeunDeterministic, HeunStochastic, Identity, etc.)
28 28  
29 -{{{ Which state-variables to show on each axis.
45 +== Requirements and installation ==
46 +
47 +Before installing the tvb-widgets library containing the PhasePlane widget, the following python library and Jupyter extensions should be installed:
48 +
49 +* **Libraries:​​​​​**
50 +** ​​​​​​[[ipympl>>https://github.com/matplotlib/ipympl#installation]]
51 +* **Extensions:**
52 +
53 +(% class="box" %)
54 +(((
55 +jupyter labextension install @jupyter-widgets/jupyterlab-manager
56 +
57 +jupyter labextension install jupyter-matplotlib
58 +)))
59 +
60 +Then, to install the tvb-widgets library, just type:
61 +
62 +(% class="box" %)
63 +(((
64 +pip install tvb-widgets
65 +)))
66 +
67 +== API usage ==
68 +
69 +First, the correct matplotlib backend must be set, which enables the interaction with the PhasePlane widget, by running the following command:
70 +
71 +(% class="box" %)
72 +(((
73 +%matplotlib widget
74 +)))
75 +
76 +Then, the PhasePlaneWidget (from the tvb-widgets API), the package lab (from tvb simulator) and the display function should be imported:
77 +
78 +(% class="box" %)
79 +(((
80 +{{{from tvbwidgets.api import PhasePlaneWidget
81 +from tvb.simulator.lab import *
30 30  }}}
31 -*
32 32  
33 -{{{ Which mode to show, if the Model has them.}}}
84 +{{{from IPython.core.display_functions import display}}}
85 +)))
34 34  
87 +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.}}}
89 +(% class="box" %)
90 +(((
91 +{{{w = PhasePlaneWidget(model=models.Generic2dOscillator(),
92 + integrator=integrators.HeunDeterministic())}}}
93 +)))
94 +
95 +Finally, to display and interact with the PhasePlane widget, the **//get_widget//**// //method is used inside the //**display **//function:
96 +
97 +(% class="box" %)
98 +(((
99 +{{{display(w.get_widget(plot_size=(6,7)))
100 +}}}
101 +)))
102 +
103 +The outcome will be something like in the image bellow.
104 +You can explore the inputs in the TAB on the left, and click on the canvas in the right to select initial conditions for evaluating the Model equations from that point onward (no structural connectivity, as is the eq are solved for a single node, in isolation).
105 +
106 +[[image:Screenshot 2023-01-09 at 20.39.52.png||alt="PhasePlaneWidget" style="float:left"]]
107 +
108 +
109 +[[image:Screenshot 2023-01-09 at 20.42.00.png||alt="PhasePlaneDifferentModel" style="float:left"]]
Screenshot 2023-01-09 at 20.39.52.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.ldomide
Size
... ... @@ -1,0 +1,1 @@
1 +932.0 KB
Content
Screenshot 2023-01-09 at 20.42.00.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.ldomide
Size
... ... @@ -1,0 +1,1 @@
1 +703.9 KB
Content
Public

TVB Widgets