From 40c42981e2ca4503899b9c17594ad7f70c0caa7c Mon Sep 17 00:00:00 2001 From: Tuukka Haapasalo Date: Thu, 21 Mar 2024 09:16:17 +0200 Subject: [PATCH] Update iqm-client to 17.1+ to support new architecture (#128) * Update iqm-client to 17.1+ to support new architecture * Update phased rx name to the new standard * Update CHANGELOG.rst --------- Co-authored-by: Tuukka Haapasalo Co-authored-by: Rakhim Davletkaliyev --- CHANGELOG.rst | 5 +++++ pyproject.toml | 2 +- src/iqm/cirq_iqm/devices/iqm_device_metadata.py | 2 ++ src/iqm/cirq_iqm/iqm_operation_mapping.py | 2 +- tests/test_iqm_device_metadata.py | 2 +- tests/test_iqm_operation_mapping.py | 2 +- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b5dad6d8..436163f3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,11 @@ Changelog ========= +Version 14.0 +============ + +* Require iqm-client >= 17.1. `#128 `_ + Version 13.2 ============ diff --git a/pyproject.toml b/pyproject.toml index 588f178d..0731cd38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ dependencies = [ "numpy", "cirq-core[contrib] ~= 1.2", "ply", # Required by cirq.contrib.qasm_import - "iqm-client >= 16.0, < 17.0" + "iqm-client >= 17.1, < 18.0" ] [project.urls] diff --git a/src/iqm/cirq_iqm/devices/iqm_device_metadata.py b/src/iqm/cirq_iqm/devices/iqm_device_metadata.py index 3d88ba31..984dfbc7 100644 --- a/src/iqm/cirq_iqm/devices/iqm_device_metadata.py +++ b/src/iqm/cirq_iqm/devices/iqm_device_metadata.py @@ -27,9 +27,11 @@ _IQM_CIRQ_OP_MAP: dict[str, tuple[Union[type[cirq.Gate], cirq.Gate, cirq.GateFamily], ...]] = { # XPow and YPow kept for convenience, Cirq does not know how to decompose them into PhasedX # so we would have to add those rules... + 'prx': (cirq.ops.PhasedXPowGate, cirq.ops.XPowGate, cirq.ops.YPowGate), 'phased_rx': (cirq.ops.PhasedXPowGate, cirq.ops.XPowGate, cirq.ops.YPowGate), 'cz': (cirq.ops.CZ,), 'measurement': (cirq.ops.MeasurementGate,), + 'measure': (cirq.ops.MeasurementGate,), 'barrier': (), } diff --git a/src/iqm/cirq_iqm/iqm_operation_mapping.py b/src/iqm/cirq_iqm/iqm_operation_mapping.py index a54338ee..65dbecdb 100644 --- a/src/iqm/cirq_iqm/iqm_operation_mapping.py +++ b/src/iqm/cirq_iqm/iqm_operation_mapping.py @@ -38,7 +38,7 @@ def map_operation(operation: Operation) -> Instruction: OperationNotSupportedError When the circuit contains an unsupported operation. """ - phased_rx_name = 'phased_rx' + phased_rx_name = 'prx' qubits = [str(qubit) for qubit in operation.qubits] if isinstance(operation.gate, PhasedXPowGate): return Instruction( diff --git a/tests/test_iqm_device_metadata.py b/tests/test_iqm_device_metadata.py index 928a0536..9c70bf77 100644 --- a/tests/test_iqm_device_metadata.py +++ b/tests/test_iqm_device_metadata.py @@ -22,7 +22,7 @@ def test_device_metadata_from_architecture(): qa = { 'name': 'Valkmusa', 'operations': [ - 'phased_rx', + 'prx', 'measurement', ], 'qubits': ['QB1', 'QB2'], diff --git a/tests/test_iqm_operation_mapping.py b/tests/test_iqm_operation_mapping.py index 35b4761d..46766f3b 100644 --- a/tests/test_iqm_operation_mapping.py +++ b/tests/test_iqm_operation_mapping.py @@ -54,7 +54,7 @@ def test_maps_measurement_gate(qubit_1): def test_maps_to_phased_rx(qubit_1, gate, expected_angle, expected_phase): operation = GateOperation(gate, [qubit_1]) mapped = map_operation(operation) - assert mapped.name == 'phased_rx' + assert mapped.name == 'prx' assert mapped.qubits == (str(qubit_1),) # The unit for angle and phase is full turns