Repository navigation
Support multiple logical observables and error decomposition in qec_memory decoding - #501
eliottrosenberg wants to merge 4 commits into
Conversation
mhucka
left a comment
There was a problem hiding this comment.
Thanks for working on this. Some comments follow.
mhucka
left a comment
There was a problem hiding this comment.
Thanks for the update! We're almost there :-)
In addition to the minor items noted in the individual comments, can you also please update the PR description? It still says only that "Updates get_logical_error_probability to support multiple logical observables." It would be appropriate to also mention:
- the new keyword-only arguments
per_observableanddecompose_errors - the return type is now
float | np.ndarray - zero observables now raises ValueError, and more than one is no longer rejected (previously NotImplementedError)
(This matters because a squash merge uses the PR description as the commit message.)
There was a problem hiding this comment.
Can you also add an assertion with per_observable=True in test_get_logical_error_probability involving 1 observable, to verify that it returns a 1D np.ndarray of shape (1,) rather than squeezing to a scalar?
| ) | ||
| assert isinstance(joint_lep, float) | ||
| assert per_obs_lep.shape == (2,) | ||
| assert np.max(per_obs_lep) <= joint_lep <= np.sum(per_obs_lep) |
There was a problem hiding this comment.
Won't this last test succeed for any Boolean matrix? If so, it would pass even if something went wrong with the preceding calculations.
| Args: | ||
| hardware_stim_circuit: The circuit that was run on hardware, converted to a stim circuit. | ||
| si_1000_error_rate: The parameter p in stimflow.NoiseModel.si1000. | ||
| decompose_errors: Whether to decompose errors into graphlike components. |
There was a problem hiding this comment.
It may be useful to add an explanation of why this matters, and what values to use in what circumstances. Something that brings up the fact that PyMatching ignores error mechanisms with more than two detection events unless they are decomposed, so True would be appropriate for surface codes.
There was a problem hiding this comment.
Also, the 13-item keys list now appears three times in this file. It would be a good idea to make it into a module-level constant to remove the copies and make it clear that they are all meant to be the same.
Updates
get_logical_error_probabilityto support multiple logical observables.