Skip to content
mihai-stfc edited this page Jan 14, 2021 · 8 revisions

Wiki > Technique Specific Scripts > Muon

Background Block Graph

The background block graph creates a single graph which plots multiple blocks. The plot will be cleared when a new run is started. It is intended to be added to the background script run from the background script ioc.

Features

  • Plot contains multiple line plots of a blocks value against time
    • values are taken at a regular interval (not when they change)
  • Invalid or disconnected PV values will not be plotted
    • currently this is indicated by a break in the line
  • Plot will clear when new run is begun
  • Plot will indicate if no data can be plotted on start
    • currently writes a message to the screen every 300s
  • If a plot is already written then a new plot will not be created (even from a different client)

Extension Points

The design has tried to keep the graph plotting, data recording and block specific functionality separate so that extension can be made. Many public methods are available that can be overridden to provide new functionality. These methods are:

  • set_up_plot: Initially create the plot
  • update: Is called each time the plot is updated, default will check if it should clear the plot or update the data
  • update_data: Update all data each time the plot is updated
  • update_figure: Update the figure each time the plot is updated
  • get_data_point: Return the current data point. An iterable with the time value first followed by data point(s)
  • get_data_set_labels: tuple of labels for the data legend
  • should_clear_plot: Return True if the plot should be cleared this update
  • clear_plot: Perform the clearing of the plot

File format

The file format is defined in the overloadable start_new_data_file method. For BackgroundBlockPlot example, the file starts with a header. The header lines are denoted with a # comment character, and contain the run number and axis labels supplied on class instantiation.

The data is then saved in a CSV format, with the first column being a timestamp in ISO formatting. Subsequent columns then contain the axis data which has been plotted.

Clone this wiki locally