Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyGSTi fails to generate plots without X #1

Closed
marcusps opened this issue Feb 25, 2016 · 2 comments
Closed

pyGSTi fails to generate plots without X #1

marcusps opened this issue Feb 25, 2016 · 2 comments

Comments

@marcusps
Copy link

See error messages in the attached (as PNG and zipped Jupyter notebook). This happens in the 00 Quick and easy GST.ipynb file included with pyGSTi.

It seems to indicate that using the default configuration, matplotlib will try to use the QtAgg backend to plot, but then it can't plot because there is no DISPLAY variable set (X is not running).

This error can be reproduced by using a docker image built from BBN-Q/pygsti-docker (so it runs on Ubuntu 14.04, and all python library dependencies are explicitly listed there).

display-error

00 Quick and easy GST MPS.ipynb.zip

@marcusps
Copy link
Author

A simple work around is to add

import matplotlib
matplotlib.use('Agg')

at the top of the notebook and restart the kernel.

I am not sure how this interacts with inline plots, though.

enielse pushed a commit that referenced this issue Oct 14, 2016
In light of proper RB protocol needing to keep data from duplicate
gate sequences separate, a new argument 'collisionAction' has been
added to the constructor of DataSet (and MultiDataSet) objects.
By default it is set to "aggregate" which causes the add-data
functions of DataSet to add the supplied data to an existing gate
sequence, which has been the only behavior thus far.  Now, by
setting 'collisionAction' to "keepseparate" the DataSet's add-data
methods will append a "#<number>" gate label to the end of
existing gate sequences (starting with <number> == "1" and going up)
and thereby store the data separately.  To access the data, one
may query the gate string + "#1", for example, or use the new
'get_row' and 'set_row' methods which take the optional integer
argument "occurance" which defaults to 0.  Machinery to track
and preserve the collisionAction of DataSets within a
MultiDataSet has also been added, though it may not be needed
much since MultiDataSets store *static* DataSets.  Thus, it
only comes into play when you make a non-static copy of one
of the data sets stored within a MultiDataSet.

This update also adds 'collisionAction' arguments to io's
load_dataset and load_multidataset, as well as to
generate_fake_data.

Furthermore, the RB functionality has been updated to make
proper use of collisionAction, so that do_randomized_benchmarking
expects a DataSet with collisionAction == "keepseparate" (or with
no duplicated clifford sequences).  The tutorial notebook has
been updated to generate a fake data set accordingly.
@enielse
Copy link
Collaborator

enielse commented Mar 9, 2018

Just to follow up, I think we've addressed this issue in a somewhat roundabout way in that as of pyGSTi version 0.9.4 we don't use matplotlib (nor X) to generate report plots by default. There is still, however the option of generating PDF-format reports which still use matplotlib, and if one does this in a notebook the workaround suggested by Marcus above is the best and only thing I know to skirt the issue of Matplotlib's "inline" backend" not being able to write PDFs.

So in summary:

  • with pyGSTi 0.9.4 and later you probably won't run into a RuntimeError: Invalid DISPLAY variable issue.
  • but if you do, adding
import matplotlib
matplotlib.use('Agg')

to the beginning of your notebook should fix the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants