Srsgui
: Organize your instrument-controlling Python scripts as a GUI application
Srsgui
is a simple framework:
To define instrument classes for instruments that use remote communication, based on
Instrument
class and the communicationInterface
class.To write Python scripts (tasks) that run in GUI environment with APIs provided in
Task
class.To organize instrument classes and task scripts presented in a GUI application using a configuration (.taskconfig) file for a project
Srsgui
provides the following I/O functionality to a task:
Python logging output to the console window and a log file
print function redirected to the console window
Text streaming to multiple windows
Terminal from which you can control and query interactively all the instrument defined in the configuration file
Real-time updating, non-blocking, multiple matplotlib figures that can include multiple axes
Interactively changeable input parameters fed into a running task
Qt’s dockable widgets makes layout flexible( before and after)
Dedicated output data file generated for each run of a task
Here is a screen shot of srsgui
running with the example project
included in the srsgui
package.
From the Example project directory, you can see
how many lines of code you need to write to get srsgui
working for control and data acquisition
from a couple of arbitrary instruments and data visualization for a small task.
5 lines of code for CG635 to control its output frequency (if not count comment lines);
40 lines to capture waveforms from an oscilloscope (it has a method to download a waveform from the oscilloscope);
100 lines in the CapturedFFT example to check if set frequency changed from the input panel, set a new frequency if changed, capture a new waveform of 700000 points, calculate FFT of the waveform and plot them every 0.2 second;
8 line in the configuration file to put all together.
If you want to implement a well-defined single operation, it will be as simple as this. Well, it is mostly thanks to conciseness of Python code and its rich libraries, though.
When you implement many tasks handling multiple operations along with larger sets of
remote commands for multiple instruments, srsgui
also provides more ways to
organize your code.
Here are more information on how to use srsgui
.