Exchanging Data between INTViewer and Enthought

This script will demonstrate how to send data from INTViewer to an Enthought Python Interpreter using an execnet bridge.

In this demo, we capture the first trace from a dataset selected by the end-user. The sample values of this trace are first sent to Enthought's Python interpreter. Enthought's Python interpreter then displays a histogram based upon the sample values received, does a DC removal and finally sends the modified samples values back to INTViewer's Python interpreter.

In this implementation, samples values are sent across interpreters as Lists. Arrays should not be sent across an execnet bridge because of compatibilities issues between different Python interpreters.

Note: See this link for more information on setting up this process and be sure to have the startserver.py and connectserver.py scripts.

Download the enthoughtIntDemo.py and BarPlotDemo.py Python script file at the bottom of this page.

Set up the demo

We assume in this demo that the two script files enthoughtIntDemo.py and BarPlotDemo.py are stored in C:\MyScripts along with the other scripts. The enthoughtIntDemo.py script is configured with C:\MyScripts as the location of the BarPlotDemo.py script.

To run this demo on Linux, open the enthoughtIntDemo.py file in any basic text editor and change 'C:\MyScripts' to your own '/Path/To/Scripts'.

Execute the demo

Launch the demo by typing execfile("C:\MyScripts\enthoughtIntDemo.py") after launching a server. The following histogram should appear (it might be behind INTViewer's desktop)

After closing the histogram window, the following output should be displayed in the "Python Terminal" window in INTViewer:

Running Scripts

It is also possible to run other scripts through the bridge using a script such as:

  • subprocess.call([sys.executable, 'C:\MyScripts\BarPlotDemo.py'])

You must import sys and subprocess in order to call that method within remote execution.

The preferred process is to create separate classes such as BarPlotDemo.py and call them within remote execution as shown in enthoughtIntDemo.py.