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

Target.has_calibration errors for instructions without properties #12525

Closed
wshanks opened this issue Jun 6, 2024 · 0 comments · Fixed by #12526
Closed

Target.has_calibration errors for instructions without properties #12525

wshanks opened this issue Jun 6, 2024 · 0 comments · Fixed by #12526
Labels
bug Something isn't working

Comments

@wshanks
Copy link
Contributor

wshanks commented Jun 6, 2024

Environment

  • Qiskit version: 1.1.0
  • Python version: 3.12
  • Operating system: Fedora Linux 40

What is happening?

If a Target has an Instruction with None for its InstructionProperties, Target.has_calibration raises an AttributeError.

How can we reproduce the issue?

Consider this case from the Target docstring with the has_calibration call added at the end:

from qiskit.circuit.library import CXGate
from qiskit.transpiler import Target, InstructionProperties

target = Target()
cx_properties = {
    (0, 1): None,
    (1, 0): None,
    (0, 2): None,
    (2, 0): None,
    (0, 3): None,
    (2, 3): None,
    (3, 0): None,
    (3, 2): None
}
target.add_instruction(CXGate(), cx_properties)

target.has_calibration("cx", (0, 1))  # AttributeError!

What should happen?

The last line above should return False

Any suggestions?

I will submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant