Skip to content

Commit

Permalink
New fake backends: Cambridge, Paris, London, Valencia, Essex, Armonk (#…
Browse files Browse the repository at this point in the history
…4129)

* Revert "Moving up some parameter checks in the class hierarchy (#3668)" (#4117)

This change has some unforseen backwards compatibility implications and
is causing downstream projects like qiskit-aer to fail CI now. Given the
pending release and this not being critical, this commit reverts this
commit and we can revisit it after the 0.13.0 release.

This reverts commit 5afe87c.

add new fake backends

* fix dt and dtm conversion by qiskit to SI

* fix imports

* lint

* Update qiskit/test/mock/backends/armonk/fake_armonk.py

Co-Authored-By: Kevin Krsulich <kevin@krsulich.net>

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Apr 17, 2020
1 parent 2f76dd0 commit 8332562
Show file tree
Hide file tree
Showing 31 changed files with 513 additions and 3 deletions.
6 changes: 6 additions & 0 deletions qiskit/test/mock/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
Mocked versions of real quantum backends.
"""

from .armonk import FakeArmonk
from .yorktown import FakeYorktown
from .tenerife import FakeTenerife
from .ourense import FakeOurense
from .vigo import FakeVigo
from .valencia import FakeValencia
from .london import FakeLondon
from .essex import FakeEssex
from .burlington import FakeBurlington
from .melbourne import FakeMelbourne
from .rueschlikon import FakeRueschlikon
Expand All @@ -30,4 +34,6 @@
from .singapore import FakeSingapore
from .johannesburg import FakeJohannesburg
from .boeblingen import FakeBoeblingen
from .cambridge import FakeCambridge
from .paris import FakeParis
from .rochester import FakeRochester
17 changes: 17 additions & 0 deletions qiskit/test/mock/backends/armonk/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-

# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=missing-docstring

from .fake_armonk import FakeArmonk
1 change: 1 addition & 0 deletions qiskit/test/mock/backends/armonk/conf_armonk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"open_pulse": true, "dtm": 0.22222222222222221, "n_registers": 1, "local": false, "backend_name": "ibmq_armonk", "dt": 0.22222222222222221, "qubit_lo_range": [[4474290401.545527, 5474290401.545527]], "credits_required": true, "meas_lo_range": [[6493427855.0, 7493427855.0]], "gates": [{"coupling_map": [[0]], "parameters": [], "qasm_def": "gate id q { U(0,0,0) q; }", "name": "id"}, {"coupling_map": [[0]], "parameters": ["lambda"], "qasm_def": "gate u1(lambda) q { U(0,0,lambda) q; }", "name": "u1"}, {"coupling_map": [[0]], "parameters": ["phi", "lambda"], "qasm_def": "gate u2(phi,lambda) q { U(pi/2,phi,lambda) q; }", "name": "u2"}, {"coupling_map": [[0]], "parameters": ["theta", "phi", "lambda"], "qasm_def": "gate u3(theta,phi,lambda) q { U(theta,phi,lambda) q; }", "name": "u3"}], "simulator": false, "coupling_map": null, "n_uchannels": 0, "memory": true, "meas_map": [[0]], "u_channel_lo": [], "max_experiments": 75, "max_shots": 8192, "backend_version": "1.1.0", "basis_gates": ["id", "u1", "u2", "u3"], "conditional": false, "meas_levels": [1, 2], "conditional_latency": [], "sample_name": "SPARROW", "n_qubits": 1, "description": "1 qubit device", "acquisition_latency": [], "online_date": "2019-10-16T04:00:00+00:00", "rep_times": [0], "discriminators": ["linear_discriminator", "quadratic_discriminator"], "meas_kernels": ["boxcar"], "url": "None", "allow_q_object": true, "allow_object_storage": true, "quantum_volume": null, "hamiltonian": {"description": "Qubits are modelled as a two level system. Qubits are coupled through resonator buses. The provided Hamiltonian has been projected into the zero excitation subspace of the resonator buses leading to an effective qubit-qubit flip-flop interaction. The qubit resonance frequencies in the Hamiltonian are the cavity dressed frequencies and not exactly what is returned by the backend defaults, which also includes the dressing due to the qubit-qubit interactions.\nWarning: Currently not all system Hamiltonian information is available to the public, missing values have been replaced with 0.\n", "h_latex": "\\begin{align} \\mathcal{H}/\\hbar = & \\sum_{i=0}^{0}\\left(\\frac{\\omega_{q,i}}{2} (\\mathbb{1}_i-\\sigma_i^{z})+ \\Omega_{d,i}D_i(t)\\sigma_i^{X}\\right) \\\\ \\end{align}", "h_str": ["_SUM[i,0,0,wq{i}/2*(I{i}-Z{i})]", "_SUM[i,0,0,omegad{i}*X{i}||D{i}]"], "osc": {}, "qub": {"0": 2}, "vars": {"omegad0": 0, "wq0": 31.254388364635304}}, "uchannels_enabled": true, "allow_q_circuit": false}
1 change: 1 addition & 0 deletions qiskit/test/mock/backends/armonk/defs_armonk.json

Large diffs are not rendered by default.

65 changes: 65 additions & 0 deletions qiskit/test/mock/backends/armonk/fake_armonk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-

# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""
Fake Armonk device (5 qubit).
"""

import os
import json

from qiskit.providers.models import (PulseDefaults, PulseBackendConfiguration,
BackendProperties)
from qiskit.test.mock.fake_backend import FakeBackend


class FakeArmonk(FakeBackend):
"""A fake 1 qubit backend."""

def __init__(self):
"""
0
"""
dirname = os.path.dirname(__file__)
filename = "conf_armonk.json"
with open(os.path.join(dirname, filename), "r") as f_conf:
conf = json.load(f_conf)

configuration = PulseBackendConfiguration.from_dict(conf)
configuration.backend_name = 'fake_armonk'
self._defaults = None
self._properties = None
super().__init__(configuration)

def properties(self):
"""Returns a snapshot of device properties as recorded on 04/10/20.
"""
if not self._properties:
dirname = os.path.dirname(__file__)
filename = "props_armonk.json"
with open(os.path.join(dirname, filename), "r") as f_prop:
props = json.load(f_prop)
self._properties = BackendProperties.from_dict(props)
return self._properties

def defaults(self):
"""Returns a snapshot of device defaults as recorded on 04/10/20.
"""
if not self._defaults:
dirname = os.path.dirname(__file__)
filename = "defs_armonk.json"
with open(os.path.join(dirname, filename), "r") as f_defs:
defs = json.load(f_defs)
self._defaults = PulseDefaults.from_dict(defs)
return self._defaults
1 change: 1 addition & 0 deletions qiskit/test/mock/backends/armonk/props_armonk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"general": [], "gates": [{"gate": "id", "qubits": [0], "parameters": [{"name": "gate_error", "value": 0.0004846156972237767, "date": "2020-04-09T21:14:21+00:00", "unit": ""}, {"name": "gate_length", "value": 142.22222222222223, "date": "2020-04-09T21:16:16+00:00", "unit": "ns"}], "name": "id_0"}, {"gate": "u1", "qubits": [0], "parameters": [{"name": "gate_error", "value": 0.0, "date": "2020-04-09T21:14:21+00:00", "unit": ""}, {"name": "gate_length", "value": 0.0, "date": "2020-04-09T21:16:16+00:00", "unit": "ns"}], "name": "u1_0"}, {"gate": "u2", "qubits": [0], "parameters": [{"name": "gate_error", "value": 0.0004846156972237767, "date": "2020-04-09T21:14:21+00:00", "unit": ""}, {"name": "gate_length", "value": 142.22222222222223, "date": "2020-04-09T21:16:16+00:00", "unit": "ns"}], "name": "u2_0"}, {"gate": "u3", "qubits": [0], "parameters": [{"name": "gate_error", "value": 0.0009692313944475534, "date": "2020-04-09T21:14:21+00:00", "unit": ""}, {"name": "gate_length", "value": 284.44444444444446, "date": "2020-04-09T21:16:16+00:00", "unit": "ns"}], "name": "u3_0"}], "backend_version": "1.1.0", "backend_name": "ibmq_armonk", "qubits": [[{"name": "T1", "value": 129.5098438188917, "date": "2020-04-09T21:10:56+00:00", "unit": "\u00b5s"}, {"name": "T2", "value": 174.56556513693073, "date": "2020-04-09T21:12:24+00:00", "unit": "\u00b5s"}, {"name": "frequency", "value": 4.974290401545527, "date": "2020-04-09T21:16:16+00:00", "unit": "GHz"}, {"name": "readout_error", "value": 0.06600000000000006, "date": "2020-04-09T21:10:04+00:00", "unit": ""}, {"name": "prob_meas0_prep1", "value": 0.058, "date": "2020-04-09T21:10:04+00:00", "unit": ""}, {"name": "prob_meas1_prep0", "value": 0.07399999999999995, "date": "2020-04-09T21:10:04+00:00", "unit": ""}]], "last_update_date": "2020-04-09T21:16:16+00:00"}
17 changes: 17 additions & 0 deletions qiskit/test/mock/backends/cambridge/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-

# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=missing-docstring

from .fake_cambridge import FakeCambridge
1 change: 1 addition & 0 deletions qiskit/test/mock/backends/cambridge/conf_cambridge.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"open_pulse": false, "n_registers": 1, "local": false, "backend_name": "ibmq_cambridge", "credits_required": true, "gates": [{"coupling_map": [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27]], "parameters": [], "qasm_def": "gate id q { U(0,0,0) q; }", "name": "id"}, {"coupling_map": [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27]], "parameters": ["lambda"], "qasm_def": "gate u1(lambda) q { U(0,0,lambda) q; }", "name": "u1"}, {"coupling_map": [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27]], "parameters": ["phi", "lambda"], "qasm_def": "gate u2(phi,lambda) q { U(pi/2,phi,lambda) q; }", "name": "u2"}, {"coupling_map": [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27]], "parameters": ["theta", "phi", "lambda"], "qasm_def": "gate u3(theta,phi,lambda) q { U(theta,phi,lambda) q; }", "name": "u3"}, {"coupling_map": [[0, 1], [0, 5], [1, 0], [1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3], [4, 6], [5, 0], [5, 9], [6, 4], [6, 13], [7, 8], [7, 16], [8, 7], [8, 9], [9, 5], [9, 8], [9, 10], [10, 9], [10, 11], [11, 10], [11, 12], [11, 17], [12, 11], [12, 13], [13, 6], [13, 12], [13, 14], [14, 13], [14, 15], [15, 14], [15, 18], [16, 7], [16, 19], [17, 11], [17, 23], [18, 15], [18, 27], [19, 16], [19, 20], [20, 19], [20, 21], [21, 20], [21, 22], [22, 21], [22, 23], [23, 17], [23, 22], [23, 24], [24, 23], [24, 25], [25, 24], [25, 26], [26, 25], [26, 27], [27, 18], [27, 26]], "parameters": [], "qasm_def": "gate cx q1,q2 { CX q1,q2; }", "name": "cx"}], "simulator": false, "coupling_map": [[0, 1], [0, 5], [1, 0], [1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3], [4, 6], [5, 0], [5, 9], [6, 4], [6, 13], [7, 8], [7, 16], [8, 7], [8, 9], [9, 5], [9, 8], [9, 10], [10, 9], [10, 11], [11, 10], [11, 12], [11, 17], [12, 11], [12, 13], [13, 6], [13, 12], [13, 14], [14, 13], [14, 15], [15, 14], [15, 18], [16, 7], [16, 19], [17, 11], [17, 23], [18, 15], [18, 27], [19, 16], [19, 20], [20, 19], [20, 21], [21, 20], [21, 22], [22, 21], [22, 23], [23, 17], [23, 22], [23, 24], [24, 23], [24, 25], [25, 24], [25, 26], [26, 25], [26, 27], [27, 18], [27, 26]], "memory": true, "max_experiments": 900, "max_shots": 8192, "backend_version": "1.0.0", "basis_gates": ["u1", "u2", "u3", "cx", "id"], "conditional": false, "sample_name": "Falcon", "n_qubits": 28, "description": "28 qubit device", "online_date": "2019-11-08T05:00:00+00:00", "url": "None", "allow_q_object": true, "allow_object_storage": true, "quantum_volume": 8, "allow_q_circuit": false}
61 changes: 61 additions & 0 deletions qiskit/test/mock/backends/cambridge/fake_cambridge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-

# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""
Fake Cambridge device (20 qubit).
"""

import os
import json

from qiskit.providers.models import QasmBackendConfiguration, BackendProperties
from qiskit.test.mock.fake_backend import FakeBackend


class FakeCambridge(FakeBackend):
"""A fake Cambridge backend."""

def __init__(self):
"""
00 ↔ 01 ↔ 02 ↔ 03 ↔ 04
↕ ↕
05 06
↕ ↕
07 ↔ 08 ↔ 09 ↔ 10 ↔ 11 ↔ 12 ↔ 13 ↔ 14 ↔ 15
↕ ↕ ↕
16 17 18
↕ ↕ ↕
19 ↔ 20 ↔ 21 ↔ 22 ↔ 23 ↔ 24 ↔ 25 ↔ 26 ↔ 27
"""
dirname = os.path.dirname(__file__)
filename = "conf_cambridge.json"
with open(os.path.join(dirname, filename), "r") as f_conf:
conf = json.load(f_conf)

configuration = QasmBackendConfiguration.from_dict(conf)
configuration.backend_name = 'fake_cambridge'
self._defaults = None
self._properties = None
super().__init__(configuration)

def properties(self):
"""Returns a snapshot of device properties as recorded on 10/24/19.
"""
if not self._properties:
dirname = os.path.dirname(__file__)
filename = "props_cambridge.json"
with open(os.path.join(dirname, filename), "r") as f_prop:
props = json.load(f_prop)
self._properties = BackendProperties.from_dict(props)
return self._properties
1 change: 1 addition & 0 deletions qiskit/test/mock/backends/cambridge/props_cambridge.json

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions qiskit/test/mock/backends/essex/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-

# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=missing-docstring

from .fake_essex import FakeEssex
1 change: 1 addition & 0 deletions qiskit/test/mock/backends/essex/conf_essex.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"open_pulse": false, "n_registers": 1, "local": false, "backend_name": "ibmq_essex", "credits_required": true, "gates": [{"coupling_map": [[0], [1], [2], [3], [4]], "parameters": [], "qasm_def": "gate id q { U(0,0,0) q; }", "name": "id"}, {"coupling_map": [[0], [1], [2], [3], [4]], "parameters": ["lambda"], "qasm_def": "gate u1(lambda) q { U(0,0,lambda) q; }", "name": "u1"}, {"coupling_map": [[0], [1], [2], [3], [4]], "parameters": ["phi", "lambda"], "qasm_def": "gate u2(phi,lambda) q { U(pi/2,phi,lambda) q; }", "name": "u2"}, {"coupling_map": [[0], [1], [2], [3], [4]], "parameters": ["theta", "phi", "lambda"], "qasm_def": "gate u3(theta,phi,lambda) q { U(theta,phi,lambda) q; }", "name": "u3"}, {"coupling_map": [[0, 1], [1, 0], [1, 2], [1, 3], [2, 1], [3, 1], [3, 4], [4, 3]], "parameters": [], "qasm_def": "gate cx q1,q2 { CX q1,q2; }", "name": "cx"}], "simulator": false, "coupling_map": [[0, 1], [1, 0], [1, 2], [1, 3], [2, 1], [3, 1], [3, 4], [4, 3]], "memory": true, "max_experiments": 75, "max_shots": 8192, "backend_version": "1.0.1", "basis_gates": ["u1", "u2", "u3", "cx", "id"], "conditional": false, "sample_name": "Giraffe", "n_qubits": 5, "description": "5 qubit device Essex", "online_date": "2019-09-13T04:00:00+00:00", "url": "None", "allow_q_object": true, "allow_object_storage": true, "quantum_volume": 8, "allow_q_circuit": false}
57 changes: 57 additions & 0 deletions qiskit/test/mock/backends/essex/fake_essex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-

# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""
Fake Essex device (5 qubit).
"""

import os
import json

from qiskit.providers.models import QasmBackendConfiguration, BackendProperties
from qiskit.test.mock.fake_backend import FakeBackend


class FakeEssex(FakeBackend):
"""A fake 5 qubit backend."""

def __init__(self):
"""
0 ↔ 1 ↔ 2
3
4
"""
dirname = os.path.dirname(__file__)
filename = "conf_essex.json"
with open(os.path.join(dirname, filename), "r") as f_conf:
conf = json.load(f_conf)

configuration = QasmBackendConfiguration.from_dict(conf)
configuration.backend_name = 'fake_essex'
self._defaults = None
self._properties = None
super().__init__(configuration)

def properties(self):
"""Returns a snapshot of device properties as recorded on 04/10/20.
"""
if not self._properties:
dirname = os.path.dirname(__file__)
filename = "props_essex.json"
with open(os.path.join(dirname, filename), "r") as f_prop:
props = json.load(f_prop)
self._properties = BackendProperties.from_dict(props)
return self._properties
Loading

0 comments on commit 8332562

Please sign in to comment.