Skip to content
John Holt edited this page Jan 22, 2020 · 8 revisions

Background Block Graph

The background block graph creates a single graph which plots the setpoint and value of a block in a background thread. The plot will be cleared when a new run is started. It is intended to be added to the init in an instrument script so that it starts when a new scripting window is started. For example in init_emu.py:

import sys
import os

sys.path.insert(0, os.path.abspath(os.path.join(r"C:\\", "Instrument", "scripts")))

from genie_python import genie as g
from technique.muon.background_plot import BackgroundBlockPlot

def init(inst):
    background_plot=BackgroundBlockPlot("Sample_Temperature", "Temperature").start()

... 

Features

  • Plot contains line plots of temperature against time for a blocks setpoint and value
  • Invalid or disconnected PV points 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 screen ever 300s
  • If a plot is already written then a new plot will not be created (even from a different client)

Known Bugs:

  • If more than 6 other plots are created then this plot will disappear from the

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
Clone this wiki locally