File: examples-misc_remotecontrolclient.txt

package info (click to toggle)
brian 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, stretch
  • size: 23,436 kB
  • sloc: python: 68,707; cpp: 29,040; ansic: 5,182; sh: 111; makefile: 61
file content (43 lines) | stat: -rw-r--r-- 854 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
.. currentmodule:: brian

.. index::
   pair: example usage; subplot
   pair: example usage; plot
   pair: example usage; RemoteControlClient
   pair: example usage; stop
   pair: example usage; show

.. _example-misc_remotecontrolclient:

Example: remotecontrolclient (misc)
===================================

Example of using :class:`RemoteControlServer` and :class:`RemoteControlClient`
to control a simulation as it runs in Brian.

Run the script remotecontrolserver.py before running this.

::

    from brian import *
    import time
    
    client = RemoteControlClient()
    
    time.sleep(1)
    
    subplot(121)
    plot(*client.evaluate('(M.times, M.values)'))
    
    client.execute('G.I = 1.1')
    
    time.sleep(1)
    
    subplot(122)
    plot(*client.evaluate('(M.times, M.values)'))
    
    client.stop()
    
    show()