DataLab remote control example#

Example of remote control of DataLab current session, from a simple notebook, using the SimpleRemoteProxy class provided in the sigima.client module.

The only requirement is to install the Sigima package (using pip install sigima, for example).

import numpy as np
from sigima.client import SimpleRemoteProxy
proxy = SimpleRemoteProxy()

Connecting to DataLab current session:

proxy.connect()
Connecting to DataLab XML-RPC server...OK (port: 62547)

Executing commands in DataLab:

z = np.random.rand(20, 20)
proxy.add_image("toto", z)
True
x = np.array([1.0, 2.0, 3.0])
y = np.array([4.0, 5.0, -1.0])
proxy.add_signal("toto", x, y)
True
proxy.calc("derivative")
True
proxy.set_current_panel("image")
proxy.calc("fft")
True