Live scroll plot
Live scrolling plots: ring buffers, running averages and data-stream subscription.
Overview
quatm/GUI/entries/live_plot.py provides live scrolling plots: ScrollWindow is a
multi-subplot main window in which each ScrollPlot subplot subscribes to several channels of
one data stream, maintains a ring buffer and scrolls scatter/curve data and a running average;
PlotDataEditor provides the data-source drop-down panel.
Components
| Component | Description |
|---|---|
ScrollWindow | Multi-subplot scrolling main window: restores or creates subplots from the properties; the toolbar can append subplots |
ScrollPlot | Scrolling subplot: ring buffer, scatter and running-average curves, context-menu operations |
PlotDataEditor | Data-source selection panel: drop-down candidates written back to the properties/parent plot |
Key methods (ScrollPlot)
| Method | Description |
|---|---|
feedData | Pushes a new data block into the buffer array |
setnewData | Periodically pulls new data into the buffer and refreshes the curves |
updatePlot | Flushes the valid data in the buffer to the scatter and running-average curves |
running_mean | Computes an N-point running average efficiently from cumulative sums and differences |
dataSelectDialog | Selects the data channels displayed in this plot |
subscribe_window | Opens the subscription editor to resubscribe the data stream |
configureWindow | Pauses refreshing and edits this plot’s properties inline |
deletePlot | Removes this plot from the parent window and clears its properties |
Usage
from quatm.GUI.entries.live_plot import ScrollWindow
host = ScrollWindow(name="PMT scroll monitor", parent=parent)
host.addPlot() # append a scrolling subplot
Afterwards, subscribe to data streams, select channels and adjust the display from the context menu of a subplot. Configurations such as the buffer length, the running-average switch and the window size are stored in the properties and restored automatically after a restart.