User Interface
This is a collection of modules concerned with visualizing and interacting with experiments and data.
cohesivm.data_stream
This module contains the classes which handle the data stream from measurement methods.
- class DataStream[source]
Bases:
ABCCreates a
multiprocessing.Queueobject which is used to stream data from aMeasurement. A child class implements the methods for pulling the data from the queue and processing it.- property data_stream: Queue
The
multiprocessing.Queueobject, where data is streamed to. Must be injected into theMeasurementor theExperiment.
- class FakeQueue[source]
Bases:
objectMimics the
multiprocessing.Queueand can be used as default value for methods which implement an optional data stream. Simplifies the methods because they do not have to care if the queue is actually present and also prevents unnecessary data accumulation.
cohesivm.plots
This module contains plot classes which are used to (interactively) display the measurement progress and results.
- class Plot[source]
Bases:
ABCThis class serves as a blueprint for creating various plot types using Matplotlib. It ensures that derived classes implement methods for creating, updating, and clearing plots, and provides mechanisms for checking data compatibility.
- property figure: Figure | None
The
matplotlib.figure.Figureobject which is populated with the data.
- abstract make_plot() None[source]
Generates the canvas of the plot and populates the static elements.
- abstract clear_plot() None[source]
Restores the plot to its initial state and removes all displayed data.
- class XYPlot(figsize: Tuple[float, float] = (7, 5.5), origin: bool = True)[source]
Bases:
PlotGenerates and updates a two-dimensional x-y-plot.
- Parameters:
figsize – Size of the figure in inch (see
matplotlib.figure.Figure).origin – Flag if the origin (0, 0) should be displayed by a vertical and a horizontal line.
cohesivm.gui
- class DataStreamPlot[source]
Bases:
DataStream,PlotA
multiprocessing.Queueobject which is used to stream data from aMeasurementto abqplot.Figureobject where the streamed data is put into. A child class implements the methods for updating the data and the figure. Its intended use is within theExperimentGUI.- abstract update_plot() None[source]
Fetches the data from the
data_streamand puts it in the figure.
- class XYDataStreamPlot(x_label: str, y_label: str, figsize: Tuple[float, float] = (7, 5.5))[source]
Bases:
DataStreamPlotGenerates and updates a two-dimensional x-y-plot with the data which is put in the
data_streamqueue.- Parameters:
x_label – Label of the x-axis.
y_label – Label of the y-axis.
figsize – Size of the figure in inch (see
matplotlib.figure.Figure).
- property figure: Figure | None
The
bqplot.Figureobject which is populated with the data.
- update_plot() None[source]
Fetches the data from the
data_streamand puts it in the figure.
- class ExperimentGUI(*args, **kwargs)[source]
Bases:
_InterfacePlotGUIA graphical user interface for monitoring and controlling an experiment within a Jupyter Notebook.
- Parameters:
experiment – The
Experimentwhich should be monitored.plot – A
DataStreamPlotobject which is compatible with theexperiment.
- class AnalysisGUI(analysis: Analysis)[source]
Bases:
_InterfacePlotGUIA graphical user interface for plotting measurement data and displaying analysis results within a Jupyter Notebook.
- Parameters:
analysis – An
Analysisobject which should be displayed.