Cast ParameterExpression to float in RZXBuilder and RZXCalibrationBuilderNoEcho (#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>
This commit is contained in:
nick bronn 2022-10-25 15:10:58 -04:00 committed by GitHub
parent 799caa7ad9
commit de8e4dd836
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -164,11 +164,17 @@ class RZXCalibrationBuilder(CalibrationBuilder):
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
@ -275,12 +281,18 @@ class RZXCalibrationBuilderNoEcho(RZXCalibrationBuilder):
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