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

Floating point used as pandas index for error probability #25

Closed Lolcroc closed 4 years ago

Lolcroc commented 4 years ago

Steps to reproduce

  1. python run_threshold.py uf toric 1000 -l 8 10 12 -p 0.09 0.10 0.11 (directly from README)
  2. python run_threshold.py uf toric 1000 -l 8 9 10 12 -p 0.09 0.10 0.11

Issues

  1. toric_graph_2D_uf_.csv contains seemingly duplicate rows where the p index is the same, i.e.

L,p,N,succes 8,0.09,1000.0,816.0 8,0.09,2000.0,1588.0 8,0.1,1000.0,732.0 8,0.1,2000.0,1470.0 8,0.11,1000.0,627.0 8,0.11,2000.0,1272.0 10,0.09,0.0,0.0 10,0.09,1000.0,795.0 10,0.1,0.0,0.0 10,0.1,1000.0,710.0 10,0.11,0.0,0.0 10,0.11,1000.0,659.0 12,0.09,0.0,0.0 12,0.09,1000.0,819.0 12,0.1,0.0,0.0 12,0.1,1000.0,721.0 12,0.11,0.0,0.0 12,0.11,1000.0,638.0

  1. Exception: cannot handle a non-unique multi-index!

This is because sim.py appends decoder data to a pandas MultiIndex through a floating point, introducing slight variations depending on how this value is read.

Proposed solution Write the p column as data, not as an index. Replace with labels that can be uniquely defined, e.g. integers.

watermarkhu commented 4 years ago

Thanks! I'll make sure to resolve this in the next release.

watermarkhu commented 4 years ago

Solved in #26