devctrl.utility.monitor.Monitor#
- class Monitor(xlabel: str, datas: list[dict], max_points_shown=None, use_print=False)[source]#
Bases:
objectLive 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 new values to be averaged on the monitor.
Process events.
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 current plotted data with new data :param xdata: New xdata :param ydatas: New ydatas
Clear the plot data.
Append a single point to the plot :param xval: x value to append :param yvals: y values to append
Append data to the plot in x-direction :param xdata: xdata to append to old xdata :param ydatas: ydatas to append to old ydatas
- __annotations__ = {}#
- __dict__ = mappingproxy({'__module__': 'devctrl.utility.monitor', '__firstlineno__': 5, '__doc__': '\nLive data monitoring through matplotlib.\nPlot has multiple rows in a single column, all plots share the same x-axis\n', '__init__': <function Monitor.__init__>, 'set_ax_title': <function Monitor.set_ax_title>, 'set_fig_title': <function Monitor.set_fig_title>, 'reset': <function Monitor.reset>, 'override': <function Monitor.override>, 'update': <function Monitor.update>, 'update_array': <function Monitor.update_array>, 'replace_data': <function Monitor.replace_data>, 'add_average': <function Monitor.add_average>, '_post_update': <function Monitor._post_update>, 'idle': <function Monitor.idle>, '__del__': <function Monitor.__del__>, '__static_attributes__': ('ax', 'fig1', 'index', 'lines', 'max_points_shown', 'n_avg', 'options', 'use_print', 'xdata', 'ydatas'), '__dict__': <attribute '__dict__' of 'Monitor' objects>, '__weakref__': <attribute '__weakref__' of 'Monitor' objects>, '__annotations__': {}})#
- __firstlineno__ = 5#
- __init__(xlabel: str, datas: list[dict], max_points_shown=None, use_print=False)[source]#
- 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
- __module__ = 'devctrl.utility.monitor'#
- __static_attributes__ = ('ax', 'fig1', 'index', 'lines', 'max_points_shown', 'n_avg', 'options', 'use_print', 'xdata', 'ydatas')#
- __weakref__#
list of weak references to the object
- _post_update()[source]#
Update the plot after data was changed. Calculates new limits and sets the view.
- 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