Live plotting

A live plot item that subscribes to data streams and keeps updating, together with its widget container.

Overview

quatm/GUI/entries/updating_plot.py provides live plotting: UpdatingPlot is a PlotItem subclass that subscribes to a data stream, periodically pulls new data and refreshes the curve; LivePlot is a widget container that embeds one UpdatingPlot, which makes it easy to dock into other windows as a panel.

Components

ComponentDescription
UpdatingPlotLive plot item: subscribes to a data stream and keeps the curve updated
LivePlotWidget container: embeds one UpdatingPlot and may carry an image stream name

Key methods (UpdatingPlot)

MethodDescription
setnewDataPeriodically pulls new data; a one-dimensional array gets an x axis automatically, then the curve is updated according to the rotation flag
updateConfigurationCancels the old subscriptions, then resubscribes and rebuilds the curves from the stream list configured in the properties
subscribe_windowOpens the subscription editor to select data streams and reapplies the subscription configuration on close
configureWindowOpens the property editor dialog to adjust settings and reapply the display configuration

Usage

from quatm.GUI.entries.updating_plot import UpdatingPlot, LivePlot

plot = UpdatingPlot(name="PMT signal")        # use directly as a plot item
host = LivePlot(name="PMT signal", parent=parent)  # or embed as a container in the UI

Subscriptions are made in the context menu of the plot item; LivePlot is also used as the container for the row/column profile plots in the image viewer.