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

Cast ParameterExpression to float in RZXBuilder and RZXCalibrationBuilderNoEcho #8965

Merged
merged 8 commits into from
Oct 25, 2022
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