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

Can't print the ResultDict of an array with 2 values #6447

Closed
vtomole opened this issue Feb 7, 2024 · 1 comment · Fixed by #6468
Closed

Can't print the ResultDict of an array with 2 values #6447

vtomole opened this issue Feb 7, 2024 · 1 comment · Fixed by #6468
Assignees
Labels
area/result triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on

Comments

@vtomole
Copy link
Collaborator

vtomole commented Feb 7, 2024

Description of the issue
cirq.ResultDict(records={'c': np.array([[[True], [True]]])}) can be created but it can't be printed .

How to reproduce the issue

import cirq
import numpy as np
result = cirq.ResultDict(records={'c': np.array([[[True], [True]]])})
print(result)

Will throw
ValueError: Cannot extract 2D measurements for repeated keys

Cirq version
1.4.0.dev20240126200039

@vtomole vtomole added triage/discuss Needs decision / discussion, bring these up during Cirq Cynque area/result labels Feb 7, 2024
@verult verult added triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on and removed triage/discuss Needs decision / discussion, bring these up during Cirq Cynque labels Feb 14, 2024
@NoureldinYosri
Copy link
Collaborator

NoureldinYosri commented Feb 14, 2024

cirq-cync: needs to invistigate whether the input is valid (and add input validation) and if it's find out the bug in printing.


update: the bug is in the __str__ and __repr__ which use measurements instead of records.

@verult verult added status/needs-agreed-design We want to do this, but it needs an agreed upon design before implementation and removed status/needs-agreed-design We want to do this, but it needs an agreed upon design before implementation labels Feb 14, 2024
dstrain115 added a commit to dstrain115/Cirq-1 that referenced this issue Feb 16, 2024
- ResultDict will now print out repeated measurements on each
line, as opposed to throwing ValueError

Fixes: quantumlib#6447
dstrain115 added a commit that referenced this issue Feb 16, 2024
- ResultDict will now print out repeated measurements on each
line, as opposed to throwing ValueError

Fixes: #6447
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this issue Oct 31, 2024
…ib#6468)

- ResultDict will now print out repeated measurements on each
line, as opposed to throwing ValueError

Fixes: quantumlib#6447
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/result triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants