Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 26 additions & 25 deletions qiskit/test/mock/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,38 @@
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
from .tokyo import FakeTokyo
from .poughkeepsie import FakePoughkeepsie
from .almaden import FakeAlmaden
from .singapore import FakeSingapore
from .johannesburg import FakeJohannesburg
from .armonk import FakeArmonk
from .athens import FakeAthens
from .belem import FakeBelem
from .boeblingen import FakeBoeblingen
from .bogota import FakeBogota
from .burlington import FakeBurlington
from .cambridge import FakeCambridge
from .cambridge import FakeCambridgeAlternativeBasis
from .casablanca import FakeCasablanca
from .essex import FakeEssex
from .guadalupe import FakeGuadalupe
from .johannesburg import FakeJohannesburg
from .lima import FakeLima
from .london import FakeLondon
from .manhattan import FakeManhattan
from .melbourne import FakeMelbourne
from .montreal import FakeMontreal
from .mumbai import FakeMumbai
from .ourense import FakeOurense
from .paris import FakeParis
from .poughkeepsie import FakePoughkeepsie
from .quito import FakeQuito
from .rochester import FakeRochester
from .athens import FakeAthens
from .rome import FakeRome
from .bogota import FakeBogota
from .montreal import FakeMontreal
from .toronto import FakeToronto
from .manhattan import FakeManhattan
from .rueschlikon import FakeRueschlikon
from .santiago import FakeSantiago
from .casablanca import FakeCasablanca
from .singapore import FakeSingapore
from .sydney import FakeSydney
from .mumbai import FakeMumbai
from .lima import FakeLima
from .belem import FakeBelem
from .quito import FakeQuito
from .tenerife import FakeTenerife
from .tokyo import FakeTokyo
from .toronto import FakeToronto
from .valencia import FakeValencia
from .vigo import FakeVigo
from .yorktown import FakeYorktown
2 changes: 1 addition & 1 deletion qiskit/test/mock/backends/bogota/fake_bogota.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# that they have been altered from the originals.

"""
Fake Rome device (5 qubit).
Fake Bogota device (5 qubit).
"""

import os
Expand Down
15 changes: 15 additions & 0 deletions qiskit/test/mock/backends/guadalupe/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# 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.

"""Mock guadalupe backend"""

from .fake_guadalupe import FakeGuadalupe
1 change: 1 addition & 0 deletions qiskit/test/mock/backends/guadalupe/conf_guadalupe.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions qiskit/test/mock/backends/guadalupe/defs_guadalupe.json

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions qiskit/test/mock/backends/guadalupe/fake_guadalupe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# 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 Guadalupe device (5 qubit).
"""

import os
import json

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


class FakeGuadalupe(FakeBackend):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a base class that should be used directly here, instead you should have used qiskit.test.mock.fake_pulse_backend.FakePulseBackend and then just defined the class attributes for the filenames.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thanks. I'll submit a follow up.

Copy link
Copy Markdown
Member

@mtreinish mtreinish Apr 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I've got it covered as partof a larger refactor in #6286

"""A fake 16 qubit backend."""

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

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

def properties(self):
"""Returns a snapshot of device properties"""
if not self._properties:
dirname = os.path.dirname(__file__)
filename = "props_guadalupe.json"
with open(os.path.join(dirname, filename)) 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/guadalupe/props_guadalupe.json

Large diffs are not rendered by default.

57 changes: 29 additions & 28 deletions qiskit/test/mock/fake_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,43 +47,44 @@ def backends(self, name=None, **kwargs):
return self._backends

def __init__(self):
self._backends = [FakeQasmSimulator(),
FakeOpenPulse2Q(),
FakeOpenPulse3Q(),
self._backends = [FakeAlmaden(),
FakeArmonk(),
FakeYorktown(),
FakeTenerife(),
FakeOurense(),
FakeVigo(),
FakeValencia(),
FakeEssex(),
FakeLondon(),
FakeBurlington(),
FakeMelbourne(),
FakeRueschlikon(),
FakeTokyo(),
FakePoughkeepsie(),
FakeAlmaden(),
FakeSingapore(),
FakeJohannesburg(),
FakeAthens(),
FakeBelem(),
FakeBoeblingen(),
FakeBogota(),
FakeBurlington(),
FakeCambridge(),
FakeCambridgeAlternativeBasis(),
FakeCasablanca(),
FakeEssex(),
FakeGuadalupe(),
FakeJohannesburg(),
FakeLima(),
FakeLondon(),
FakeManhattan(),
FakeMelbourne(),
FakeMontreal(),
FakeMumbai(),
FakeOpenPulse2Q(),
FakeOpenPulse3Q(),
FakeOurense(),
FakeParis(),
FakePoughkeepsie(),
FakeQasmSimulator(),
FakeQuito(),
FakeRochester(),
FakeRome(),
FakeAthens(),
FakeBogota(),
FakeMontreal(),
FakeToronto(),
FakeManhattan(),
FakeRueschlikon(),
FakeSantiago(),
FakeCasablanca(),
FakeSingapore(),
FakeSydney(),
FakeMumbai(),
FakeLima(),
FakeBelem(),
FakeQuito()]
FakeTenerife(),
FakeTokyo(),
FakeToronto(),
FakeValencia(),
FakeVigo(),
FakeYorktown()]

super().__init__()

Expand Down