Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

marginal_counts() raises TypeError when meas_qubits is default #399

Closed
ryan-woo opened this issue Apr 28, 2020 · 0 comments · Fixed by #409
Closed

marginal_counts() raises TypeError when meas_qubits is default #399

ryan-woo opened this issue Apr 28, 2020 · 0 comments · Fixed by #409
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ryan-woo
Copy link

Informations

  • Qiskit Ignis version: 0.3.0
  • Python version: 3.6.4
  • Operating system: MacOS

What is the current behavior?

When using the marginal_counts() function in qiskit.ignis.verification.marginal_counts() with default meas_qubits=True, then the function raises a TypeError here.

https://github.com/Qiskit/qiskit-ignis/blob/master/qiskit/ignis/verification/tomography/data.py#L60

Steps to reproduce the problem

>>> marginal_counts(counts)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/rwoo/rwoo/lib/python3.6/site-packages/qiskit/ignis/verification/tomography/data.py", line 60, in marginal_counts
    if num_qubits == len(meas_qubits) or (meas_qubits is True):
TypeError: object of type 'bool' has no len()

What is the expected behavior?

marginal_counts() returns all of the counts trimmed of any whitespace.

Suggested solutions

Reorder the if condition to check that meas_qubits == True before trying to do list operations on it.

@ryan-woo ryan-woo added the bug Something isn't working label Apr 28, 2020
@chriseclectic chriseclectic added this to the 0.3.1 milestone May 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants