Skip to content

Commit

Permalink
Rust fix and more obsolete code fixes (#2325)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
gadial authored Mar 4, 2025
1 parent b55b7a9 commit 0f2ff71
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ environment = { CMAKE_GENERATOR = "Visual Studio 16 2019"}

[[tool.cibuildwheel.overrides]]
select = "cp3{9,10,11,12,13}-manylinux_i686"
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"
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"

[tool.black]
line-length = 100
Expand Down
2 changes: 1 addition & 1 deletion qiskit_aer/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.16.3
0.16.4
15 changes: 7 additions & 8 deletions qiskit_aer/backends/backendproperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import warnings
from typing import Any, Iterable, Tuple, Union, Dict
import dateutil.parser
from qiskit.providers.exceptions import BackendPropertyError
from qiskit.utils.units import apply_prefix
from qiskit.transpiler.target import Target

Expand Down Expand Up @@ -301,7 +300,7 @@ def gate_property(
Gate property as a tuple of the value and the time it was measured.
Raises:
BackendPropertyError: If the property is not found or name is
ValueError: If the property is not found or name is
specified but qubit is not.
"""
try:
Expand All @@ -313,9 +312,9 @@ def gate_property(
if name:
result = result[name]
elif name:
raise BackendPropertyError(f"Provide qubits to get {name} of {gate}")
raise ValueError(f"Provide qubits to get {name} of {gate}")
except KeyError as ex:
raise BackendPropertyError(f"Could not find the desired property for {gate}") from ex
raise ValueError(f"Could not find the desired property for {gate}") from ex
return result

def faulty_qubits(self):
Expand Down Expand Up @@ -396,15 +395,15 @@ def qubit_property(
Qubit property as a tuple of the value and the time it was measured.
Raises:
BackendPropertyError: If the property is not found.
ValueError: If the property is not found.
"""
try:
result = self._qubits[qubit]
if name is not None:
result = result[name]
except KeyError as ex:
formatted_name = "y '" + name + "'" if name else "ies"
raise BackendPropertyError(
raise ValueError(
f"Couldn't find the propert{formatted_name} for qubit {qubit}."
) from ex
return result
Expand Down Expand Up @@ -497,12 +496,12 @@ def _apply_prefix(self, value: float, unit: str) -> float:
Converted value.
Raises:
BackendPropertyError: If the units aren't recognized.
ValueError: If the units aren't recognized.
"""
try:
return apply_prefix(value, unit)
except Exception as ex:
raise BackendPropertyError(f"Could not understand units: {unit}") from ex
raise ValueError(f"Could not understand units: {unit}") from ex


def target_to_backend_properties(target: Target):
Expand Down
9 changes: 4 additions & 5 deletions qiskit_aer/noise/noise_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

from qiskit.circuit import QuantumCircuit, Instruction, Delay, Reset
from qiskit.circuit.library.generalized_gates import PauliGate, UnitaryGate
from qiskit.providers.exceptions import BackendPropertyError
from qiskit.transpiler import PassManager
from qiskit.utils import apply_prefix
from .device.models import _excited_population, _truncate_t2_value
Expand Down Expand Up @@ -412,7 +411,7 @@ def from_backend(
_excited_population(freq=q.frequency, temperature=temperature)
for q in all_qubit_properties
]
except BackendPropertyError:
except ValueError:
excited_state_populations = None
try:
t1s = [prop.t1 for prop in all_qubit_properties]
Expand All @@ -425,7 +424,7 @@ def from_backend(
excited_state_populations=excited_state_populations,
)
noise_model._custom_noise_passes.append(delay_pass)
except BackendPropertyError:
except ValueError:
# Device does not have the required T1 or T2 information
# in its properties
pass
Expand Down Expand Up @@ -522,7 +521,7 @@ def from_backend_properties(
)
for q in range(num_qubits)
]
except BackendPropertyError:
except ValueError:
excited_state_populations = None
try:
delay_pass = RelaxationNoisePass(
Expand All @@ -536,7 +535,7 @@ def from_backend_properties(
excited_state_populations=excited_state_populations,
)
noise_model._custom_noise_passes.append(delay_pass)
except BackendPropertyError:
except ValueError:
# Device does not have the required T1 or T2 information
# in its properties
pass
Expand Down
6 changes: 0 additions & 6 deletions test/terra/noise/test_device_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@
import numpy as np
from test.terra.common import QiskitAerTestCase

import qiskit
from qiskit.circuit import library, Reset, Measure, Parameter
from qiskit.transpiler import CouplingMap, Target, QubitProperties, InstructionProperties

if qiskit.__version__.startswith("0."):
from qiskit.providers.fake_provider import FakeQuito as Fake5QV1
else:
from qiskit.providers.fake_provider import Fake5QV1

from qiskit_aer.noise.device.models import basic_device_gate_errors
from qiskit_aer.noise.errors.standard_errors import thermal_relaxation_error

Expand Down

0 comments on commit 0f2ff71

Please sign in to comment.