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

Fix exception when sampling with post-selection #844

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cesarBLG
Copy link

Calling sinter.collect() for tasks including a postselection_mask raises an exception. This is caused because the decoder predictions are compared to the total number of shots without excluding discarded shots.

@Strilanc
Copy link
Collaborator

Could you add a unit test verifying this? I'm surprised it didn't trip existing unit tests to be honest; definitely something that should be tested.

Copy link
Collaborator

@Strilanc Strilanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a unit test with a postselected task that used to fail but now passes.

Something like taking 1 shot from

X_ERROR(1) 0
M 0
DETECTOR rec[-1]

@cesarBLG
Copy link
Author

I added a unit test as suggested.

The reason it didn't trip any test is that circuits in _decoding_test.py are sampled using _sample_decode_helper_using_memory. The post-selection code in that function is not shared with the one in _CompiledStimThenDecodeSampler, so essentially the latter code isn't covered by any test.

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

Successfully merging this pull request may close these issues.

2 participants