Archiver Appliance Enabled Time Plots
Time plots can be augmented with the ability to automatically request archived data from an instance of the EPICS archiver appliance if such an instance is available to the user.
In order to use this functionality, the environment variable PYDM_ARCHIVER_URL must be set to point to the archiver appliance instance. For example:
export PYDM_ARCHIVER_URL=http://lcls-archapp.slac.stanford.edu
These plots can then be created with python code, or using designer.
Creating in Designer
After setting the above environment variable, archiver time plots will then be able to be created in designer through the usual drag and drop flow. Upon opening designer, there will now be a plotting widget called PyDMArchiverTimePlot available for use. The channel connections can be created in the same way as a regular time plot, no need to preface anything with “archiver://”, the requests to archiver will happen automatically upon running the plot and panning the x-axis to the left, or zooming out.
One property that will be particularly useful to set is the timeSpan. This value (in seconds) will determine how much data to request from archiver upon plot initialization. For example, setting it to 600 will cause the plot to backfill with the last 10 minutes worth of data for the plotted values anytime the plot is opened. If more data is needed after starting up the plot, it can be requested as described below.

Plot Usage
Upon opening the plot, it will plot the requested amount of archived data. It will then behave like a regular time plot with live data being added to the plot. If more archived data would be useful, requests can be made by either panning the x-axis to the left, or zooming out on the entire plot. This will automatically generate a call to the archiver appliance that will add data to the plot once it is received.
Note that there is a property on the plot called bufferSize which determines how many data points can be displayed on the plot at once. If the request for archived data would return an amount greater than that buffer, it will convert to a request for optimized data which includes the average, min, and max of each data point returned. These will then be plotted as bars to show the full range of data represented by each point. As an example - with a buffer size of 365, a request for a year of data for a PV that updates every second would return roughly 365 points each of which will contain the min and max of that day’s data to plot the full range represented.

PyDMArchiverTimePlot
- class pydm.widgets.archiver_time_plot.PyDMArchiverTimePlot(parent: Optional[QObject] = None, init_y_channels: List[str] = [], background: str = 'default', optimized_data_bins: int = 2000)[source]
Bases:
PyDMTimePlot
PyDMArchiverTimePlot is a PyDMTimePlot with support for receiving data from the archiver appliance.
- Parameters:
parent (QObject, optional) – The parent of this widget.
init_y_channels (list) – A list of scalar channels to plot vs time.
background (str) – The background color for the plot. Accepts any arguments that pyqtgraph.mkColor will accept.
optimized_data_bins (int) – The number of bins of data returned from the archiver when using optimized requests
- archive_data_received()[source]
Take any action needed when this plot receives new data from archiver appliance
- createCurveItem(y_channel: str, plot_by_timestamps: bool, name: str, color: Union[QColor, str], yAxisName: str, useArchiveData: bool, **plot_opts) ArchivePlotCurveItem [source]
Create and return a curve item to be plotted
- curves
Dump and return the current list of curves and each curve’s settings into a list of JSON-formatted strings.
- getArchiveBufferSize() int [source]
Returns the size of the data buffer used to store archived data
- getCurves() List[str] [source]
Dump and return the current list of curves and each curve’s settings into a list of JSON-formatted strings.
- requestDataFromArchiver(min_x: Optional[float] = None, max_x: Optional[float] = None) None [source]
Make the request to the archiver appliance data plugin for archived data.
- Parameters:
min_x (float, optional) – Timestamp representing the start of the time period to fetch archive data from. Defaults to the minimum value visible on the plot when omitted.
max_x (float, optional) – Timestamp representing the end of the time period to fetch archive data from. Defaults to the timestamp of the oldest live data point in the buffer if available. If no live points are recorded yet, then defaults to the timestamp at which the plot was first rendered.
ArchivePlotCurveItem
- class pydm.widgets.archiver_time_plot.ArchivePlotCurveItem(channel_address: Optional[str] = None, use_archive_data: bool = True, **kws)[source]
Bases:
TimePlotCurveItem
ArchivePlotCurveItem is a TimePlotCurveItem with support for receiving data from the archiver appliance.
- Parameters:
channel_address (str) – The address to of the scalar data to plot. Will also be used to retrieve data from archiver appliance if requested.
use_archive_data (bool) – If True, requests will be made to archiver appliance for archived data when the plot is zoomed or scrolled to the left.
**kws (dict[str: any]) – Additional parameters supported by pyqtgraph.PlotDataItem.
- insert_archive_data(data: ndarray) None [source]
Inserts data directly into the archive buffer.
An example use case would be zooming into optimized mean-value data and replacing it with the raw data.
- Parameters:
data (np.ndarray) – A numpy array of shape (2, length_of_data). Index 0 contains timestamps and index 1 contains the data observations.
- receiveArchiveData(data: ndarray) None [source]
Receive data from archiver appliance and place it into the archive data buffer. Will overwrite any previously existing data at the indices written to.
- Parameters:
data (np.ndarray) – A numpy array of varying shape consisting of archived data for display. At a minimum, index 0 will contain the timestamps and index 1 the actual data observations. Additional indices may be used as well based on the type of request made to the archiver appliance. For example optimized data will include standard deviations, minimums, and maximums
- redrawCurve(min_x=None, max_x=None) None [source]
Redraw the curve with any new data added since the last draw call.
- resetArchiveBufferSize() None [source]
Reset the length of the archive buffer back to the default and zero it out
- setArchiveBufferSize(value: int) None [source]
Set the length of the archive data buffer and zero it out