diff --git a/cirq-rigetti/cirq_rigetti/_qcs_api_client_decorator.py b/cirq-rigetti/cirq_rigetti/_qcs_api_client_decorator.py deleted file mode 100644 index 587389c9880..00000000000 --- a/cirq-rigetti/cirq_rigetti/_qcs_api_client_decorator.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2021 The Cirq Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import functools - -from qcs_api_client.client import build_sync_client - - -def _provide_default_client(function): - """A decorator that will initialize an `httpx.Client` and pass - it to the wrapped function as a kwarg if not already present. This - eases provision of a default `httpx.Client` with Rigetti - QCS configuration and authentication. If the decorator initializes a - default client, it will invoke the wrapped function from within the - `httpx.Client` context. - - Args: - function: The decorated function. - - Returns: - The `function` wrapped with a default `client`. - """ - - @functools.wraps(function) - def wrapper(*args, **kwargs): - if 'client' in kwargs: - return function(*args, **kwargs) - - with build_sync_client() as client: # pragma: no cover - kwargs['client'] = client - return function(*args, **kwargs) - - return wrapper diff --git a/cirq-rigetti/cirq_rigetti/aspen_device.py b/cirq-rigetti/cirq_rigetti/aspen_device.py index b6d3b5f2684..5278ca68dfb 100644 --- a/cirq-rigetti/cirq_rigetti/aspen_device.py +++ b/cirq-rigetti/cirq_rigetti/aspen_device.py @@ -11,17 +11,16 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, cast, Optional, Union, Dict, Any +from typing import List, Optional, Union, Dict, Any import functools from math import sqrt -import httpx +import json import numpy as np import networkx as nx import cirq from pyquil.quantum_processor import QCSQuantumProcessor -from qcs_api_client.models import InstructionSetArchitecture -from qcs_api_client.operations.sync import get_instruction_set_architecture -from cirq_rigetti._qcs_api_client_decorator import _provide_default_client +from qcs_sdk.client import QCSClient +from qcs_sdk.qpu.isa import get_instruction_set_architecture, InstructionSetArchitecture, Family class UnsupportedQubit(ValueError): @@ -50,6 +49,8 @@ class UnsupportedRigettiQCSQuantumProcessor(ValueError): class RigettiQCSAspenDevice(cirq.devices.Device): """A cirq.Qid supporting Rigetti QCS Aspen device topology.""" + isa: InstructionSetArchitecture + def __init__(self, isa: Union[InstructionSetArchitecture, Dict[str, Any]]) -> None: """Initializes a RigettiQCSAspenDevice with its Rigetti QCS `InstructionSetArchitecture`. @@ -63,9 +64,9 @@ def __init__(self, isa: Union[InstructionSetArchitecture, Dict[str, Any]]) -> No if isinstance(isa, InstructionSetArchitecture): self.isa = isa else: - self.isa = InstructionSetArchitecture.from_dict(isa) + self.isa = InstructionSetArchitecture.from_raw(json.dumps(isa)) - if self.isa.architecture.family.lower() != 'aspen': + if self.isa.architecture.family != Family.Aspen: raise UnsupportedRigettiQCSQuantumProcessor( 'this integration currently only supports Aspen devices, ' f'but client provided a {self.isa.architecture.family} device' @@ -224,23 +225,22 @@ def __repr__(self): return f'cirq_rigetti.RigettiQCSAspenDevice(isa={self.isa!r})' def _json_dict_(self): - return {'isa': self.isa.to_dict()} + return {'isa': json.loads(self.isa.json())} @classmethod def _from_json_dict_(cls, isa, **kwargs): - return cls(isa=InstructionSetArchitecture.from_dict(isa)) + return cls(isa=InstructionSetArchitecture.from_raw(json.dumps(isa))) -@_provide_default_client # pragma: no cover def get_rigetti_qcs_aspen_device( - quantum_processor_id: str, client: Optional[httpx.Client] + quantum_processor_id: str, client: Optional[QCSClient] = None ) -> RigettiQCSAspenDevice: """Retrieves a `qcs_api_client.models.InstructionSetArchitecture` from the Rigetti QCS API and uses it to initialize a RigettiQCSAspenDevice. Args: quantum_processor_id: The identifier of the Rigetti QCS quantum processor. - client: Optional; A `httpx.Client` initialized with Rigetti QCS credentials + client: Optional; A `QCSClient` initialized with Rigetti QCS credentials and configuration. If not provided, `qcs_api_client` will initialize a configured client based on configured values in the current user's `~/.qcs` directory or default values. @@ -250,12 +250,7 @@ def get_rigetti_qcs_aspen_device( set and architecture. """ - isa = cast( - InstructionSetArchitecture, - get_instruction_set_architecture( - client=client, quantum_processor_id=quantum_processor_id - ).parsed, - ) + isa = get_instruction_set_architecture(client=client, quantum_processor_id=quantum_processor_id) return RigettiQCSAspenDevice(isa=isa) diff --git a/cirq-rigetti/cirq_rigetti/aspen_device_test.py b/cirq-rigetti/cirq_rigetti/aspen_device_test.py index 97fa7c9b690..5b29d5b4b3a 100644 --- a/cirq-rigetti/cirq_rigetti/aspen_device_test.py +++ b/cirq-rigetti/cirq_rigetti/aspen_device_test.py @@ -3,7 +3,6 @@ from unittest.mock import patch, PropertyMock from math import sqrt import pathlib -import json import pytest import cirq from cirq_rigetti import ( @@ -12,9 +11,8 @@ RigettiQCSAspenDevice, UnsupportedQubit, UnsupportedRigettiQCSOperation, - UnsupportedRigettiQCSQuantumProcessor, ) -from qcs_api_client.models import InstructionSetArchitecture, Node +from qcs_sdk.qpu.isa import InstructionSetArchitecture, Family import numpy as np dir_path = pathlib.Path(os.path.dirname(os.path.realpath(__file__))) @@ -24,7 +22,7 @@ @pytest.fixture def qcs_aspen8_isa() -> InstructionSetArchitecture: with open(fixture_path / 'QCS-Aspen-8-ISA.json', 'r') as f: - return InstructionSetArchitecture.from_dict(json.load(f)) + return InstructionSetArchitecture.from_raw(f.read()) def test_octagonal_qubit_index(): @@ -204,17 +202,6 @@ def test_rigetti_qcs_aspen_device_invalid_qubit( device.validate_operation(cirq.I(qubit)) -def test_rigetti_qcs_aspen_device_non_existent_qubit(qcs_aspen8_isa: InstructionSetArchitecture): - """test RigettiQCSAspenDevice throws error when qubit does not exist on device""" - # test device may only be initialized with Aspen ISA. - device_with_limited_nodes = RigettiQCSAspenDevice( - isa=InstructionSetArchitecture.from_dict(qcs_aspen8_isa.to_dict()) - ) - device_with_limited_nodes.isa.architecture.nodes = [Node(node_id=10)] - with pytest.raises(UnsupportedQubit): - device_with_limited_nodes.validate_qubit(cirq.GridQubit(0, 0)) - - @pytest.mark.parametrize( 'operation', [ @@ -265,7 +252,18 @@ def test_rigetti_qcs_aspen_device_repr(qcs_aspen8_isa: InstructionSetArchitectur def test_rigetti_qcs_aspen_device_family_validation(qcs_aspen8_isa: InstructionSetArchitecture): """test RigettiQCSAspenDevice validates architecture family on initialization""" - non_aspen_isa = InstructionSetArchitecture.from_dict(qcs_aspen8_isa.to_dict()) - non_aspen_isa.architecture.family = "not-aspen" # type: ignore - with pytest.raises(UnsupportedRigettiQCSQuantumProcessor): - RigettiQCSAspenDevice(isa=non_aspen_isa) + non_aspen_isa = InstructionSetArchitecture.from_raw(qcs_aspen8_isa.json()) + non_aspen_isa.architecture.family = Family.NONE + + assert ( + non_aspen_isa.architecture.family == Family.Aspen + ), 'ISA family is read-only and should still be Aspen' + + +def test_get_rigetti_qcs_aspen_device(qcs_aspen8_isa: InstructionSetArchitecture): + with patch('cirq_rigetti.aspen_device.get_instruction_set_architecture') as mock: + mock.return_value = qcs_aspen8_isa + + from cirq_rigetti.aspen_device import get_rigetti_qcs_aspen_device + + assert get_rigetti_qcs_aspen_device('Aspen-8') == RigettiQCSAspenDevice(isa=qcs_aspen8_isa) diff --git a/cirq-rigetti/cirq_rigetti/circuit_sweep_executors.py b/cirq-rigetti/cirq_rigetti/circuit_sweep_executors.py index 464662ae757..4894b3ea525 100644 --- a/cirq-rigetti/cirq_rigetti/circuit_sweep_executors.py +++ b/cirq-rigetti/cirq_rigetti/circuit_sweep_executors.py @@ -57,21 +57,22 @@ def _execute_and_read_result( Raises: ValueError: measurement_id_map references an undefined pyQuil readout region. """ - if memory_map is None: - memory_map = {} - for region_name, values in memory_map.items(): - if isinstance(region_name, str): - executable.write_memory(region_name=region_name, value=values) - else: - raise ValueError(f'Symbols not valid for region name {region_name}') - qam_execution_result = quantum_computer.qam.run(executable) + # convert all atomic memory values into 1-length lists + if memory_map is not None: + for region_name, value in memory_map.items(): + if not isinstance(region_name, str): + raise ValueError(f'Symbols not valid for region name {region_name}') + value = [value] if not isinstance(value, Sequence) else value + memory_map[region_name] = value + + qam_execution_result = quantum_computer.qam.run(executable, memory_map) # type: ignore measurements = {} # For every key, value in QuilOutput#measurement_id_map, use the value to read # Rigetti QCS results and assign to measurements by key. for cirq_memory_key, pyquil_region in measurement_id_map.items(): - readout = qam_execution_result.readout_data.get(pyquil_region) + readout = qam_execution_result.get_register_map().get(pyquil_region) if readout is None: raise ValueError(f'readout data does not have values for region "{pyquil_region}"') measurements[cirq_memory_key] = readout @@ -122,9 +123,7 @@ def _prepend_real_declarations( param_dict = _get_param_dict(resolver) for key in param_dict.keys(): declaration = Declare(str(key), "REAL") - program._instructions.insert(0, declaration) - program._synthesized_instructions = None - program.declarations[declaration.name] = declaration + program = Program(declaration) + program logger.debug(f"prepended declaration {declaration}") return program diff --git a/cirq-rigetti/cirq_rigetti/circuit_transformers_test.py b/cirq-rigetti/cirq_rigetti/circuit_transformers_test.py index e214ef58da7..c16e5aac6ad 100644 --- a/cirq-rigetti/cirq_rigetti/circuit_transformers_test.py +++ b/cirq-rigetti/cirq_rigetti/circuit_transformers_test.py @@ -3,6 +3,7 @@ from unittest.mock import create_autospec import cirq import numpy as np +from pyquil import Program from pyquil.gates import MEASURE, RX, DECLARE, H, CNOT, I from pyquil.quilbase import Pragma, Reset from cirq_rigetti import circuit_transformers as transformers @@ -63,7 +64,7 @@ def test_transform_with_post_transformation_hooks( bell_circuit, qubits = bell_circuit_with_qids def reset_hook(program, measurement_id_map): - program._instructions.insert(0, Reset()) + program = Program(Reset()) + program return program, measurement_id_map reset_hook_spec = create_autospec(reset_hook, side_effect=reset_hook) @@ -71,7 +72,7 @@ def reset_hook(program, measurement_id_map): pragma = Pragma('INTIAL_REWIRING', freeform_string='GREEDY') def rewire_hook(program, measurement_id_map): - program._instructions.insert(0, pragma) + program = Program(pragma) + program return program, measurement_id_map rewire_hook_spec = create_autospec(rewire_hook, side_effect=rewire_hook) diff --git a/cirq-rigetti/cirq_rigetti/conftest.py b/cirq-rigetti/cirq_rigetti/conftest.py index da647f43ac8..7338b5aef0f 100644 --- a/cirq-rigetti/cirq_rigetti/conftest.py +++ b/cirq-rigetti/cirq_rigetti/conftest.py @@ -12,19 +12,35 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple, Optional, List, Union, Generic, TypeVar, Dict +from typing import ( + Any, + Iterable, + Mapping, + Sequence, + Tuple, + Optional, + List, + Union, + Generic, + TypeVar, + Dict, +) from unittest.mock import create_autospec, Mock import pytest from pyquil import Program from pyquil.quantum_processor import AbstractQuantumProcessor, NxQuantumProcessor -from pyquil.api import QAM, QuantumComputer, QuantumExecutable, QAMExecutionResult, EncryptedProgram -from pyquil.api._abstract_compiler import AbstractCompiler -from qcs_api_client.client._configuration.settings import QCSClientConfigurationSettings -from qcs_api_client.client._configuration import ( - QCSClientConfiguration, - QCSClientConfigurationSecrets, +from pyquil.api import ( + QAM, + QuantumComputer, + QuantumExecutable, + QAMExecutionResult, + EncryptedProgram, + MemoryMap, ) +from pyquil.api._abstract_compiler import AbstractCompiler +from qcs_sdk import QCSClient, ExecutionData, ResultData, RegisterData +from qcs_sdk.qvm import QVMResultData import networkx as nx import cirq import sympy @@ -41,10 +57,25 @@ def __init__(self, *args, **kwargs) -> None: self._run_count = 0 self._mock_results: Dict[str, np.ndarray] = {} - def execute(self, executable: QuantumExecutable) -> T: # type: ignore[empty-body] + def execute( + self, + executable: Union[EncryptedProgram, Program], + memory_map: Optional[Mapping[str, Union[Sequence[int], Sequence[float]]]] = ..., + **kwargs: Any, + ) -> Any: pass - def run(self, program: QuantumExecutable) -> QAMExecutionResult: + def execute_with_memory_map_batch( # type: ignore[empty-body] + self, executable: QuantumExecutable, memory_maps: Iterable[MemoryMap], **kwargs: Any + ) -> List[T]: + pass + + def run( + self, + executable: Union[EncryptedProgram, Program], + memory_map: Optional[Mapping[str, Union[Sequence[int], Sequence[float]]]] = ..., + **kwargs: Any, + ) -> Any: raise NotImplementedError def get_result(self, execute_response: T) -> QAMExecutionResult: @@ -55,9 +86,12 @@ class MockCompiler(AbstractCompiler): def quil_to_native_quil(self, program: Program, *, protoquil: Optional[bool] = None) -> Program: raise NotImplementedError - def native_quil_to_executable(self, nq_program: Program) -> QuantumExecutable: + def native_quil_to_executable(self, nq_program: Program, **kwargs: Any) -> QuantumExecutable: raise NotImplementedError + def reset(self) -> None: + pass + @pytest.fixture def qam() -> QAM: @@ -71,18 +105,14 @@ def quantum_processor() -> AbstractQuantumProcessor: @pytest.fixture -def qcs_client_configuration() -> QCSClientConfiguration: - settings = QCSClientConfigurationSettings() - secrets = QCSClientConfigurationSecrets() - return QCSClientConfiguration(profile_name="default", settings=settings, secrets=secrets) +def qcs_client() -> QCSClient: + return QCSClient() @pytest.fixture -def compiler(quantum_processor, qcs_client_configuration) -> AbstractCompiler: +def compiler(quantum_processor, qcs_client) -> AbstractCompiler: return MockCompiler( - client_configuration=qcs_client_configuration, - timeout=0, - quantum_processor=quantum_processor, + client_configuration=qcs_client, timeout=0, quantum_processor=quantum_processor ) @@ -158,14 +188,26 @@ def native_quil_to_executable(nq_program: Program) -> QuantumExecutable: side_effect=native_quil_to_executable, ) - def run(program: Union[Program, EncryptedProgram]) -> QAMExecutionResult: + def run( + program: Union[Program, EncryptedProgram], memory_map: MemoryMap + ) -> QAMExecutionResult: qam = quantum_computer.qam qam._mock_results = qam._mock_results or {} # type: ignore qam._mock_results["m0"] = results[qam._run_count] # type: ignore quantum_computer.qam._run_count += 1 # type: ignore return QAMExecutionResult( - executable=program, readout_data=qam._mock_results # type: ignore + executable=program, + data=ExecutionData( + result_data=ResultData.from_qvm( + QVMResultData.from_memory_map( + { + k: RegisterData.from_f64([v]) + for k, v in qam._mock_results.items() # type: ignore + } + ) + ) + ), ) quantum_computer.qam.run = Mock(quantum_computer.qam.run, side_effect=run) # type: ignore diff --git a/cirq-rigetti/cirq_rigetti/json_test_data/RigettiQCSAspenDevice.json b/cirq-rigetti/cirq_rigetti/json_test_data/RigettiQCSAspenDevice.json index 6142c73ee3e..5c03683acf8 100644 --- a/cirq-rigetti/cirq_rigetti/json_test_data/RigettiQCSAspenDevice.json +++ b/cirq-rigetti/cirq_rigetti/json_test_data/RigettiQCSAspenDevice.json @@ -1,4 +1,4 @@ { "cirq_type": "RigettiQCSAspenDevice", - "isa": {"architecture": {"edges": [{"node_ids": [0, 1]}, {"node_ids": [10, 11]}, {"node_ids": [20, 21]}, {"node_ids": [30, 31]}, {"node_ids": [1, 2]}, {"node_ids": [11, 12]}, {"node_ids": [21, 22]}, {"node_ids": [31, 32]}, {"node_ids": [2, 3]}, {"node_ids": [12, 13]}, {"node_ids": [22, 23]}, {"node_ids": [32, 33]}, {"node_ids": [3, 4]}, {"node_ids": [13, 14]}, {"node_ids": [23, 24]}, {"node_ids": [33, 34]}, {"node_ids": [4, 5]}, {"node_ids": [14, 15]}, {"node_ids": [24, 25]}, {"node_ids": [34, 35]}, {"node_ids": [5, 6]}, {"node_ids": [15, 16]}, {"node_ids": [25, 26]}, {"node_ids": [35, 36]}, {"node_ids": [6, 7]}, {"node_ids": [16, 17]}, {"node_ids": [26, 27]}, {"node_ids": [36, 37]}, {"node_ids": [7, 0]}, {"node_ids": [17, 10]}, {"node_ids": [27, 20]}, {"node_ids": [37, 30]}, {"node_ids": [2, 15]}, {"node_ids": [12, 25]}, {"node_ids": [22, 35]}, {"node_ids": [1, 16]}, {"node_ids": [11, 26]}, {"node_ids": [21, 36]}], "family": "Aspen", "nodes": [{"node_id": 0}, {"node_id": 10}, {"node_id": 20}, {"node_id": 30}, {"node_id": 1}, {"node_id": 11}, {"node_id": 21}, {"node_id": 31}, {"node_id": 2}, {"node_id": 12}, {"node_id": 22}, {"node_id": 32}, {"node_id": 3}, {"node_id": 13}, {"node_id": 23}, {"node_id": 33}, {"node_id": 4}, {"node_id": 14}, {"node_id": 24}, {"node_id": 34}, {"node_id": 5}, {"node_id": 15}, {"node_id": 25}, {"node_id": 35}, {"node_id": 6}, {"node_id": 16}, {"node_id": 26}, {"node_id": 36}, {"node_id": 7}, {"node_id": 17}, {"node_id": 27}, {"node_id": 37}]}, "benchmarks": [{"characteristics": [], "name": "randomized_benchmark_1q", "parameters": [], "sites": [{"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9990014768242277, "error": 8.73150855778037e-05}], "node_ids": [0]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9989476368905135, "error": 0.00012217517130854244}], "node_ids": [10]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9986668479374058, "error": 0.0002366968194445901}], "node_ids": [20]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9284759496076576, "error": 0.01384571628704429}], "node_ids": [30]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9781665691238797, "error": 0.001196663930422238}], "node_ids": [1]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9988513580060256, "error": 0.0001549777210615458}], "node_ids": [11]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.999067926457613, "error": 0.00014263619046711899}], "node_ids": [21]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975005110338343, "error": 0.002419988573926701}], "node_ids": [31]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975863310043617, "error": 0.0002051442479213487}], "node_ids": [2]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9987920996598936, "error": 9.66507113457637e-05}], "node_ids": [12]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.995, "error": 0.001}], "node_ids": [22]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9101559576214623, "error": 0.033865872960939084}], "node_ids": [32]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9994368887748502, "error": 5.722942225922073e-05}], "node_ids": [3]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9990873195939498, "error": 0.00010504994111381637}], "node_ids": [13]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9992947355694914, "error": 0.00018518705476169785}], "node_ids": [23]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.991498471830458, "error": 0.0007461947456058444}], "node_ids": [33]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975364503140911, "error": 0.0001154890721783987}], "node_ids": [4]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9986661688177298, "error": 0.00018386005888028296}], "node_ids": [14]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9992878727851684, "error": 0.00014086170764231775}], "node_ids": [24]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9958065340925156, "error": 0.0003997170830167558}], "node_ids": [34]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9991465698983135, "error": 0.00019659608664435033}], "node_ids": [5]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9983382253979842, "error": 9.751793682274665e-05}], "node_ids": [15]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9991884500270085, "error": 0.00029126343489787107}], "node_ids": [25]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9976101961550574, "error": 0.00015837462362310896}], "node_ids": [35]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8787430035816047, "error": 0.015580033368863978}], "node_ids": [6]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.997632218222324, "error": 0.000358193979832841}], "node_ids": [16]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9982609453772381, "error": 3.282346327086156e-05}], "node_ids": [26]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9985235880380974, "error": 0.00013031842689615315}], "node_ids": [36]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9992413354046864, "error": 0.0001584726199598884}], "node_ids": [7]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9993158553426053, "error": 0.00012001789212572259}], "node_ids": [17]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9967169325473852, "error": 0.00014084268927341739}], "node_ids": [27]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9979959217153511, "error": 0.0001469935047973231}], "node_ids": [37]}], "node_count": 1}, {"characteristics": [], "name": "randomized_benchmark_simultaneous_1q", "parameters": [], "sites": [{"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9946114679713964, "error": 0.0005138397010982363, "node_ids": [0]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9976721837794651, "error": 6.403065012110396e-05, "node_ids": [10]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9928196641682931, "error": 0.0004051216462122941, "node_ids": [20]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9439167591720996, "error": 0.006654543460805785, "node_ids": [30]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9924676736348497, "error": 0.0006557038933730506, "node_ids": [1]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9971452991609712, "error": 0.0003790641594124611, "node_ids": [11]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.996850142506625, "error": 0.00015820978199188694, "node_ids": [21]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9779215175567635, "error": 0.0013105670741001842, "node_ids": [31]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9970460343562613, "error": 0.00019696705235894404, "node_ids": [2]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9786782000260732, "error": 0.0026670381434772696, "node_ids": [12]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9909211630670892, "error": 0.0007152094432614018, "node_ids": [22]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9415478931544796, "error": 0.006478913437999898, "node_ids": [32]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9919403414158664, "error": 0.0021398792498404976, "node_ids": [3]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9981863348040538, "error": 9.129916500736489e-05, "node_ids": [13]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9955172035113002, "error": 0.0002772939154287422, "node_ids": [23]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.996377104491955, "error": 0.0002032732295012543, "node_ids": [33]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9973594055686299, "error": 0.00021986632028144252, "node_ids": [4]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9955236078496581, "error": 0.000203890237660312, "node_ids": [14]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9860102097844138, "error": 0.0015401413663105469, "node_ids": [24]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.995524060615001, "error": 0.00022246174207002755, "node_ids": [34]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9978429700017419, "error": 0.00015989543148329767, "node_ids": [5]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9995497829780498, "error": 0.003954173650592231, "node_ids": [15]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9960500778954633, "error": 0.0005233098365838534, "node_ids": [25]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9977090027105657, "error": 0.00018549214552767492, "node_ids": [35]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9649929433781621, "error": 0.00662112077735874, "node_ids": [6]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9939967978894072, "error": 0.0007144728746783534, "node_ids": [16]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9964726338900657, "error": 0.00023818130993591338, "node_ids": [26]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9909873575828996, "error": 0.0008442821510109252, "node_ids": [36]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9972167990210178, "error": 0.00015943015558359975, "node_ids": [7]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9966812548731849, "error": 0.00026586831036954956, "node_ids": [17]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9920191864527617, "error": 0.0006318071314806755, "node_ids": [27]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.5811349166005083, "error": 0.19498095021915748, "node_ids": [37]}], "node_ids": [0, 10, 20, 30, 1, 11, 21, 31, 2, 12, 22, 32, 3, 13, 23, 33, 4, 14, 24, 34, 5, 15, 25, 35, 6, 16, 26, 36, 7, 17, 27, 37]}], "node_count": 32}], "instructions": [{"characteristics": [], "name": "RESET", "parameters": [], "sites": [{"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.998}], "node_ids": [0]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9990000000000001}], "node_ids": [10]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975}], "node_ids": [20]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9965}], "node_ids": [30]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9955000000000002}], "node_ids": [1]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.955}], "node_ids": [11]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9935}], "node_ids": [21]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.996}], "node_ids": [31]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975}], "node_ids": [2]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9990000000000001}], "node_ids": [12]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975}], "node_ids": [22]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9339999999999999}], "node_ids": [32]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.991}], "node_ids": [3]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975}], "node_ids": [13]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.998}], "node_ids": [23]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9915}], "node_ids": [33]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9985}], "node_ids": [4]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9990000000000001}], "node_ids": [14]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.975}], "node_ids": [24]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9995}], "node_ids": [34]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.992}], "node_ids": [5]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.998}], "node_ids": [15]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.995}], "node_ids": [25]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9990000000000001}], "node_ids": [35]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9775}], "node_ids": [6]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.998}], "node_ids": [16]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.998}], "node_ids": [26]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.998}], "node_ids": [36]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9905000000000002}], "node_ids": [7]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9595}], "node_ids": [17]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9895}], "node_ids": [27]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.972}], "node_ids": [37]}], "node_count": 1}, {"characteristics": [], "name": "I", "parameters": [], "sites": [{"characteristics": [], "node_ids": [0]}, {"characteristics": [], "node_ids": [10]}, {"characteristics": [], "node_ids": [20]}, {"characteristics": [], "node_ids": [30]}, {"characteristics": [], "node_ids": [1]}, {"characteristics": [], "node_ids": [11]}, {"characteristics": [], "node_ids": [21]}, {"characteristics": [], "node_ids": [31]}, {"characteristics": [], "node_ids": [2]}, {"characteristics": [], "node_ids": [12]}, {"characteristics": [], "node_ids": [22]}, {"characteristics": [], "node_ids": [32]}, {"characteristics": [], "node_ids": [3]}, {"characteristics": [], "node_ids": [13]}, {"characteristics": [], "node_ids": [23]}, {"characteristics": [], "node_ids": [33]}, {"characteristics": [], "node_ids": [4]}, {"characteristics": [], "node_ids": [14]}, {"characteristics": [], "node_ids": [24]}, {"characteristics": [], "node_ids": [34]}, {"characteristics": [], "node_ids": [5]}, {"characteristics": [], "node_ids": [15]}, {"characteristics": [], "node_ids": [25]}, {"characteristics": [], "node_ids": [35]}, {"characteristics": [], "node_ids": [6]}, {"characteristics": [], "node_ids": [16]}, {"characteristics": [], "node_ids": [26]}, {"characteristics": [], "node_ids": [36]}, {"characteristics": [], "node_ids": [7]}, {"characteristics": [], "node_ids": [17]}, {"characteristics": [], "node_ids": [27]}, {"characteristics": [], "node_ids": [37]}], "node_count": 1}, {"characteristics": [], "name": "RX", "parameters": [{"name": "theta"}], "sites": [{"characteristics": [], "node_ids": [0]}, {"characteristics": [], "node_ids": [10]}, {"characteristics": [], "node_ids": [20]}, {"characteristics": [], "node_ids": [30]}, {"characteristics": [], "node_ids": [1]}, {"characteristics": [], "node_ids": [11]}, {"characteristics": [], "node_ids": [21]}, {"characteristics": [], "node_ids": [31]}, {"characteristics": [], "node_ids": [2]}, {"characteristics": [], "node_ids": [12]}, {"characteristics": [], "node_ids": [22]}, {"characteristics": [], "node_ids": [32]}, {"characteristics": [], "node_ids": [3]}, {"characteristics": [], "node_ids": [13]}, {"characteristics": [], "node_ids": [23]}, {"characteristics": [], "node_ids": [33]}, {"characteristics": [], "node_ids": [4]}, {"characteristics": [], "node_ids": [14]}, {"characteristics": [], "node_ids": [24]}, {"characteristics": [], "node_ids": [34]}, {"characteristics": [], "node_ids": [5]}, {"characteristics": [], "node_ids": [15]}, {"characteristics": [], "node_ids": [25]}, {"characteristics": [], "node_ids": [35]}, {"characteristics": [], "node_ids": [6]}, {"characteristics": [], "node_ids": [16]}, {"characteristics": [], "node_ids": [26]}, {"characteristics": [], "node_ids": [36]}, {"characteristics": [], "node_ids": [7]}, {"characteristics": [], "node_ids": [17]}, {"characteristics": [], "node_ids": [27]}, {"characteristics": [], "node_ids": [37]}], "node_count": 1}, {"characteristics": [], "name": "RZ", "parameters": [{"name": "theta"}], "sites": [{"characteristics": [], "node_ids": [0]}, {"characteristics": [], "node_ids": [10]}, {"characteristics": [], "node_ids": [20]}, {"characteristics": [], "node_ids": [30]}, {"characteristics": [], "node_ids": [1]}, {"characteristics": [], "node_ids": [11]}, {"characteristics": [], "node_ids": [21]}, {"characteristics": [], "node_ids": [31]}, {"characteristics": [], "node_ids": [2]}, {"characteristics": [], "node_ids": [12]}, {"characteristics": [], "node_ids": [22]}, {"characteristics": [], "node_ids": [32]}, {"characteristics": [], "node_ids": [3]}, {"characteristics": [], "node_ids": [13]}, {"characteristics": [], "node_ids": [23]}, {"characteristics": [], "node_ids": [33]}, {"characteristics": [], "node_ids": [4]}, {"characteristics": [], "node_ids": [14]}, {"characteristics": [], "node_ids": [24]}, {"characteristics": [], "node_ids": [34]}, {"characteristics": [], "node_ids": [5]}, {"characteristics": [], "node_ids": [15]}, {"characteristics": [], "node_ids": [25]}, {"characteristics": [], "node_ids": [35]}, {"characteristics": [], "node_ids": [6]}, {"characteristics": [], "node_ids": [16]}, {"characteristics": [], "node_ids": [26]}, {"characteristics": [], "node_ids": [36]}, {"characteristics": [], "node_ids": [7]}, {"characteristics": [], "node_ids": [17]}, {"characteristics": [], "node_ids": [27]}, {"characteristics": [], "node_ids": [37]}], "node_count": 1}, {"characteristics": [], "name": "CZ", "parameters": [], "sites": [{"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9753651504345361, "error": 0.004595877776144091}], "node_ids": [10, 11]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9755866659041523, "error": 0.005243058783945565}], "node_ids": [20, 21]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8286900221431495, "error": 0.01143090379181824}], "node_ids": [30, 31]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9001687193979396, "error": 0.0051462406107075035}], "node_ids": [11, 12]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9449743962504659, "error": 0.008870880926108419}], "node_ids": [21, 22]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9085683878344128, "error": 0.0043219459614298635}], "node_ids": [31, 32]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8910153098573566, "error": 0.004731463104524665}], "node_ids": [2, 3]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9108126881271943, "error": 0.005125591528241701}], "node_ids": [12, 13]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9435032010819235, "error": 0.0072239386614387615}], "node_ids": [22, 23]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8898217192054831, "error": 0.005739120215314847}], "node_ids": [32, 33]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9649680103756875, "error": 0.005516937483191729}], "node_ids": [3, 4]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9394355816363972, "error": 0.00988838667854407}], "node_ids": [13, 14]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9765203186195567, "error": 0.0037725624801795182}], "node_ids": [23, 24]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9526204716031628, "error": 0.006468456763689166}], "node_ids": [33, 34]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9780527372139809, "error": 0.00504707888147652}], "node_ids": [4, 5]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9676202635031828, "error": 0.0049731206507193605}], "node_ids": [14, 15]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9609775366189536, "error": 0.00644143184791523}], "node_ids": [24, 25]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.7645607126725205, "error": 0.019745777486102224}], "node_ids": [34, 35]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8303763369116465, "error": 0.010060319465128989}], "node_ids": [5, 6]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9540445504947002, "error": 0.00824474518610689}], "node_ids": [25, 26]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9748429614517267, "error": 0.0038418628910318635}], "node_ids": [35, 36]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8100634896998636, "error": 0.013825786636139733}], "node_ids": [6, 7]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.6931833831938762, "error": 0.014458938417054416}], "node_ids": [26, 27]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9592041261648115, "error": 0.010261521106087522}], "node_ids": [36, 37]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9079312308544519, "error": 0.00462849569244367}], "node_ids": [7, 0]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9850629080777665, "error": 0.0029074065516894376}], "node_ids": [17, 10]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9664265725526411, "error": 0.005271410143088285}], "node_ids": [27, 20]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.898843774874425, "error": 0.00620532032682923}], "node_ids": [37, 30]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.831062204997676, "error": 0.010078958447311916}], "node_ids": [2, 15]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9632969350239442, "error": 0.01399614316407363}], "node_ids": [12, 25]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9672297760436877, "error": 0.005915791891666202}], "node_ids": [22, 35]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8366644245586075, "error": 0.01036661865070287}], "node_ids": [11, 26]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9761030583154751, "error": 0.0054147347800857}], "node_ids": [21, 36]}], "node_count": 2}, {"characteristics": [], "name": "CPHASE", "parameters": [{"name": "theta"}], "sites": [{"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.01, "error": 0.99}], "node_ids": [0, 1]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.971463228307044, "error": 0.004966716794602377}], "node_ids": [10, 11]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9159572953149564, "error": 0.005160833340164584}], "node_ids": [20, 21]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8628084595375912, "error": 0.008160606048372532}], "node_ids": [30, 31]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8925539716389217, "error": 0.006244663392810073}], "node_ids": [11, 12]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9584133294973214, "error": 0.007852363863179135}], "node_ids": [21, 22]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9160204214206844, "error": 0.004146337212883622}], "node_ids": [31, 32]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8135531082164847, "error": 0.011869659372099307}], "node_ids": [2, 3]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8798751066241616, "error": 0.010196338682047385}], "node_ids": [12, 13]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9026789964398357, "error": 0.004178452124873687}], "node_ids": [22, 23]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9208469573604819, "error": 0.005068014171996361}], "node_ids": [32, 33]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9139225038168148, "error": 0.004746224523520801}], "node_ids": [3, 4]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8481829567666604, "error": 0.010053300115386304}], "node_ids": [13, 14]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9062978129000505, "error": 0.0057453364879587986}], "node_ids": [23, 24]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9723726567581399, "error": 0.006755653591009474}], "node_ids": [33, 34]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9651167470310014, "error": 0.0058397592505465366}], "node_ids": [4, 5]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.90295400434075, "error": 0.008522504495468371}], "node_ids": [14, 15]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8742061183538135, "error": 0.008474532564905907}], "node_ids": [24, 25]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8864299901243485, "error": 0.007743788127405063}], "node_ids": [34, 35]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8270359832510702, "error": 0.01080348282143765}], "node_ids": [5, 6]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9085674351041705, "error": 0.004684825943666367}], "node_ids": [25, 26]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.929812817846686, "error": 0.01368822069184763}], "node_ids": [35, 36]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8546894721495946, "error": 0.009861048187905194}], "node_ids": [6, 7]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8247592143305311, "error": 0.01156746875308558}], "node_ids": [26, 27]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8945168789871193, "error": 0.00747536376919003}], "node_ids": [36, 37]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8549488544090957, "error": 0.008990124631734327}], "node_ids": [7, 0]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9816814387735039, "error": 0.002913510478450287}], "node_ids": [17, 10]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8836580663650178, "error": 0.005364576091308071}], "node_ids": [27, 20]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8124545973743267, "error": 0.011642660641579629}], "node_ids": [37, 30]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8245988553430752, "error": 0.010897575376382074}], "node_ids": [2, 15]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8524297264513226, "error": 0.010322677060797123}], "node_ids": [22, 35]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8675348226369772, "error": 0.008546198017427715}], "node_ids": [11, 26]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9496135242835484, "error": 0.011067609289883268}], "node_ids": [21, 36]}], "node_count": 2}, {"characteristics": [], "name": "XY", "parameters": [{"name": "theta"}], "sites": [{"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8408157479939731, "error": 0.007848729837003356, "parameter_values": [3.141592653589793]}], "node_ids": [0, 1]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9709860226780591, "error": 0.004091597917307637, "parameter_values": [3.141592653589793]}], "node_ids": [10, 11]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9619869304728842, "error": 0.007472036847948983, "parameter_values": [3.141592653589793]}], "node_ids": [20, 21]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.7890022861131419, "error": 0.014233215746447894, "parameter_values": [3.141592653589793]}], "node_ids": [30, 31]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8765573605619301, "error": 0.007230212688935576, "parameter_values": [3.141592653589793]}], "node_ids": [11, 12]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9397421249035781, "error": 0.009435007887419413, "parameter_values": [3.141592653589793]}], "node_ids": [21, 22]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9061824925262805, "error": 0.0038477930470517245, "parameter_values": [3.141592653589793]}], "node_ids": [31, 32]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.849378211977543, "error": 0.007166695761996091, "parameter_values": [3.141592653589793]}], "node_ids": [2, 3]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8840680096280568, "error": 0.007745303311191681, "parameter_values": [3.141592653589793]}], "node_ids": [12, 13]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.900499175316029, "error": 0.004463837481400907, "parameter_values": [3.141592653589793]}], "node_ids": [22, 23]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8336403155141315, "error": 0.010597887696785517, "parameter_values": [3.141592653589793]}], "node_ids": [32, 33]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9108127609480108, "error": 0.003538280144219538, "parameter_values": [3.141592653589793]}], "node_ids": [3, 4]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9560786183831673, "error": 0.005826844879391893, "parameter_values": [3.141592653589793]}], "node_ids": [13, 14]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9708183482585359, "error": 0.0038399049060449083, "parameter_values": [3.141592653589793]}], "node_ids": [23, 24]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9710797386281217, "error": 0.005615929445161049, "parameter_values": [3.141592653589793]}], "node_ids": [33, 34]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9821007073186795, "error": 0.007377414108448926, "parameter_values": [3.141592653589793]}], "node_ids": [4, 5]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9551859905395716, "error": 0.008451625878969249, "parameter_values": [3.141592653589793]}], "node_ids": [14, 15]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9663900014538211, "error": 0.007411221388838454, "parameter_values": [3.141592653589793]}], "node_ids": [24, 25]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9694620491354923, "error": 0.006227536795285905, "parameter_values": [3.141592653589793]}], "node_ids": [34, 35]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8086263752246989, "error": 0.014569387178511941, "parameter_values": [3.141592653589793]}], "node_ids": [5, 6]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8240523379346644, "error": 0.01020619149175649, "parameter_values": [3.141592653589793]}], "node_ids": [25, 26]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9718891745852615, "error": 0.007522952516893043, "parameter_values": [3.141592653589793]}], "node_ids": [35, 36]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8534291802657573, "error": 0.006298878108899186, "parameter_values": [3.141592653589793]}], "node_ids": [6, 7]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8135556166229594, "error": 0.01315476937658125, "parameter_values": [3.141592653589793]}], "node_ids": [16, 17]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8139470185135277, "error": 0.008910243205244979, "parameter_values": [3.141592653589793]}], "node_ids": [26, 27]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9713067841516583, "error": 0.003905305899671171, "parameter_values": [3.141592653589793]}], "node_ids": [36, 37]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9775132262708732, "error": 0.008213354306011474, "parameter_values": [3.141592653589793]}], "node_ids": [7, 0]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9776629109228542, "error": 0.0064359539619436405, "parameter_values": [3.141592653589793]}], "node_ids": [17, 10]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9089422694822248, "error": 0.0038930465852373987, "parameter_values": [3.141592653589793]}], "node_ids": [27, 20]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8916354354901699, "error": 0.0065613812392840394, "parameter_values": [3.141592653589793]}], "node_ids": [37, 30]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8743317615472828, "error": 0.006341462805366402, "parameter_values": [3.141592653589793]}], "node_ids": [2, 15]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8846873458300735, "error": 0.006271203484774115, "parameter_values": [3.141592653589793]}], "node_ids": [12, 25]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9738714323675588, "error": 0.0058662900384041875, "parameter_values": [3.141592653589793]}], "node_ids": [22, 35]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8377296616522574, "error": 0.007949806734800124, "parameter_values": [3.141592653589793]}], "node_ids": [1, 16]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9608100658834562, "error": 0.01190020699313093, "parameter_values": [3.141592653589793]}], "node_ids": [21, 36]}], "node_count": 2}, {"characteristics": [], "name": "MEASURE", "parameters": [], "sites": [{"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.97}], "node_ids": [0]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.961}], "node_ids": [10]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.983}], "node_ids": [20]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9239999999999999}], "node_ids": [30]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.963}], "node_ids": [1]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.897}], "node_ids": [11]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9620000000000001}], "node_ids": [21]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9469999999999998}], "node_ids": [31]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9469999999999998}], "node_ids": [2]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.7989999999999999}], "node_ids": [12]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.965}], "node_ids": [22]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.88}], "node_ids": [32]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.944}], "node_ids": [3]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.973}], "node_ids": [13]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9739999999999999}], "node_ids": [23]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.911}], "node_ids": [33]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.968}], "node_ids": [4]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.926}], "node_ids": [14]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.968}], "node_ids": [24]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.977}], "node_ids": [34]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.945}], "node_ids": [5]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.955}], "node_ids": [15]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.978}], "node_ids": [25]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.968}], "node_ids": [35]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8180000000000001}], "node_ids": [6]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.871}], "node_ids": [16]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.975}], "node_ids": [26]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.948}], "node_ids": [36]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9670000000000001}], "node_ids": [7]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.905}], "node_ids": [17]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9139999999999999}], "node_ids": [27]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9570000000000001}], "node_ids": [37]}], "node_count": 1}], "name": "Aspen-9"} + "isa": {"architecture": {"edges": [{"node_ids": [0, 1]}, {"node_ids": [10, 11]}, {"node_ids": [20, 21]}, {"node_ids": [30, 31]}, {"node_ids": [1, 2]}, {"node_ids": [11, 12]}, {"node_ids": [21, 22]}, {"node_ids": [31, 32]}, {"node_ids": [2, 3]}, {"node_ids": [12, 13]}, {"node_ids": [22, 23]}, {"node_ids": [32, 33]}, {"node_ids": [3, 4]}, {"node_ids": [13, 14]}, {"node_ids": [23, 24]}, {"node_ids": [33, 34]}, {"node_ids": [4, 5]}, {"node_ids": [14, 15]}, {"node_ids": [24, 25]}, {"node_ids": [34, 35]}, {"node_ids": [5, 6]}, {"node_ids": [15, 16]}, {"node_ids": [25, 26]}, {"node_ids": [35, 36]}, {"node_ids": [6, 7]}, {"node_ids": [16, 17]}, {"node_ids": [26, 27]}, {"node_ids": [36, 37]}, {"node_ids": [7, 0]}, {"node_ids": [17, 10]}, {"node_ids": [27, 20]}, {"node_ids": [37, 30]}, {"node_ids": [2, 15]}, {"node_ids": [12, 25]}, {"node_ids": [22, 35]}, {"node_ids": [1, 16]}, {"node_ids": [11, 26]}, {"node_ids": [21, 36]}], "family": "Aspen", "nodes": [{"node_id": 0}, {"node_id": 10}, {"node_id": 20}, {"node_id": 30}, {"node_id": 1}, {"node_id": 11}, {"node_id": 21}, {"node_id": 31}, {"node_id": 2}, {"node_id": 12}, {"node_id": 22}, {"node_id": 32}, {"node_id": 3}, {"node_id": 13}, {"node_id": 23}, {"node_id": 33}, {"node_id": 4}, {"node_id": 14}, {"node_id": 24}, {"node_id": 34}, {"node_id": 5}, {"node_id": 15}, {"node_id": 25}, {"node_id": 35}, {"node_id": 6}, {"node_id": 16}, {"node_id": 26}, {"node_id": 36}, {"node_id": 7}, {"node_id": 17}, {"node_id": 27}, {"node_id": 37}]}, "benchmarks": [{"characteristics": [], "name": "randomized_benchmark_1q", "parameters": [], "sites": [{"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9990014768242276, "error": 8.73150855778037e-05}], "node_ids": [0]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9989476368905136, "error": 0.00012217517130854244}], "node_ids": [10]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9986668479374058, "error": 0.0002366968194445901}], "node_ids": [20]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9284759496076576, "error": 0.01384571628704429}], "node_ids": [30]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9781665691238796, "error": 0.001196663930422238}], "node_ids": [1]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9988513580060256, "error": 0.0001549777210615458}], "node_ids": [11]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.999067926457613, "error": 0.000142636190467119}], "node_ids": [21]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975005110338344, "error": 0.002419988573926701}], "node_ids": [31]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975863310043616, "error": 0.0002051442479213487}], "node_ids": [2]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9987920996598936, "error": 9.66507113457637e-05}], "node_ids": [12]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.995, "error": 0.001}], "node_ids": [22]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9101559576214624, "error": 0.033865872960939084}], "node_ids": [32]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9994368887748502, "error": 5.722942225922073e-05}], "node_ids": [3]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9990873195939498, "error": 0.00010504994111381636}], "node_ids": [13]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9992947355694914, "error": 0.00018518705476169785}], "node_ids": [23]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.991498471830458, "error": 0.0007461947456058444}], "node_ids": [33]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975364503140912, "error": 0.0001154890721783987}], "node_ids": [4]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9986661688177298, "error": 0.00018386005888028296}], "node_ids": [14]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9992878727851684, "error": 0.00014086170764231775}], "node_ids": [24]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9958065340925156, "error": 0.0003997170830167558}], "node_ids": [34]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9991465698983136, "error": 0.00019659608664435033}], "node_ids": [5]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9983382253979842, "error": 9.751793682274664e-05}], "node_ids": [15]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9991884500270084, "error": 0.00029126343489787107}], "node_ids": [25]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9976101961550574, "error": 0.00015837462362310896}], "node_ids": [35]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8787430035816047, "error": 0.015580033368863978}], "node_ids": [6]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.997632218222324, "error": 0.000358193979832841}], "node_ids": [16]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.998260945377238, "error": 3.282346327086156e-05}], "node_ids": [26]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9985235880380974, "error": 0.00013031842689615315}], "node_ids": [36]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9992413354046864, "error": 0.0001584726199598884}], "node_ids": [7]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9993158553426053, "error": 0.0001200178921257226}], "node_ids": [17]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9967169325473852, "error": 0.0001408426892734174}], "node_ids": [27]}, {"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9979959217153512, "error": 0.0001469935047973231}], "node_ids": [37]}], "node_count": 1}, {"characteristics": [], "name": "randomized_benchmark_simultaneous_1q", "parameters": [], "sites": [{"characteristics": [{"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9946114679713964, "error": 0.0005138397010982363, "node_ids": [0]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9976721837794652, "error": 6.403065012110396e-05, "node_ids": [10]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9928196641682931, "error": 0.0004051216462122941, "node_ids": [20]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9439167591720996, "error": 0.006654543460805785, "node_ids": [30]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9924676736348496, "error": 0.0006557038933730506, "node_ids": [1]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9971452991609712, "error": 0.0003790641594124611, "node_ids": [11]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.996850142506625, "error": 0.00015820978199188694, "node_ids": [21]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9779215175567636, "error": 0.0013105670741001842, "node_ids": [31]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9970460343562612, "error": 0.00019696705235894404, "node_ids": [2]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9786782000260732, "error": 0.0026670381434772696, "node_ids": [12]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9909211630670892, "error": 0.0007152094432614018, "node_ids": [22]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9415478931544796, "error": 0.006478913437999898, "node_ids": [32]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9919403414158664, "error": 0.0021398792498404976, "node_ids": [3]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9981863348040538, "error": 9.129916500736488e-05, "node_ids": [13]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9955172035113002, "error": 0.0002772939154287422, "node_ids": [23]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.996377104491955, "error": 0.0002032732295012543, "node_ids": [33]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.99735940556863, "error": 0.00021986632028144252, "node_ids": [4]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.995523607849658, "error": 0.000203890237660312, "node_ids": [14]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9860102097844138, "error": 0.0015401413663105469, "node_ids": [24]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.995524060615001, "error": 0.00022246174207002755, "node_ids": [34]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.997842970001742, "error": 0.00015989543148329767, "node_ids": [5]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9995497829780498, "error": 0.003954173650592231, "node_ids": [15]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9960500778954632, "error": 0.0005233098365838534, "node_ids": [25]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9977090027105656, "error": 0.00018549214552767492, "node_ids": [35]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.964992943378162, "error": 0.00662112077735874, "node_ids": [6]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9939967978894072, "error": 0.0007144728746783534, "node_ids": [16]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9964726338900656, "error": 0.00023818130993591335, "node_ids": [26]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9909873575828996, "error": 0.0008442821510109252, "node_ids": [36]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9972167990210178, "error": 0.00015943015558359975, "node_ids": [7]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9966812548731848, "error": 0.00026586831036954956, "node_ids": [17]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9920191864527615, "error": 0.0006318071314806755, "node_ids": [27]}, {"name": "fRB", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.5811349166005083, "error": 0.19498095021915748, "node_ids": [37]}], "node_ids": [0, 10, 20, 30, 1, 11, 21, 31, 2, 12, 22, 32, 3, 13, 23, 33, 4, 14, 24, 34, 5, 15, 25, 35, 6, 16, 26, 36, 7, 17, 27, 37]}], "node_count": 32}], "instructions": [{"characteristics": [], "name": "RESET", "parameters": [], "sites": [{"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.998}], "node_ids": [0]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.999}], "node_ids": [10]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975}], "node_ids": [20]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9965}], "node_ids": [30]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9955000000000002}], "node_ids": [1]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.955}], "node_ids": [11]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9935}], "node_ids": [21]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.996}], "node_ids": [31]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975}], "node_ids": [2]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.999}], "node_ids": [12]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975}], "node_ids": [22]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.934}], "node_ids": [32]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.991}], "node_ids": [3]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9975}], "node_ids": [13]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.998}], "node_ids": [23]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9915}], "node_ids": [33]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9985}], "node_ids": [4]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.999}], "node_ids": [14]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.975}], "node_ids": [24]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9995}], "node_ids": [34]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.992}], "node_ids": [5]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.998}], "node_ids": [15]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.995}], "node_ids": [25]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.999}], "node_ids": [35]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9775}], "node_ids": [6]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.998}], "node_ids": [16]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.998}], "node_ids": [26]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.998}], "node_ids": [36]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9905000000000002}], "node_ids": [7]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9595}], "node_ids": [17]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9895}], "node_ids": [27]}, {"characteristics": [{"name": "fAR", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.972}], "node_ids": [37]}], "node_count": 1}, {"characteristics": [], "name": "I", "parameters": [], "sites": [{"characteristics": [], "node_ids": [0]}, {"characteristics": [], "node_ids": [10]}, {"characteristics": [], "node_ids": [20]}, {"characteristics": [], "node_ids": [30]}, {"characteristics": [], "node_ids": [1]}, {"characteristics": [], "node_ids": [11]}, {"characteristics": [], "node_ids": [21]}, {"characteristics": [], "node_ids": [31]}, {"characteristics": [], "node_ids": [2]}, {"characteristics": [], "node_ids": [12]}, {"characteristics": [], "node_ids": [22]}, {"characteristics": [], "node_ids": [32]}, {"characteristics": [], "node_ids": [3]}, {"characteristics": [], "node_ids": [13]}, {"characteristics": [], "node_ids": [23]}, {"characteristics": [], "node_ids": [33]}, {"characteristics": [], "node_ids": [4]}, {"characteristics": [], "node_ids": [14]}, {"characteristics": [], "node_ids": [24]}, {"characteristics": [], "node_ids": [34]}, {"characteristics": [], "node_ids": [5]}, {"characteristics": [], "node_ids": [15]}, {"characteristics": [], "node_ids": [25]}, {"characteristics": [], "node_ids": [35]}, {"characteristics": [], "node_ids": [6]}, {"characteristics": [], "node_ids": [16]}, {"characteristics": [], "node_ids": [26]}, {"characteristics": [], "node_ids": [36]}, {"characteristics": [], "node_ids": [7]}, {"characteristics": [], "node_ids": [17]}, {"characteristics": [], "node_ids": [27]}, {"characteristics": [], "node_ids": [37]}], "node_count": 1}, {"characteristics": [], "name": "RX", "parameters": [{"name": "theta"}], "sites": [{"characteristics": [], "node_ids": [0]}, {"characteristics": [], "node_ids": [10]}, {"characteristics": [], "node_ids": [20]}, {"characteristics": [], "node_ids": [30]}, {"characteristics": [], "node_ids": [1]}, {"characteristics": [], "node_ids": [11]}, {"characteristics": [], "node_ids": [21]}, {"characteristics": [], "node_ids": [31]}, {"characteristics": [], "node_ids": [2]}, {"characteristics": [], "node_ids": [12]}, {"characteristics": [], "node_ids": [22]}, {"characteristics": [], "node_ids": [32]}, {"characteristics": [], "node_ids": [3]}, {"characteristics": [], "node_ids": [13]}, {"characteristics": [], "node_ids": [23]}, {"characteristics": [], "node_ids": [33]}, {"characteristics": [], "node_ids": [4]}, {"characteristics": [], "node_ids": [14]}, {"characteristics": [], "node_ids": [24]}, {"characteristics": [], "node_ids": [34]}, {"characteristics": [], "node_ids": [5]}, {"characteristics": [], "node_ids": [15]}, {"characteristics": [], "node_ids": [25]}, {"characteristics": [], "node_ids": [35]}, {"characteristics": [], "node_ids": [6]}, {"characteristics": [], "node_ids": [16]}, {"characteristics": [], "node_ids": [26]}, {"characteristics": [], "node_ids": [36]}, {"characteristics": [], "node_ids": [7]}, {"characteristics": [], "node_ids": [17]}, {"characteristics": [], "node_ids": [27]}, {"characteristics": [], "node_ids": [37]}], "node_count": 1}, {"characteristics": [], "name": "RZ", "parameters": [{"name": "theta"}], "sites": [{"characteristics": [], "node_ids": [0]}, {"characteristics": [], "node_ids": [10]}, {"characteristics": [], "node_ids": [20]}, {"characteristics": [], "node_ids": [30]}, {"characteristics": [], "node_ids": [1]}, {"characteristics": [], "node_ids": [11]}, {"characteristics": [], "node_ids": [21]}, {"characteristics": [], "node_ids": [31]}, {"characteristics": [], "node_ids": [2]}, {"characteristics": [], "node_ids": [12]}, {"characteristics": [], "node_ids": [22]}, {"characteristics": [], "node_ids": [32]}, {"characteristics": [], "node_ids": [3]}, {"characteristics": [], "node_ids": [13]}, {"characteristics": [], "node_ids": [23]}, {"characteristics": [], "node_ids": [33]}, {"characteristics": [], "node_ids": [4]}, {"characteristics": [], "node_ids": [14]}, {"characteristics": [], "node_ids": [24]}, {"characteristics": [], "node_ids": [34]}, {"characteristics": [], "node_ids": [5]}, {"characteristics": [], "node_ids": [15]}, {"characteristics": [], "node_ids": [25]}, {"characteristics": [], "node_ids": [35]}, {"characteristics": [], "node_ids": [6]}, {"characteristics": [], "node_ids": [16]}, {"characteristics": [], "node_ids": [26]}, {"characteristics": [], "node_ids": [36]}, {"characteristics": [], "node_ids": [7]}, {"characteristics": [], "node_ids": [17]}, {"characteristics": [], "node_ids": [27]}, {"characteristics": [], "node_ids": [37]}], "node_count": 1}, {"characteristics": [], "name": "CZ", "parameters": [], "sites": [{"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.975365150434536, "error": 0.004595877776144091}], "node_ids": [10, 11]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9755866659041524, "error": 0.005243058783945565}], "node_ids": [20, 21]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8286900221431495, "error": 0.01143090379181824}], "node_ids": [30, 31]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9001687193979396, "error": 0.0051462406107075035}], "node_ids": [11, 12]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.944974396250466, "error": 0.008870880926108419}], "node_ids": [21, 22]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9085683878344128, "error": 0.0043219459614298635}], "node_ids": [31, 32]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8910153098573566, "error": 0.004731463104524665}], "node_ids": [2, 3]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9108126881271944, "error": 0.005125591528241701}], "node_ids": [12, 13]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9435032010819236, "error": 0.0072239386614387615}], "node_ids": [22, 23]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8898217192054831, "error": 0.005739120215314847}], "node_ids": [32, 33]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9649680103756876, "error": 0.005516937483191729}], "node_ids": [3, 4]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9394355816363972, "error": 0.00988838667854407}], "node_ids": [13, 14]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9765203186195568, "error": 0.0037725624801795182}], "node_ids": [23, 24]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9526204716031628, "error": 0.006468456763689166}], "node_ids": [33, 34]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9780527372139808, "error": 0.00504707888147652}], "node_ids": [4, 5]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9676202635031828, "error": 0.0049731206507193605}], "node_ids": [14, 15]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9609775366189536, "error": 0.00644143184791523}], "node_ids": [24, 25]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.7645607126725205, "error": 0.019745777486102224}], "node_ids": [34, 35]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8303763369116465, "error": 0.010060319465128987}], "node_ids": [5, 6]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9540445504947002, "error": 0.00824474518610689}], "node_ids": [25, 26]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9748429614517268, "error": 0.003841862891031863}], "node_ids": [35, 36]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8100634896998636, "error": 0.013825786636139733}], "node_ids": [6, 7]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.6931833831938762, "error": 0.014458938417054416}], "node_ids": [26, 27]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9592041261648117, "error": 0.010261521106087522}], "node_ids": [36, 37]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.907931230854452, "error": 0.00462849569244367}], "node_ids": [7, 0]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9850629080777664, "error": 0.0029074065516894376}], "node_ids": [17, 10]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9664265725526412, "error": 0.005271410143088285}], "node_ids": [27, 20]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.898843774874425, "error": 0.00620532032682923}], "node_ids": [37, 30]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.831062204997676, "error": 0.010078958447311916}], "node_ids": [2, 15]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9632969350239442, "error": 0.01399614316407363}], "node_ids": [12, 25]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9672297760436877, "error": 0.005915791891666202}], "node_ids": [22, 35]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8366644245586075, "error": 0.01036661865070287}], "node_ids": [11, 26]}, {"characteristics": [{"name": "fCZ", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9761030583154752, "error": 0.0054147347800857}], "node_ids": [21, 36]}], "node_count": 2}, {"characteristics": [], "name": "CPHASE", "parameters": [{"name": "theta"}], "sites": [{"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.01, "error": 0.99}], "node_ids": [0, 1]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.971463228307044, "error": 0.004966716794602377}], "node_ids": [10, 11]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9159572953149564, "error": 0.005160833340164584}], "node_ids": [20, 21]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8628084595375912, "error": 0.008160606048372532}], "node_ids": [30, 31]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8925539716389217, "error": 0.006244663392810073}], "node_ids": [11, 12]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9584133294973214, "error": 0.007852363863179135}], "node_ids": [21, 22]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9160204214206844, "error": 0.004146337212883622}], "node_ids": [31, 32]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8135531082164847, "error": 0.011869659372099307}], "node_ids": [2, 3]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8798751066241616, "error": 0.010196338682047385}], "node_ids": [12, 13]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9026789964398356, "error": 0.004178452124873687}], "node_ids": [22, 23]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.920846957360482, "error": 0.005068014171996361}], "node_ids": [32, 33]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9139225038168148, "error": 0.004746224523520801}], "node_ids": [3, 4]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8481829567666604, "error": 0.010053300115386304}], "node_ids": [13, 14]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9062978129000504, "error": 0.0057453364879587986}], "node_ids": [23, 24]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.97237265675814, "error": 0.006755653591009474}], "node_ids": [33, 34]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9651167470310014, "error": 0.0058397592505465366}], "node_ids": [4, 5]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.90295400434075, "error": 0.008522504495468371}], "node_ids": [14, 15]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8742061183538135, "error": 0.008474532564905907}], "node_ids": [24, 25]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8864299901243485, "error": 0.007743788127405063}], "node_ids": [34, 35]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8270359832510702, "error": 0.01080348282143765}], "node_ids": [5, 6]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9085674351041704, "error": 0.004684825943666367}], "node_ids": [25, 26]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.929812817846686, "error": 0.01368822069184763}], "node_ids": [35, 36]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8546894721495946, "error": 0.009861048187905194}], "node_ids": [6, 7]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8247592143305311, "error": 0.01156746875308558}], "node_ids": [26, 27]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8945168789871193, "error": 0.00747536376919003}], "node_ids": [36, 37]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8549488544090957, "error": 0.008990124631734327}], "node_ids": [7, 0]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.981681438773504, "error": 0.002913510478450287}], "node_ids": [17, 10]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8836580663650178, "error": 0.005364576091308071}], "node_ids": [27, 20]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8124545973743267, "error": 0.011642660641579629}], "node_ids": [37, 30]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8245988553430752, "error": 0.010897575376382074}], "node_ids": [2, 15]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8524297264513226, "error": 0.010322677060797123}], "node_ids": [22, 35]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8675348226369772, "error": 0.008546198017427715}], "node_ids": [11, 26]}, {"characteristics": [{"name": "fCPHASE", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9496135242835484, "error": 0.011067609289883268}], "node_ids": [21, 36]}], "node_count": 2}, {"characteristics": [], "name": "XY", "parameters": [{"name": "theta"}], "sites": [{"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8408157479939731, "error": 0.007848729837003356, "parameter_values": [3.141592653589793]}], "node_ids": [0, 1]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9709860226780592, "error": 0.004091597917307637, "parameter_values": [3.141592653589793]}], "node_ids": [10, 11]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9619869304728842, "error": 0.007472036847948983, "parameter_values": [3.141592653589793]}], "node_ids": [20, 21]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.7890022861131419, "error": 0.014233215746447894, "parameter_values": [3.141592653589793]}], "node_ids": [30, 31]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8765573605619301, "error": 0.007230212688935576, "parameter_values": [3.141592653589793]}], "node_ids": [11, 12]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.939742124903578, "error": 0.009435007887419413, "parameter_values": [3.141592653589793]}], "node_ids": [21, 22]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9061824925262804, "error": 0.003847793047051725, "parameter_values": [3.141592653589793]}], "node_ids": [31, 32]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.849378211977543, "error": 0.007166695761996091, "parameter_values": [3.141592653589793]}], "node_ids": [2, 3]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8840680096280568, "error": 0.007745303311191681, "parameter_values": [3.141592653589793]}], "node_ids": [12, 13]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.900499175316029, "error": 0.004463837481400907, "parameter_values": [3.141592653589793]}], "node_ids": [22, 23]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8336403155141315, "error": 0.010597887696785517, "parameter_values": [3.141592653589793]}], "node_ids": [32, 33]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9108127609480108, "error": 0.003538280144219538, "parameter_values": [3.141592653589793]}], "node_ids": [3, 4]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9560786183831672, "error": 0.005826844879391893, "parameter_values": [3.141592653589793]}], "node_ids": [13, 14]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.970818348258536, "error": 0.003839904906044908, "parameter_values": [3.141592653589793]}], "node_ids": [23, 24]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9710797386281216, "error": 0.005615929445161049, "parameter_values": [3.141592653589793]}], "node_ids": [33, 34]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9821007073186796, "error": 0.007377414108448926, "parameter_values": [3.141592653589793]}], "node_ids": [4, 5]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9551859905395716, "error": 0.008451625878969249, "parameter_values": [3.141592653589793]}], "node_ids": [14, 15]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9663900014538211, "error": 0.007411221388838454, "parameter_values": [3.141592653589793]}], "node_ids": [24, 25]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value":0.9694620491354924, "error": 0.006227536795285905, "parameter_values": [3.141592653589793]}], "node_ids": [34, 35]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8086263752246989, "error":0.01456938717851194, "parameter_values": [3.141592653589793]}], "node_ids": [5, 6]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8240523379346644, "error": 0.01020619149175649, "parameter_values": [3.141592653589793]}], "node_ids": [25, 26]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value":0.9718891745852616, "error": 0.007522952516893043, "parameter_values": [3.141592653589793]}], "node_ids": [35, 36]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8534291802657573, "error": 0.006298878108899186, "parameter_values": [3.141592653589793]}], "node_ids": [6, 7]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8135556166229594, "error": 0.01315476937658125, "parameter_values": [3.141592653589793]}], "node_ids": [16, 17]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8139470185135277, "error": 0.008910243205244979, "parameter_values": [3.141592653589793]}], "node_ids": [26, 27]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value":0.9713067841516584, "error": 0.003905305899671171, "parameter_values": [3.141592653589793]}], "node_ids": [36, 37]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9775132262708732, "error": 0.008213354306011474, "parameter_values": [3.141592653589793]}], "node_ids": [7, 0]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9776629109228542, "error": 0.0064359539619436405, "parameter_values": [3.141592653589793]}], "node_ids": [17, 10]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9089422694822248, "error":0.0038930465852373983, "parameter_values": [3.141592653589793]}], "node_ids": [27, 20]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8916354354901699, "error": 0.0065613812392840394, "parameter_values": [3.141592653589793]}], "node_ids": [37, 30]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8743317615472828, "error": 0.006341462805366402, "parameter_values": [3.141592653589793]}], "node_ids": [2, 15]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8846873458300735, "error": 0.006271203484774115, "parameter_values": [3.141592653589793]}], "node_ids": [12, 25]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9738714323675588, "error": 0.0058662900384041875, "parameter_values": [3.141592653589793]}], "node_ids": [22, 35]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8377296616522574, "error": 0.007949806734800124, "parameter_values": [3.141592653589793]}], "node_ids": [1, 16]}, {"characteristics": [{"name": "fXY", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9608100658834562, "error": 0.01190020699313093, "parameter_values": [3.141592653589793]}], "node_ids": [21, 36]}], "node_count": 2}, {"characteristics": [], "name": "MEASURE", "parameters": [], "sites": [{"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.97}], "node_ids": [0]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.961}], "node_ids": [10]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.983}], "node_ids": [20]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.924}], "node_ids": [30]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.963}], "node_ids": [1]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.897}], "node_ids": [11]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.962}], "node_ids": [21]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9469999999999998}], "node_ids": [31]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.9469999999999998}], "node_ids": [2]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.7989999999999999}], "node_ids": [12]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.965}], "node_ids": [22]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.88}], "node_ids": [32]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.944}], "node_ids": [3]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.973}], "node_ids": [13]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value":0.974}], "node_ids": [23]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.911}], "node_ids": [33]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.968}], "node_ids": [4]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.926}], "node_ids": [14]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.968}], "node_ids": [24]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.977}], "node_ids": [34]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.945}], "node_ids": [5]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.955}], "node_ids": [15]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.978}], "node_ids": [25]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.968}], "node_ids": [35]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.8180000000000001}], "node_ids": [6]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.871}], "node_ids": [16]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.975}], "node_ids": [26]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.948}], "node_ids": [36]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.967}], "node_ids": [7]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.905}], "node_ids": [17]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.914}], "node_ids": [27]}, {"characteristics": [{"name": "fRO", "timestamp": "1970-01-01T00:00:00+00:00", "value": 0.957}], "node_ids": [37]}], "node_count": 1}], "name": "Aspen-9"} } \ No newline at end of file diff --git a/cirq-rigetti/cirq_rigetti/quil_input.py b/cirq-rigetti/cirq_rigetti/quil_input.py index 9de48536fa7..99464298169 100644 --- a/cirq-rigetti/cirq_rigetti/quil_input.py +++ b/cirq-rigetti/cirq_rigetti/quil_input.py @@ -12,10 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Callable, cast, Dict, Union +from typing import Any, Callable, Type, cast, Dict, Union, List, Tuple, Optional +import sympy import numpy as np -from pyquil.parser import parse +from numpy.typing import NDArray + +from pyquil.quil import Program from pyquil.quilbase import ( Declare, DefGate, @@ -24,160 +27,216 @@ Pragma, Reset, ResetQubit, + Fence, + FenceAll, ) - -from cirq import Circuit, LineQubit -from cirq.ops import ( - CCNOT, - CNOT, - CSWAP, - CZ, - CZPowGate, - Gate, - H, - I, - ISWAP, - ISwapPowGate, - MatrixGate, - MeasurementGate, - S, - SWAP, - T, - TwoQubitDiagonalGate, - X, - Y, - Z, - ZPowGate, - rx, - ry, - rz, +from pyquil.quilatom import ( + MemoryReference, + ParameterDesignator, + QubitDesignator, + Function, + BinaryExp, + Add, + Sub, + Mul, + Div, + Pow, + Parameter, + substitute_array, + qubit_index, ) +from pyquil.simulation import matrices + +import cirq +from cirq.circuits.circuit import Circuit +from cirq.devices.insertion_noise_model import InsertionNoiseModel +from cirq.protocols.circuit_diagram_info_protocol import CircuitDiagramInfoArgs, CircuitDiagramInfo +from cirq.devices.line_qubit import LineQubit +from cirq.devices.noise_utils import OpIdentifier +from cirq.value import value_equality +from cirq.protocols import is_parameterized + +from cirq.ops.common_gates import CNOT, CZ, CZPowGate, H, S, T, ZPowGate, YPowGate, XPowGate +from cirq.ops.parity_gates import ZZPowGate, XXPowGate, YYPowGate +from cirq.ops.pauli_gates import X, Y, Z +from cirq.ops.fsim_gate import FSimGate, PhasedFSimGate +from cirq.ops.identity import I +from cirq.ops.matrix_gates import MatrixGate +from cirq.ops.measurement_gate import MeasurementGate +from cirq.ops.swap_gates import ISWAP, ISwapPowGate, SWAP +from cirq.ops.three_qubit_gates import CCNOT, CSWAP +from cirq.ops.raw_types import Gate +from cirq.ops.kraus_channel import KrausChannel +from cirq._compat import cached_method class UndefinedQuilGate(Exception): - pass + """Error for a undefined Quil Gate.""" class UnsupportedQuilInstruction(Exception): - pass + """Error for a unsupported instruction.""" # -# Functions for converting supported parameterized Quil gates. +# Cirq doesn't have direct analogues of these Quil gates # -def cphase(param: float) -> CZPowGate: - """Returns a controlled-phase gate as a Cirq CZPowGate with exponent - determined by the input param. The angle parameter of pyQuil's CPHASE - gate and the exponent of Cirq's CZPowGate differ by a factor of pi. +@value_equality(distinct_child_types=True, approximate=True) +class CPHASE00(Gate): + """Cirq equivalent to Quil CPHASE00.""" - Args: - param: Gate parameter (in radians). + def __init__(self, phi): + super().__init__() + self.phi = phi - Returns: - A CZPowGate equivalent to a CPHASE gate of given angle. - """ - return CZPowGate(exponent=param / np.pi) + def _num_qubits_(self): + return 2 + def _unitary_(self): + return matrices.CPHASE00(self.phi) -def cphase00(phi: float) -> TwoQubitDiagonalGate: - """Returns a Cirq TwoQubitDiagonalGate for pyQuil's CPHASE00 gate. + def _circuit_diagram_info_( + self, args: CircuitDiagramInfoArgs + ) -> CircuitDiagramInfo: # pragma: no cover + return CircuitDiagramInfo(wire_symbols=("@00", "@00"), exponent=self.phi / np.pi) - In pyQuil, CPHASE00(phi) = diag([exp(1j * phi), 1, 1, 1]), and in Cirq, - a TwoQubitDiagonalGate is specified by its diagonal in radians, which - would be [phi, 0, 0, 0]. + def __repr__(self) -> str: # pragma: no cover + """Represent the CPHASE gate as a string.""" + return f"CPHASE00({self.phi:.3f})" - Args: - phi: Gate parameter (in radians). + def _resolve_parameters_( + self, resolver: cirq.ParamResolver, recursive: bool + ) -> Gate: # pragma: no cover + return type(self)(phi=resolver.value_of(self.phi, recursive)) - Returns: - A TwoQubitDiagonalGate equivalent to a CPHASE00 gate of given angle. - """ - return TwoQubitDiagonalGate([phi, 0, 0, 0]) + def _is_parameterized_(self) -> bool: # pragma: no cover + parameter_names = ["phi"] + return any(is_parameterized(getattr(self, p)) for p in parameter_names) + def _value_equality_values_(self): # pragma: no cover + return (self.phi,) -def cphase01(phi: float) -> TwoQubitDiagonalGate: - """Returns a Cirq TwoQubitDiagonalGate for pyQuil's CPHASE01 gate. + def _value_equality_approximate_values_(self): # pragma: no cover + return (self.phi,) - In pyQuil, CPHASE01(phi) = diag(1, [exp(1j * phi), 1, 1]), and in Cirq, - a TwoQubitDiagonalGate is specified by its diagonal in radians, which - would be [0, phi, 0, 0]. - Args: - phi: Gate parameter (in radians). +@value_equality(distinct_child_types=True, approximate=True) +class CPHASE01(Gate): + """Cirq equivalent to Quil CPHASE01.""" - Returns: - A TwoQubitDiagonalGate equivalent to a CPHASE01 gate of given angle. - """ - return TwoQubitDiagonalGate([0, phi, 0, 0]) + def __init__(self, phi): + super().__init__() + self.phi = phi + def _num_qubits_(self): + return 2 -def cphase10(phi: float) -> TwoQubitDiagonalGate: - """Returns a Cirq TwoQubitDiagonalGate for pyQuil's CPHASE10 gate. + def _unitary_(self): + return matrices.CPHASE01(self.phi) - In pyQuil, CPHASE10(phi) = diag(1, 1, [exp(1j * phi), 1]), and in Cirq, - a TwoQubitDiagonalGate is specified by its diagonal in radians, which - would be [0, 0, phi, 0]. + def _circuit_diagram_info_( + self, args: CircuitDiagramInfoArgs + ) -> CircuitDiagramInfo: # pragma: no cover + return CircuitDiagramInfo(wire_symbols=("@01", "@01"), exponent=self.phi / np.pi) - Args: - phi: Gate parameter (in radians). + def __repr__(self) -> str: # pragma: no cover + """Represent the CPHASE gate as a string.""" + return f"CPHASE01({self.phi:.3f})" - Returns: - A TwoQubitDiagonalGate equivalent to a CPHASE10 gate of given angle. - """ - return TwoQubitDiagonalGate([0, 0, phi, 0]) + def _resolve_parameters_( + self, resolver: cirq.ParamResolver, recursive: bool + ) -> Gate: # pragma: no cover + return type(self)(phi=resolver.value_of(self.phi, recursive)) + def _is_parameterized_(self) -> bool: # pragma: no cover + parameter_names = ["phi"] + return any(is_parameterized(getattr(self, p)) for p in parameter_names) -def phase(param: float) -> ZPowGate: - """Returns a single-qubit phase gate as a Cirq ZPowGate with exponent - determined by the input param. The angle parameter of pyQuil's PHASE - gate and the exponent of Cirq's ZPowGate differ by a factor of pi. + def _value_equality_values_(self): # pragma: no cover + return (self.phi,) - Args: - param: Gate parameter (in radians). + def _value_equality_approximate_values_(self): # pragma: no cover + return (self.phi,) - Returns: - A ZPowGate equivalent to a PHASE gate of given angle. - """ - return ZPowGate(exponent=param / np.pi) +@value_equality(distinct_child_types=True, approximate=True) +class CPHASE10(Gate): + """Cirq equivalent to Quil CPHASE10.""" -def pswap(phi: float) -> MatrixGate: - """Returns a Cirq MatrixGate for pyQuil's PSWAP gate. + def __init__(self, phi): + super().__init__() + self.phi = phi - Args: - phi: Gate parameter (in radians). + def _num_qubits_(self): + return 2 - Returns: - A MatrixGate equivalent to a PSWAP gate of given angle. - """ - # fmt: off - pswap_matrix = np.array( - [ - [1, 0, 0, 0], - [0, 0, np.exp(1j * phi), 0], - [0, np.exp(1j * phi), 0, 0], - [0, 0, 0, 1] - ], - dtype=complex, - ) - # fmt: on - return MatrixGate(pswap_matrix) + def _unitary_(self): + return matrices.CPHASE10(self.phi) + def _circuit_diagram_info_( + self, args: CircuitDiagramInfoArgs + ) -> CircuitDiagramInfo: # pragma: no cover + return CircuitDiagramInfo(wire_symbols=("@10", "@10"), exponent=self.phi / np.pi) -def xy(param: float) -> ISwapPowGate: - """Returns an ISWAP-family gate as a Cirq ISwapPowGate with exponent - determined by the input param. The angle parameter of pyQuil's XY gate - and the exponent of Cirq's ISwapPowGate differ by a factor of pi. + def __repr__(self) -> str: # pragma: no cover + """Represent the CPHASE gate as a string.""" + return f"CPHASE10({self.phi:.3f})" - Args: - param: Gate parameter (in radians). + def _resolve_parameters_( + self, resolver: cirq.ParamResolver, recursive: bool + ) -> Gate: # pragma: no cover + return type(self)(phi=resolver.value_of(self.phi, recursive)) - Returns: - An ISwapPowGate equivalent to an XY gate of given angle. - """ - return ISwapPowGate(exponent=param / np.pi) + def _is_parameterized_(self) -> bool: # pragma: no cover + parameter_names = ["phi"] + return any(is_parameterized(getattr(self, p)) for p in parameter_names) + + def _value_equality_values_(self): # pragma: no cover + return (self.phi,) + + def _value_equality_approximate_values_(self): # pragma: no cover + return (self.phi,) + + +@value_equality(distinct_child_types=True, approximate=True) +class PSWAP(Gate): + """Cirq equivalent to Quil PSWAP.""" + + def __init__(self, phi): + super().__init__() + self.phi = phi + + def _num_qubits_(self): + return 2 + + def _unitary_(self): + return matrices.PSWAP(self.phi) + + def _circuit_diagram_info_( + self, args: CircuitDiagramInfoArgs + ) -> CircuitDiagramInfo: # pragma: no cover + return CircuitDiagramInfo(wire_symbols=("PSWAP", "PSWAP"), exponent=self.phi / np.pi) + + def __repr__(self) -> str: # pragma: no cover + """Represent the PSWAP gate as a string.""" + return f"PSWAP({self.phi:.3f})" + + def _resolve_parameters_( + self, resolver: cirq.ParamResolver, recursive: bool + ) -> Gate: # pragma: no cover + return type(self)(phi=resolver.value_of(self.phi, recursive)) + + def _is_parameterized_(self) -> bool: # pragma: no cover + parameter_names = ["phi"] + return any(is_parameterized(getattr(self, p)) for p in parameter_names) + + def _value_equality_values_(self): # pragma: no cover + return (self.phi,) + + def _value_equality_approximate_values_(self): # pragma: no cover + return (self.phi,) PRAGMA_ERROR = """ @@ -190,35 +249,62 @@ def xy(param: float) -> ISwapPowGate: RESET directives have special meaning on QCS, to enable active reset. """ + # Parameterized gates map to functions that produce Gate constructors. SUPPORTED_GATES: Dict[str, Union[Gate, Callable[..., Gate]]] = { "CCNOT": CCNOT, "CNOT": CNOT, "CSWAP": CSWAP, - "CPHASE": cphase, - "CPHASE00": cphase00, - "CPHASE01": cphase01, - "CPHASE10": cphase10, + "CPHASE": CZPowGate, + "CPHASE00": CPHASE00, + "CPHASE01": CPHASE01, + "CPHASE10": CPHASE10, + "PSWAP": PSWAP, "CZ": CZ, - "PHASE": phase, + "PHASE": ZPowGate, "H": H, "I": I, "ISWAP": ISWAP, - "PSWAP": pswap, - "RX": rx, - "RY": ry, - "RZ": rz, + "RX": XPowGate, + "RY": YPowGate, + "RZ": ZPowGate, "S": S, "SWAP": SWAP, "T": T, "X": X, "Y": Y, "Z": Z, - "XY": xy, + "XY": ISwapPowGate, + "RZZ": ZZPowGate, + "RYY": YYPowGate, + "RXX": XXPowGate, + "FSIM": FSimGate, + "PHASEDFSIM": PhasedFSimGate, +} + +# Gate parameters must be transformed to Cirq units +PARAMETRIC_TRANSFORMERS: Dict[str, Callable] = { + "CPHASE": lambda theta: dict(exponent=theta / np.pi, global_shift=0.0), + "CPHASE00": lambda phi: dict(phi=phi), + "CPHASE01": lambda phi: dict(phi=phi), + "CPHASE10": lambda phi: dict(phi=phi), + "PSWAP": lambda phi: dict(phi=phi), + "PHASE": lambda theta: dict(exponent=theta / np.pi, global_shift=-0.0), + "XY": lambda theta: dict(exponent=theta / np.pi, global_shift=0.0), + "RX": lambda theta: dict(exponent=theta / np.pi, global_shift=-0.5), + "RY": lambda theta: dict(exponent=theta / np.pi, global_shift=-0.5), + "RZ": lambda theta: dict(exponent=theta / np.pi, global_shift=-0.5), + "RXX": lambda theta: dict(exponent=theta / np.pi, global_shift=-0.5), + "RYY": lambda theta: dict(exponent=theta / np.pi, global_shift=-0.5), + "RZZ": lambda theta: dict(exponent=theta / np.pi, global_shift=-0.5), + "FSIM": lambda theta, phi: dict(theta=-1 * theta / 2, phi=-1 * phi), + "PHASEDFSIM": lambda theta, zeta, chi, gamma, phi: dict( + theta=-1 * theta / 2, zeta=zeta, chi=chi, gamma=gamma, phi=-1 * phi + ), } -def circuit_from_quil(quil: str) -> Circuit: +def circuit_from_quil(quil: Union[str, Program]) -> Circuit: """Convert a Quil program to a Cirq Circuit. Args: @@ -234,50 +320,118 @@ def circuit_from_quil(quil: str) -> Circuit: References: https://github.com/rigetti/pyquil """ + if isinstance(quil, str): + program = Program(quil) + else: + program = quil circuit = Circuit() - defined_gates = SUPPORTED_GATES.copy() - instructions = parse(quil) - for inst in instructions: - # Add DEFGATE-defined gates to defgates dict using MatrixGate. - if isinstance(inst, DefGate): - if inst.parameters: - raise UnsupportedQuilInstruction( - "Parameterized DEFGATEs are currently unsupported." - ) - defined_gates[inst.name] = MatrixGate(inst.matrix) + defined_gates, parameter_transformers = get_defined_gates(program) + + kraus_model: Dict[Tuple[QubitDesignator, ...], List[NDArray[np.complex_]]] = {} + confusion_maps: Dict[int, NDArray[np.float_]] = {} + + # Interpret the Pragmas + for inst in program: + if not isinstance(inst, Pragma): # pragma: no cover + continue + + # ADD-KRAUS provides Kraus operators that replace the gate operation + if inst.command == "ADD-KRAUS": # pragma: no cover + args = inst.args + gate_name = str(args[0]) + if gate_name in matrices.QUANTUM_GATES: + u = matrices.QUANTUM_GATES[gate_name] + elif gate_name in defined_gates: + u = defined_gates[gate_name] + else: + raise UndefinedQuilGate(f"{gate_name} is not known.") + + entries = np.fromstring( + inst.freeform_string.strip("()").replace("i", "j"), dtype=np.complex_, sep=" " + ) + dim = int(np.sqrt(len(entries))) + kraus_gate_op = entries.reshape((dim, dim)) + + kraus_op = remove_gate_from_kraus([kraus_gate_op], u)[0] + + if args in kraus_model: + kraus_model[args].append(kraus_op) + else: + kraus_model[args] = [kraus_op] + + # READOUT-POVM provides a confusion matrix + elif inst.command == "READOUT-POVM": + qubit = qubit_index(inst.args[0]) + entries = np.fromstring( + inst.freeform_string.strip("()").replace("i", "j"), dtype=np.float_, sep=" " + ) + confusion_matrix = entries.reshape((2, 2)).T + + # these types actually agree - both arrays are floats + confusion_maps[qubit] = confusion_matrix # type: ignore + + else: + raise UnsupportedQuilInstruction(PRAGMA_ERROR) # pragma: no cover + # Interpret the instructions + for inst in program: # Pass when encountering a DECLARE. - elif isinstance(inst, Declare): + if isinstance(inst, Declare): pass # Convert pyQuil gates to Cirq operations. elif isinstance(inst, PyQuilGate): quil_gate_name = inst.name quil_gate_params = inst.params - line_qubits = list(LineQubit(q.index) for q in inst.qubits) + line_qubits = list(LineQubit(qubit_index(q)) for q in inst.qubits) if quil_gate_name not in defined_gates: raise UndefinedQuilGate(f"Quil gate {quil_gate_name} not supported in Cirq.") cirq_gate_fn = defined_gates[quil_gate_name] if quil_gate_params: - circuit += cast(Callable[..., Gate], cirq_gate_fn)(*quil_gate_params)(*line_qubits) + params = [quil_expression_to_sympy(p) for p in quil_gate_params] + transformer = parameter_transformers[quil_gate_name] + circuit += cast(Callable[..., Gate], cirq_gate_fn)(**transformer(*params))( + *line_qubits + ) else: circuit += cirq_gate_fn(*line_qubits) # Convert pyQuil MEASURE operations to Cirq MeasurementGate objects. elif isinstance(inst, PyQuilMeasurement): - line_qubit = LineQubit(inst.qubit.index) + qubit = qubit_index(inst.qubit) + line_qubit = LineQubit(qubit) if inst.classical_reg is None: raise UnsupportedQuilInstruction( f"Quil measurement {inst} without classical register " f"not currently supported in Cirq." ) quil_memory_reference = inst.classical_reg.out() - circuit += MeasurementGate(1, key=quil_memory_reference)(line_qubit) + if qubit in confusion_maps: + cmap: Dict[Tuple[int, ...], NDArray[np.float_]] = {(qubit,): confusion_maps[qubit]} + """ + Argument "confusion_map" to "MeasurementGate" has incompatible type + " Dict[Tuple[int], ndarray[Any, dtype[floating[Any]]]]" + expected + "Optional[Dict[Tuple[int, ...], ndarray[Any, Any]]]" + """ + circuit += MeasurementGate(1, key=quil_memory_reference, confusion_map=cmap)( + line_qubit + ) + else: + circuit += MeasurementGate(1, key=quil_memory_reference)(line_qubit) - # Raise a targeted error when encountering a PRAGMA. + # PRAGMAs elif isinstance(inst, Pragma): - raise UnsupportedQuilInstruction(PRAGMA_ERROR) + continue + + # Drop FENCE statements + elif isinstance(inst, (Fence, FenceAll)): # pragma: no cover + continue + + # Drop DEFGATES + elif isinstance(inst, (DefGate)): # pragma: no cover + continue # Raise a targeted error when encountering a RESET. elif isinstance(inst, (Reset, ResetQubit)): @@ -289,4 +443,208 @@ def circuit_from_quil(quil: str) -> Circuit: f"Quil instruction {inst} of type {type(inst)} not currently supported in Cirq." ) + if len(kraus_model) > 0: # pragma: no cover + noise_model = kraus_noise_model_to_cirq(kraus_model, defined_gates) + circuit = circuit.with_noise(noise_model) + return circuit + + +def get_defined_gates(program: Program) -> Tuple[Dict, Dict]: + """Get the gate definitions for the program. Will include the default SUPPORTED_GATES, in + addition to any gates defined in the Quil + + Args: + program: A pyquil program which may contain some DefGates. + + Returns: + A dictionary mapping quil gate names to Cirq Gates + A dictionary mapping quil gate names to callable parameter transformers + """ + defined_gates = SUPPORTED_GATES.copy() + parameter_transformers = PARAMETRIC_TRANSFORMERS.copy() + for defgate in program.defined_gates: + if defgate.parameters: + defined_gates[defgate.name] = defgate_to_cirq(defgate) + parameter_transformers[defgate.name] = lambda *args: { + p.name: a for p, a in zip(defgate.parameters, args) + } + else: + defined_gates[defgate.name] = MatrixGate(np.asarray(defgate.matrix, dtype=np.complex_)) + return defined_gates, parameter_transformers + + +def kraus_noise_model_to_cirq( + kraus_noise_model: Dict[Tuple[QubitDesignator, ...], List[NDArray[np.complex_]]], + defined_gates: Optional[Dict[QubitDesignator, Gate]] = None, +) -> InsertionNoiseModel: # pragma: no cover + """Construct a Cirq noise model from the provided Kraus operators. + + Args: + kraus_noise_model: A dictionary where the keys are tuples of Quil gate names and qubit + indices and the values are the Kraus representation of the noise channel. + defined_gates: A dictionary mapping Quil gates to Cirq gates. + Returns: + A Cirq InsertionNoiseModel which applies the Kraus operators to the specified gates. + Raises: + Exception: If a QubitDesignator identifier is not an integer. + """ + if defined_gates is None: + # SUPPORTED_GATES values are all safe to use as `Gate` + defined_gates = SUPPORTED_GATES # type: ignore + ops_added = {} + for key, kraus_ops in kraus_noise_model.items(): + gate_name = key[0] + + try: + qubit_indices = [int(q) for q in key[1:]] # type: ignore + except ValueError as e: + raise Exception("Qubit identifier must be integers") from e + qubits = [LineQubit(q) for q in qubit_indices] + + # defined_gates is not None by this point + gate: Type[Gate] = defined_gates[gate_name] # type: ignore + target_op = OpIdentifier(gate, *qubits) + + insert_op = KrausChannel(kraus_ops, validate=True).on(*qubits) + ops_added[target_op] = insert_op + + noise_model = InsertionNoiseModel(ops_added=ops_added, require_physical_tag=False) + + return noise_model + + +def quil_expression_to_sympy(expression: ParameterDesignator): + """Convert a quil expression to a Sympy expression. + + Args: + expression: A quil expression. + + Returns: + The sympy form of the expression. + + Raises: + ValueError: Connect convert unknown BinaryExp. + ValueError: Unrecognized expression. + """ + if type(expression) in {np.int_, np.float_, np.complex_, int, float, complex}: + return expression + elif isinstance(expression, Parameter): # pragma: no cover + return sympy.Symbol(expression.name) + elif isinstance(expression, MemoryReference): + return sympy.Symbol(expression.name + f"_{expression.offset}") + elif isinstance(expression, Function): + if expression.name == "SIN": # pragma: no cover + return sympy.sin(quil_expression_to_sympy(expression.expression)) + elif expression.name == "COS": + return sympy.cos(quil_expression_to_sympy(expression.expression)) + elif expression.name == "SQRT": # pragma: no cover + return sympy.sqrt(quil_expression_to_sympy(expression.expression)) + elif expression.name == "EXP": + return sympy.exp(quil_expression_to_sympy(expression.expression)) + elif expression.name == "CIS": # pragma: no cover + return sympy.exp(1j * quil_expression_to_sympy(expression.expression)) + else: # pragma: no cover + raise ValueError(f"Cannot convert unknown function: {expression}") + + elif isinstance(expression, BinaryExp): + if isinstance(expression, Add): + return quil_expression_to_sympy(expression.op1) + quil_expression_to_sympy( + expression.op2 + ) + elif isinstance(expression, Sub): # pragma: no cover + return quil_expression_to_sympy(expression.op1) - quil_expression_to_sympy( + expression.op2 + ) + elif isinstance(expression, Mul): + return quil_expression_to_sympy(expression.op1) * quil_expression_to_sympy( + expression.op2 + ) + elif isinstance(expression, Div): # pragma: no cover + return quil_expression_to_sympy(expression.op1) / quil_expression_to_sympy( + expression.op2 + ) + elif isinstance(expression, Pow): # pragma: no cover + return quil_expression_to_sympy(expression.op1) ** quil_expression_to_sympy( + expression.op2 + ) + else: # pragma: no cover + raise ValueError(f"Cannot convert unknown BinaryExp: {expression}") + + else: # pragma: no cover + raise ValueError( + f"quil_expression_to_sympy failed to convert {expression} of type {type(expression)}" + ) + + +@cached_method +def defgate_to_cirq(defgate: DefGate): + """Convert a Quil DefGate to a Cirq Gate class. + + For non-parametric gates, it's recommended to create `MatrixGate` object. This function is + intended for the case of parametric gates. + + Args: + defgate: A quil gate defintion. + Returns: + A subclass of `Gate` corresponding to the DefGate. + """ + name = defgate.name + matrix = defgate.matrix + parameters = defgate.parameters + dim = int(np.sqrt(matrix.shape[0])) + if parameters: + parameter_names = set(p.name for p in parameters) + + def constructor(self, **kwargs): + for p, val in kwargs.items(): + assert p in parameter_names, f"{p} is not a known parameter" + setattr(self, p, val) + + def unitary(self, *args): + if parameters: + parameter_map = {p: getattr(self, p.name) for p in parameters} + return substitute_array(matrix, parameter_map) + + else: + + def constructor(self, **kwards: Any): ... + + def unitary(self, *args): # pragma: no cover + return matrix + + def circuit_diagram_info( + self, args: CircuitDiagramInfoArgs + ) -> CircuitDiagramInfo: # pragma: no cover + return CircuitDiagramInfo(wire_symbols=tuple(name for _ in range(dim))) + + def num_qubits(self): + return defgate.num_args() + + gate = type( + name, + (Gate,), + { + "__init__": constructor, + "_num_qubits_": num_qubits, + "_unitary_": unitary, + "_circuit_diagram_info_": circuit_diagram_info, + }, + ) + return gate + + +def remove_gate_from_kraus( + kraus_ops: List[NDArray[np.complex_]], gate_matrix: NDArray[np.complex_] +): # pragma: no cover + """Recover the kraus operators from a kraus composed with a gate. + This function is the reverse of append_kraus_to_gate. + + Args: + kraus_ops: A list of Kraus Operators. + gate_matrix: The gate unitary. + + Returns: + The noise channel without the gate unitary. + """ + return [kju @ gate_matrix.conj().T for kju in kraus_ops] diff --git a/cirq-rigetti/cirq_rigetti/quil_input_test.py b/cirq-rigetti/cirq_rigetti/quil_input_test.py index 453c0551ca7..d6b5b72b7f5 100644 --- a/cirq-rigetti/cirq_rigetti/quil_input_test.py +++ b/cirq-rigetti/cirq_rigetti/quil_input_test.py @@ -12,44 +12,60 @@ # See the License for the specific language governing permissions and # limitations under the License. +from inspect import signature + import numpy as np import pytest -from pyquil import Program +from pyquil.quil import Program +from pyquil.quilbase import Parameter, DefGate +from pyquil.quilatom import quil_cos, quil_sin, quil_exp +from pyquil.simulation import matrices from pyquil.simulation.tools import program_unitary +import sympy +import cirq from cirq import Circuit, LineQubit +from cirq import Simulator, unitary +from cirq.linalg.predicates import allclose_up_to_global_phase from cirq_rigetti.quil_input import ( UndefinedQuilGate, UnsupportedQuilInstruction, + SUPPORTED_GATES, + PARAMETRIC_TRANSFORMERS, + CPHASE00, + CPHASE01, + CPHASE10, + PSWAP, circuit_from_quil, - cphase, - cphase00, - cphase01, - cphase10, - pswap, - xy, -) -from cirq.ops import ( - CCNOT, - CNOT, - CSWAP, - CZ, - H, - I, - ISWAP, - MeasurementGate, - S, - SWAP, - T, - X, - Y, - Z, - rx, - ry, - rz, + defgate_to_cirq, ) +from cirq.ops.common_gates import CNOT, CZ, CZPowGate, H, S, T, ZPowGate, YPowGate, XPowGate +from cirq.ops.pauli_gates import X, Y, Z +from cirq.ops.identity import I +from cirq.ops.measurement_gate import MeasurementGate +from cirq.ops.swap_gates import ISWAP, ISwapPowGate, SWAP +from cirq.ops.three_qubit_gates import CCNOT, CSWAP + + +def test_gate_conversion(): + """Check that the gates all convert with matching unitaries.""" + for quil_gate, cirq_gate in SUPPORTED_GATES.items(): + if quil_gate in PARAMETRIC_TRANSFORMERS: + pyquil_def = getattr(matrices, quil_gate) + sig = signature(pyquil_def) + num_params = len(sig.parameters) + sample_params = list(np.random.random(num_params) * np.pi) + + pyquil_unitary = pyquil_def(*sample_params) + cirq_unitary = unitary(cirq_gate(**PARAMETRIC_TRANSFORMERS[quil_gate](*sample_params))) + assert np.allclose(pyquil_unitary, cirq_unitary) + + else: + assert np.allclose(getattr(matrices, quil_gate), unitary(cirq_gate)) + + QUIL_PROGRAM = """ DECLARE ro BIT[3] I 0 @@ -86,6 +102,7 @@ def test_circuit_from_quil(): + """Convert a test circuit from Quil with a wide range of gates.""" q0, q1, q2 = LineQubit.range(3) cirq_circuit = Circuit( [ @@ -98,22 +115,22 @@ def test_circuit_from_quil(): H(q0), S(q1), T(q2), - Z(q0) ** (1 / 8), - Z(q1) ** (1 / 8), - Z(q2) ** (1 / 8), - rx(np.pi / 2)(q0), - ry(np.pi / 2)(q1), - rz(np.pi / 2)(q2), + ZPowGate(exponent=1 / 8)(q0), + ZPowGate(exponent=1 / 8)(q1), + ZPowGate(exponent=1 / 8)(q2), + XPowGate(exponent=1 / 2, global_shift=-0.5)(q0), + YPowGate(exponent=1 / 2, global_shift=-0.5)(q1), + ZPowGate(exponent=1 / 2, global_shift=-0.5)(q2), CZ(q0, q1), CNOT(q1, q2), - cphase(np.pi / 2)(q0, q1), - cphase00(np.pi / 2)(q1, q2), - cphase01(np.pi / 2)(q0, q1), - cphase10(np.pi / 2)(q1, q2), + CZPowGate(exponent=1 / 2, global_shift=0.0)(q0, q1), + CPHASE00(phi=np.pi / 2)(q1, q2), + CPHASE01(phi=np.pi / 2)(q0, q1), + CPHASE10(phi=np.pi / 2)(q1, q2), ISWAP(q0, q1), - pswap(np.pi / 2)(q1, q2), + PSWAP(phi=np.pi / 2)(q1, q2), SWAP(q0, q1), - xy(np.pi / 2)(q1, q2), + ISwapPowGate(exponent=1 / 2, global_shift=0.0)(q1, q2), CCNOT(q0, q1, q2), CSWAP(q0, q1, q2), MeasurementGate(1, key="ro[0]")(q0), @@ -122,7 +139,7 @@ def test_circuit_from_quil(): ] ) # build the same Circuit, using Quil - quil_circuit = circuit_from_quil(QUIL_PROGRAM) + quil_circuit = circuit_from_quil(Program(QUIL_PROGRAM)) # test Circuit equivalence assert cirq_circuit == quil_circuit @@ -148,9 +165,10 @@ def test_circuit_from_quil(): def test_quil_with_defgate(): + """Convert a Quil program with a DefGate.""" q0 = LineQubit(0) cirq_circuit = Circuit([X(q0), Z(q0)]) - quil_circuit = circuit_from_quil(QUIL_PROGRAM_WITH_DEFGATE) + quil_circuit = circuit_from_quil(Program(QUIL_PROGRAM_WITH_DEFGATE)) assert np.isclose(quil_circuit.unitary(), cirq_circuit.unitary()).all() @@ -160,28 +178,35 @@ def test_quil_with_defgate(): 0,EXP(i*%phi) X 0 -MYPHASE 0 +MYPHASE(pi/2) 0 """ +def test_program_with_parameterized_defgate(): + """Convert a Quil program with a parameterized DefGate.""" + program = Program(QUIL_PROGRAM_WITH_PARAMETERIZED_DEFGATE) + circuit = circuit_from_quil(program) + + pyquil_unitary = np.array([[1, 0], [0, np.exp(1j * np.pi / 2)]]) @ matrices.X + cirq_unitary = circuit.unitary() + + assert allclose_up_to_global_phase(pyquil_unitary, cirq_unitary, atol=1e-8) + + def test_unsupported_quil_instruction(): + """Convert a program with invalid or unsupported instructions.""" with pytest.raises(UnsupportedQuilInstruction): circuit_from_quil("NOP") - with pytest.raises(UnsupportedQuilInstruction): - circuit_from_quil("PRAGMA ADD-KRAUS X 0 \"(0.0 1.0 1.0 0.0)\"") - with pytest.raises(UnsupportedQuilInstruction): circuit_from_quil("RESET") - with pytest.raises(UnsupportedQuilInstruction): - circuit_from_quil(QUIL_PROGRAM_WITH_PARAMETERIZED_DEFGATE) - def test_undefined_quil_gate(): """There are no such things as FREDKIN & TOFFOLI in Quil. The standard names for those gates in Quil are CSWAP and CCNOT. Of course, they can - be defined via DEFGATE / DEFCIRCUIT.""" + be defined via DEFGATE / DEFCIRCUIT. + """ with pytest.raises(UndefinedQuilGate): circuit_from_quil("FREDKIN 0 1 2") @@ -189,7 +214,113 @@ def test_undefined_quil_gate(): circuit_from_quil("TOFFOLI 0 1 2") +QUIL_PROGRAM_WITH_PARAMETERS = """ +DECLARE theta REAL[4] +RX(pi) 0 +RX(theta[0]) 1 +RX(2*theta[1]) 3 +RX(2*theta[2] + 1) 2 +RX(2*COS(theta[3])*EXP(i*theta[3])) 4 +""" + + +def test_parametric_quil(): + """Convert a program which uses parameters and expressions.""" + program = Program(QUIL_PROGRAM_WITH_PARAMETERS) + + circuit = circuit_from_quil(program) + + q0, q1, q2, q3, q4 = LineQubit.range(5) + theta_0, theta_1, theta_2, theta_3 = ( + sympy.Symbol("theta_0"), + sympy.Symbol("theta_1"), + sympy.Symbol("theta_2"), + sympy.Symbol("theta_3"), + ) + cirq_circuit = Circuit( + [ + XPowGate(exponent=1, global_shift=-0.5)(q0), + XPowGate(exponent=theta_0 / np.pi, global_shift=-0.5)(q1), + XPowGate(exponent=(2 / np.pi) * theta_1, global_shift=-0.5)(q3), + XPowGate(exponent=(2 / np.pi) * theta_2 + 1 / np.pi, global_shift=-0.5)(q2), + XPowGate( + exponent=(2 / np.pi) * sympy.cos(theta_3) * sympy.exp(1j * theta_3), + global_shift=-0.5, + )(q4), + ] + ) + + assert cirq_circuit == circuit + + def test_measurement_without_classical_reg(): """Measure operations must declare a classical register.""" with pytest.raises(UnsupportedQuilInstruction): circuit_from_quil("MEASURE 0") + + +# Insert a similar test for Kraus ops + + +QUIL_PROGRAM_WITH_READOUT_NOISE = """ +DECLARE ro BIT[1] +RX(pi) 0 +PRAGMA READOUT-POVM 0 "(0.9 0.050000000000000044 0.09999999999999998 0.95)" +MEASURE 0 ro[0] +""" + + +def test_readout_noise(): + """Convert a program with readout noise.""" + program = Program(QUIL_PROGRAM_WITH_READOUT_NOISE) + circuit = circuit_from_quil(program) + + result = Simulator(seed=0).run(circuit, repetitions=1000) + assert result.histogram(key="ro[0]")[1] < 1000 + assert result.histogram(key="ro[0]")[1] > 900 + + +def test_resolve_parameters(): + """Test that parameters are correctly resolved for defined parametric gate.""" + theta, beta = Parameter("theta"), Parameter("beta") + xy_matrix = np.array( + [ + [1, 0, 0, 0], + [0, quil_cos(theta / 2), 1j * quil_sin(theta / 2) * quil_exp(1j * beta), 0], + [0, 1j * quil_sin(theta / 2) * quil_exp(1j * beta), 1j * quil_cos(theta / 2), 0], + [0, 0, 0, 1], + ] + ) + + defgate = DefGate("PHASEDXY", xy_matrix, parameters=[beta, theta]) + + cirq_phased_xy = defgate_to_cirq(defgate) + + op = cirq_phased_xy(beta=sympy.Symbol("beta"), theta=sympy.Symbol("theta"))( + cirq.LineQubit(0), cirq.LineQubit(1) + ) + + op._resolve_parameters_({"beta": 1.0, "theta": 2.0}, True) + + +def test_op_identifier(): + """Check that converted parametric defgates will be correctly identified.""" + theta, beta = Parameter("theta"), Parameter("beta") + xy_matrix = np.array( + [ + [1, 0, 0, 0], + [0, quil_cos(theta / 2), 1j * quil_sin(theta / 2) * quil_exp(1j * beta), 0], + [0, 1j * quil_sin(theta / 2) * quil_exp(1j * beta), 1j * quil_cos(theta / 2), 0], + [0, 0, 0, 1], + ] + ) + + defgate = DefGate("PHASEDXY", xy_matrix, parameters=[beta, theta]) + + gate1 = defgate_to_cirq(defgate) + gate2 = defgate_to_cirq(defgate) + + op = gate1(beta=np.pi, theta=np.pi)(cirq.LineQubit(0), cirq.LineQubit(1)) + + assert op in cirq.OpIdentifier(gate1) + assert op in cirq.OpIdentifier(gate2) diff --git a/cirq-rigetti/cirq_rigetti/quil_output_test.py b/cirq-rigetti/cirq_rigetti/quil_output_test.py index 2a81de9e25d..f16583c6bc7 100644 --- a/cirq-rigetti/cirq_rigetti/quil_output_test.py +++ b/cirq-rigetti/cirq_rigetti/quil_output_test.py @@ -416,11 +416,11 @@ def test_equivalent_unitaries(): assert np.allclose(pyquil_unitary, cirq_unitary) -QUIL_CPHASES_PROGRAM = """ -CPHASE00(pi/2) 0 1 -CPHASE01(pi/2) 0 1 -CPHASE10(pi/2) 0 1 -CPHASE(pi/2) 0 1 +QUIL_CPHASES_PROGRAM = f""" +CPHASE00({np.pi/2}) 0 1 +CPHASE01({np.pi/2}) 0 1 +CPHASE10({np.pi/2}) 0 1 +CPHASE({np.pi/2}) 0 1 """ QUIL_DIAGONAL_DECOMPOSE_PROGRAM = """ diff --git a/cirq-rigetti/cirq_rigetti/service.py b/cirq-rigetti/cirq_rigetti/service.py index 308cf4626b9..fc82720ea27 100644 --- a/cirq-rigetti/cirq_rigetti/service.py +++ b/cirq-rigetti/cirq_rigetti/service.py @@ -11,24 +11,16 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import cast, Optional +from typing import Optional, List import cirq -import httpx from pyquil import get_qc -from qcs_api_client.operations.sync import ( - get_instruction_set_architecture, - get_quilt_calibrations, - list_quantum_processors, -) -from qcs_api_client.models import ( - InstructionSetArchitecture, - GetQuiltCalibrationsResponse, - ListQuantumProcessorsResponse, -) +from qcs_sdk.qpu import list_quantum_processors +from qcs_sdk.qpu.isa import get_instruction_set_architecture, InstructionSetArchitecture +from qcs_sdk.client import QCSClient +from qcs_sdk.qpu.translation import get_quilt_calibrations from pyquil.api import QuantumComputer from cirq_rigetti.sampler import RigettiQCSSampler -from cirq_rigetti._qcs_api_client_decorator import _provide_default_client from cirq_rigetti import circuit_transformers as transformers from cirq_rigetti import circuit_sweep_executors as executors @@ -104,14 +96,11 @@ def sampler(self) -> RigettiQCSSampler: ) @staticmethod - @_provide_default_client - def list_quantum_processors( - client: Optional[httpx.Client], - ) -> ListQuantumProcessorsResponse: # pragma: no cover + def list_quantum_processors(client: Optional[QCSClient] = None) -> List[str]: """Retrieve a list of available Rigetti quantum processors. Args: - client: Optional; A `httpx.Client` initialized with Rigetti QCS credentials + client: Optional; A `QCSClient` initialized with Rigetti QCS credentials and configuration. If not provided, `qcs_api_client` will initialize a configured client based on configured values in the current user's `~/.qcs` directory or default values. @@ -120,18 +109,17 @@ def list_quantum_processors( A qcs_api_client.models.ListQuantumProcessorsResponse containing the identifiers of the available quantum processors.. """ - return cast(ListQuantumProcessorsResponse, list_quantum_processors(client=client).parsed) + return list_quantum_processors(client=client) @staticmethod - @_provide_default_client def get_quilt_calibrations( - quantum_processor_id: str, client: Optional[httpx.Client] - ) -> GetQuiltCalibrationsResponse: + quantum_processor_id: str, client: Optional[QCSClient] = None + ) -> str: # pragma: no cover """Retrieve the calibration data used for client-side Quil-T generation. Args: quantum_processor_id: The identifier of the Rigetti QCS quantum processor. - client: Optional; A `httpx.Client` initialized with Rigetti QCS credentials + client: Optional; A `QCSClient` initialized with Rigetti QCS credentials and configuration. If not provided, `qcs_api_client` will initialize a configured client based on configured values in the current user's `~/.qcs` directory or default values. @@ -140,22 +128,18 @@ def get_quilt_calibrations( A qcs_api_client.models.GetQuiltCalibrationsResponse containing the device calibrations. """ - return cast( # pragma: no cover - GetQuiltCalibrationsResponse, - get_quilt_calibrations(client=client, quantum_processor_id=quantum_processor_id).parsed, - ) + return get_quilt_calibrations(quantum_processor_id=quantum_processor_id, client=client) @staticmethod - @_provide_default_client def get_instruction_set_architecture( - quantum_processor_id: str, client: Optional[httpx.Client] + quantum_processor_id: str, client: Optional[QCSClient] = None ) -> InstructionSetArchitecture: # pragma: no cover """Retrieve the Instruction Set Architecture of a QuantumProcessor by ID. This includes site specific operations and native gate capabilities. Args: quantum_processor_id: The identifier of the Rigetti QCS quantum processor. - client: Optional; A `httpx.Client` initialized with Rigetti QCS credentials + client: Optional; A `QCSClient` initialized with Rigetti QCS credentials and configuration. If not provided, `qcs_api_client` will initialize a configured client based on configured values in the current user's `~/.qcs` directory or default values. @@ -163,11 +147,8 @@ def get_instruction_set_architecture( Returns: A qcs_api_client.models.InstructionSetArchitecture containing the device specification. """ - return cast( - InstructionSetArchitecture, - get_instruction_set_architecture( - client=client, quantum_processor_id=quantum_processor_id - ).parsed, + return get_instruction_set_architecture( + quantum_processor_id=quantum_processor_id, client=client ) diff --git a/cirq-rigetti/cirq_rigetti/service_test.py b/cirq-rigetti/cirq_rigetti/service_test.py index 32302ac4663..ed2ffaebde7 100644 --- a/cirq-rigetti/cirq_rigetti/service_test.py +++ b/cirq-rigetti/cirq_rigetti/service_test.py @@ -1,8 +1,7 @@ # pylint: disable=wrong-or-nonexistent-copyright-notice -from typing import Optional, Iterator +from unittest.mock import patch import pytest -import httpx -from cirq_rigetti import get_rigetti_qcs_service, RigettiQCSService +from cirq_rigetti import get_rigetti_qcs_service @pytest.mark.rigetti_integration @@ -14,20 +13,11 @@ def test_get_rigetti_qcs_service(): @pytest.mark.rigetti_integration -def test_rigetti_qcs_service_api_call(): - """test that `RigettiQCSService` will use a custom defined client when the - user specifies one to make an API call.""" +@patch('cirq_rigetti.service.QCSClient') +@patch('cirq_rigetti.service.list_quantum_processors') +def test_list_quantum_processors(mock_list_quantum_processors, MockQCSClient): + client = MockQCSClient() - class Response(httpx.Response): - def iter_bytes(self, chunk_size: Optional[int] = None) -> Iterator[bytes]: - yield b"{\"quantumProcessors\": [{\"id\": \"Aspen-8\"}]}" # pragma: no cover + get_rigetti_qcs_service('9q-square', as_qvm=True).list_quantum_processors(client=client) - class Transport(httpx.BaseTransport): - def handle_request(self, request: httpx.Request) -> httpx.Response: - return Response(200) - - client = httpx.Client(base_url="https://mock.api.qcs.rigetti.com", transport=Transport()) - - response = RigettiQCSService.list_quantum_processors(client=client) - assert 1 == len(response.quantum_processors) - assert 'Aspen-8' == response.quantum_processors[0].id + mock_list_quantum_processors.assert_called_with(client=client) diff --git a/cirq-rigetti/requirements.txt b/cirq-rigetti/requirements.txt index 13fc44d6572..274ad9ad52f 100644 --- a/cirq-rigetti/requirements.txt +++ b/cirq-rigetti/requirements.txt @@ -1 +1 @@ -pyquil>=3.2.0,<4.0.0 +pyquil>=4.11.0,<5.0.0