Skip to content

Commit

Permalink
Cast ParameterExpression to float in RZXBuilder and RZXCalibrationBui…
Browse files Browse the repository at this point in the history
…lderNoEcho (Qiskit#8965)

* committing changes but still debugging

* commiting to check necessary changes

* added explicit casting to get_calibration in rzx_builder.py in two places

* found a linting error in alap.py

* Remove redundant float cast

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
  • Loading branch information
nbronn and mtreinish authored Oct 25, 2022
1 parent 799caa7 commit de8e4dd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions qiskit/transpiler/passes/calibration/rzx_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,17 @@ def get_calibration(self, node_op: CircuitInst, qubits: List) -> Union[Schedule,
schedule: The calibration schedule for the RZXGate(theta).
Raises:
QiskitError: if rotation angle is not assigned.
QiskitError: If the control and target qubits cannot be identified.
CalibrationNotAvailable: RZX schedule cannot be built for input node.
"""
theta = node_op.params[0]

try:
theta = float(theta)
except TypeError as ex:
raise QiskitError("Target rotation angle is not assigned.") from ex

rzx_theta = Schedule(name="rzx(%.3f)" % theta)
rzx_theta.metadata["publisher"] = CalibrationPublisher.QISKIT

Expand Down Expand Up @@ -275,12 +281,18 @@ def get_calibration(self, node_op: CircuitInst, qubits: List) -> Union[Schedule,
schedule: The calibration schedule for the RZXGate(theta).
Raises:
QiskitError: if rotation angle is not assigned.
QiskitError: If the control and target qubits cannot be identified,
or the backend does not natively support the specified direction of the cx.
CalibrationNotAvailable: RZX schedule cannot be built for input node.
"""
theta = node_op.params[0]

try:
theta = float(theta)
except TypeError as ex:
raise QiskitError("Target rotation angle is not assigned.") from ex

rzx_theta = Schedule(name="rzx(%.3f)" % theta)
rzx_theta.metadata["publisher"] = CalibrationPublisher.QISKIT

Expand Down

0 comments on commit de8e4dd

Please sign in to comment.