Skip to content

Commit 0f2ff71

Browse files
authored
Rust fix and more obsolete code fixes (#2325)
* Revert "Backend-related deprecations (#2322)" This reverts commit 37718fa. * Reapply "Backend-related deprecations (#2322)" This reverts commit ce4cbf9. * Attempt to explicitly install the missing library * fix typo * version update * Remove BackendPropertyError * Removing useless imports * small fix
1 parent b55b7a9 commit 0f2ff71

File tree

5 files changed

+13
-21
lines changed

5 files changed

+13
-21
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ environment = { CMAKE_GENERATOR = "Visual Studio 16 2019"}
2929

3030
[[tool.cibuildwheel.overrides]]
3131
select = "cp3{9,10,11,12,13}-manylinux_i686"
32-
before-all = "sed -i -e 's/^mirrorlist/#mirrorlist/' -e 's/^#baseurl/baseurl/' -e 's/mirror.centos.org/vault.centos.org/' /etc/yum.repos.d/*.repo && yum install -y wget && bash {project}/tools/install_openblas_i686.sh"
32+
before-all = "sed -i -e 's/^mirrorlist/#mirrorlist/' -e 's/^#baseurl/baseurl/' -e 's/mirror.centos.org/vault.centos.org/' /etc/yum.repos.d/*.repo && yum install -y libatomic && yum install -y wget && bash {project}/tools/install_openblas_i686.sh && bash {project}/tools/install_rust.sh"
3333

3434
[tool.black]
3535
line-length = 100

qiskit_aer/VERSION.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.16.3
1+
0.16.4

qiskit_aer/backends/backendproperties.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import warnings
1818
from typing import Any, Iterable, Tuple, Union, Dict
1919
import dateutil.parser
20-
from qiskit.providers.exceptions import BackendPropertyError
2120
from qiskit.utils.units import apply_prefix
2221
from qiskit.transpiler.target import Target
2322

@@ -301,7 +300,7 @@ def gate_property(
301300
Gate property as a tuple of the value and the time it was measured.
302301
303302
Raises:
304-
BackendPropertyError: If the property is not found or name is
303+
ValueError: If the property is not found or name is
305304
specified but qubit is not.
306305
"""
307306
try:
@@ -313,9 +312,9 @@ def gate_property(
313312
if name:
314313
result = result[name]
315314
elif name:
316-
raise BackendPropertyError(f"Provide qubits to get {name} of {gate}")
315+
raise ValueError(f"Provide qubits to get {name} of {gate}")
317316
except KeyError as ex:
318-
raise BackendPropertyError(f"Could not find the desired property for {gate}") from ex
317+
raise ValueError(f"Could not find the desired property for {gate}") from ex
319318
return result
320319

321320
def faulty_qubits(self):
@@ -396,15 +395,15 @@ def qubit_property(
396395
Qubit property as a tuple of the value and the time it was measured.
397396
398397
Raises:
399-
BackendPropertyError: If the property is not found.
398+
ValueError: If the property is not found.
400399
"""
401400
try:
402401
result = self._qubits[qubit]
403402
if name is not None:
404403
result = result[name]
405404
except KeyError as ex:
406405
formatted_name = "y '" + name + "'" if name else "ies"
407-
raise BackendPropertyError(
406+
raise ValueError(
408407
f"Couldn't find the propert{formatted_name} for qubit {qubit}."
409408
) from ex
410409
return result
@@ -497,12 +496,12 @@ def _apply_prefix(self, value: float, unit: str) -> float:
497496
Converted value.
498497
499498
Raises:
500-
BackendPropertyError: If the units aren't recognized.
499+
ValueError: If the units aren't recognized.
501500
"""
502501
try:
503502
return apply_prefix(value, unit)
504503
except Exception as ex:
505-
raise BackendPropertyError(f"Could not understand units: {unit}") from ex
504+
raise ValueError(f"Could not understand units: {unit}") from ex
506505

507506

508507
def target_to_backend_properties(target: Target):

qiskit_aer/noise/noise_model.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
from qiskit.circuit import QuantumCircuit, Instruction, Delay, Reset
2424
from qiskit.circuit.library.generalized_gates import PauliGate, UnitaryGate
25-
from qiskit.providers.exceptions import BackendPropertyError
2625
from qiskit.transpiler import PassManager
2726
from qiskit.utils import apply_prefix
2827
from .device.models import _excited_population, _truncate_t2_value
@@ -412,7 +411,7 @@ def from_backend(
412411
_excited_population(freq=q.frequency, temperature=temperature)
413412
for q in all_qubit_properties
414413
]
415-
except BackendPropertyError:
414+
except ValueError:
416415
excited_state_populations = None
417416
try:
418417
t1s = [prop.t1 for prop in all_qubit_properties]
@@ -425,7 +424,7 @@ def from_backend(
425424
excited_state_populations=excited_state_populations,
426425
)
427426
noise_model._custom_noise_passes.append(delay_pass)
428-
except BackendPropertyError:
427+
except ValueError:
429428
# Device does not have the required T1 or T2 information
430429
# in its properties
431430
pass
@@ -522,7 +521,7 @@ def from_backend_properties(
522521
)
523522
for q in range(num_qubits)
524523
]
525-
except BackendPropertyError:
524+
except ValueError:
526525
excited_state_populations = None
527526
try:
528527
delay_pass = RelaxationNoisePass(
@@ -536,7 +535,7 @@ def from_backend_properties(
536535
excited_state_populations=excited_state_populations,
537536
)
538537
noise_model._custom_noise_passes.append(delay_pass)
539-
except BackendPropertyError:
538+
except ValueError:
540539
# Device does not have the required T1 or T2 information
541540
# in its properties
542541
pass

test/terra/noise/test_device_models.py

-6
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,9 @@
1616
import numpy as np
1717
from test.terra.common import QiskitAerTestCase
1818

19-
import qiskit
2019
from qiskit.circuit import library, Reset, Measure, Parameter
2120
from qiskit.transpiler import CouplingMap, Target, QubitProperties, InstructionProperties
2221

23-
if qiskit.__version__.startswith("0."):
24-
from qiskit.providers.fake_provider import FakeQuito as Fake5QV1
25-
else:
26-
from qiskit.providers.fake_provider import Fake5QV1
27-
2822
from qiskit_aer.noise.device.models import basic_device_gate_errors
2923
from qiskit_aer.noise.errors.standard_errors import thermal_relaxation_error
3024

0 commit comments

Comments
 (0)