watermarkhu / qsurface

Python package for simulation and visualization of quantum error-correction on surface codes. The package provides the ability to inspect the error-correcting code during the decoding process, and tools to benchmark the decoder.
https://qsurface.readthedocs.io/en/latest
BSD 3-Clause "New" or "Revised" License
60 stars 25 forks source link

Inquiry on plots for unionfind decoder #37

Open mkangquantum opened 2 years ago

mkangquantum commented 2 years ago

Hi, first or all, thank you for making this amazing repo. I really like the plotting feature that allows me to understand what is happening. I have three issues/questions, and I would really appreciate if you could solve these, especially the first one.

1. Plotting unionfind decoder

I'm running the following in jupyter notebook.

%matplotlib qt from qsurface.main import initialize, run code, decoder = initialize((5,5), "toric", "unionfind", enabled_errors=["pauli"], plotting=True, initial_states=(0,0)) run(code, decoder, error_rates = {"p_bitflip": 0.05, "p_phaseflip": 0.05}, decode_initial=False)

For the first three plots (initialization, error applied, ancilla qubits measured, everything is fine. But when I hit next, another window pops up, and the grid doesn't show anymore. It looks like this: Capture

Could you please solve this, so that the grid shows up, just like when I use the mwpm decoder?

  1. Warning when I press "previous" in interactive plot

I have the following message: Traceback (most recent call last): File "C:\Users\lg\anaconda3\lib\site-packages\matplotlib\cbook__init.py", line 270, in process func(*args, kwargs) File "C:\Users\lg\anaconda3\lib\site-packages\matplotlib\widgets.py", line 225, in return self._observers.connect('clicked', lambda event: func(event)) File "C:\Users\lg\anaconda3\lib\site-packages\qsurface\plot.py", line 695, in _draw_prev return self._draw_from_history(self.history_iter > 1, -1, kwargs) File "C:\Users\lg\anaconda3\lib\site-packages\qsurface\plot.py", line 682, in _draw_from_history self.draw_figure(**kwargs) File "C:\Users\lg\anaconda3\lib\site-packages\qsurface\plot.py", line 648, in draw_figure self.focus() File "C:\Users\lg\anaconda3\lib\site-packages\qsurface\plot.py", line 471, in focus output = self.blocking_input(self.params.blocking_wait) File "C:\Users\lg\anaconda3\lib\site-packages\qsurface\plot.py", line 159, in call return super().call__(n=1, timeout=timeout) File "C:\Users\lg\anaconda3\lib\site-packages\matplotlib\blocking_input.py", line 93, in call self.fig.canvas.start_event_loop(timeout=timeout) File "C:\Users\lg\anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 424, in start_event_loop raise RuntimeError("Event loop already running") RuntimeError: Event loop already running

  1. Question: What is info / bitflip / phaseflip in this image? image

Again, I really appreciate this repo, and I hope you reply!