This tutorial briefly explains how pyGSTi visualizes data using
Workspace objects. Understanding the basics covered here will help demystify the creation of plots and tables in other tutorials.
Figureobjects, which are difficult even to pickle with Python.
The creation of (HTML) figures, both tables and plots, is handled by the
pygsti.report.Workspace factory object.
import pygsti ws = pygsti.report.Workspace()
Within an IPython notebook like this one, we can create figures in notebook cells by calling (once, usually at the beginning of the notebook):
autodisplay=True means that figures will be displayed as soon as they're created (otherwise we'd have to capture the returned object and call
.display() on it). By typing
ws. and then hitting TAB you can see the somewhat-descriptive names of the figures that can be created. Here are a few examples (for more, see the Workspace examples tutorial):
import numpy as np ws.MatrixPlot( np.array([[1,2],[3,4]],'d'), color_min=0, color_max=4 )
from pygsti.modelpacks import smq1Q_XYI ws.GatesTable( smq1Q_XYI.target_model() )
Thats covers the basics! The Workspace examples tutorial shows a gallery of many of the tables and plots a
Workspace can create, and the Workspace switchboard tutorial shows how to integrate workspace figures with switches (dropdown boxes, buttons, and sliders).
Workspace objects are used internally when generating HTML reports. The report generation tutorial demonstrates how the automated use of a
Workspace can lead to a standalone HTML report.