Skip to content

Fixing sinter post-selection feature#1002

Open
shohamjac wants to merge 2 commits intoquantumlib:mainfrom
shohamjac:sinter-postselection-fix
Open

Fixing sinter post-selection feature#1002
shohamjac wants to merge 2 commits intoquantumlib:mainfrom
shohamjac:sinter-postselection-fix

Conversation

@shohamjac
Copy link
Contributor

Starting from sinter 1.14 sinter.collect with postselection is raising the following error:

ValueError: predictions.shape[0] != num_shots

An example can be seen here.

I have fixed the assertion (predictions.shape[0] != num_shots - num_discards_1) and added a post-selection test test_collect_postselection.

@shohamjac
Copy link
Contributor Author

Hi Craig, I think the failed test is due to the new python version which you already fixed. is there a reason not to merge this?

@Strilanc

@@ -1,4 +1,5 @@
import collections
from importlib.metadata import metadata
Copy link
Contributor

Choose a reason for hiding this comment

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

is this used anywhere?

assert 1 <= d[0.04].errors <= 100

def test_collect_postselection():
def postselect_all_detectors_predicate(index: int, metadata: any, coords: tuple) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def postselect_all_detectors_predicate(index: int, metadata: any, coords: tuple) -> bool:
def postselect_all_detectors_predicate(_index: int, _metadata: any, _coords: tuple) -> bool:

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