devctrl.utility.monitor.Monitor#

class Monitor(xlabel: str, datas: list[dict], max_points_shown=None, use_print=False)[source]#

Bases: object

Live data monitoring through matplotlib. Plot has multiple rows in a single column, all plots share the same x-axis

Parameters:
  • xlabel

  • datas – A list dictionaries describing the of y-axis/plots: - ax: The plot to plot the data in starting from 0 at the top - ylabel: - lim: the y limits (min, max) or None - color: line color - grid: True/False - label: label for a legend or None

  • max_points_shown – Number of x-points to keep in the plot or None to always show all points

  • use_print – Whether to print the new values to stdout when values are added

Methods

add_average

Add new values to be averaged on the monitor.

idle

Process events.

override

Replace the existing y data for the x-value :param xval: x value to replace the y-data for :param yvals: New y-values

replace_data

Replace current plotted data with new data :param xdata: New xdata :param ydatas: New ydatas

reset

Clear the plot data.

set_ax_title

set_fig_title

update

Append a single point to the plot :param xval: x value to append :param yvals: y values to append

update_array

Append data to the plot in x-direction :param xdata: xdata to append to old xdata :param ydatas: ydatas to append to old ydatas

add_average(xdata, *ydatas)[source]#

Add new values to be averaged on the monitor. The shape must match previous calls to add_average().

Parameters:
  • xdata – xdata, must have correct shape, but values are taken from the first call only

  • ydatas – list of y datas, must have same shape as previous ydatas

idle()[source]#

Process events. Must be called periodically to handle interactions in the plot window, like zoom.

override(xval, *yvals)[source]#

Replace the existing y data for the x-value :param xval: x value to replace the y-data for :param yvals: New y-values

replace_data(xdata, *ydatas)[source]#

Replace current plotted data with new data :param xdata: New xdata :param ydatas: New ydatas

reset()[source]#

Clear the plot data. Does not update the plot.

update(xval, *yvals)[source]#

Append a single point to the plot :param xval: x value to append :param yvals: y values to append

update_array(xdata, *ydatas)[source]#

Append data to the plot in x-direction :param xdata: xdata to append to old xdata :param ydatas: ydatas to append to old ydatas