Skip to content

Commit

Permalink
Suppress analysis deprecation message in deprecated experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
wshanks committed Oct 25, 2024
1 parent 5970f15 commit a176cde
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 9 deletions.
13 changes: 10 additions & 3 deletions qiskit_experiments/library/characterization/cr_hamiltonian.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Cross resonance Hamiltonian tomography.
"""

import warnings
from typing import List, Tuple, Sequence, Optional, Type

import numpy as np
Expand Down Expand Up @@ -185,9 +186,15 @@ def __init__(
self._gate_cls = cr_gate or self.CRPulseGate
self._backend_timing = None

super().__init__(
physical_qubits, analysis=CrossResonanceHamiltonianAnalysis(), backend=backend
)
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message="deprecation of Qiskit Pulse",
module="qiskit_experiments",
category=DeprecationWarning,
)
analysis = CrossResonanceHamiltonianAnalysis()
super().__init__(physical_qubits, analysis=analysis, backend=backend)
self.set_experiment_options(durations=durations, **kwargs)

@classmethod
Expand Down
12 changes: 10 additions & 2 deletions qiskit_experiments/library/characterization/drag.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

"""Rough drag experiment."""

import warnings
from typing import Iterable, List, Optional, Sequence
import numpy as np

Expand Down Expand Up @@ -159,8 +160,15 @@ def __init__(
QiskitError: If the schedule does not have a free parameter.
"""

# Create analysis in finalize to reflect user change to reps
super().__init__(physical_qubits, analysis=DragCalAnalysis(), backend=backend)
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message="deprecation of Qiskit Pulse",
module="qiskit_experiments",
category=DeprecationWarning,
)
analysis = DragCalAnalysis()
super().__init__(physical_qubits, analysis=analysis, backend=backend)

if betas is not None:
self.set_experiment_options(betas=betas)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

"""Spectroscopy experiment class for resonators."""

import warnings
from typing import Iterable, Optional, Sequence, Tuple
import numpy as np

Expand Down Expand Up @@ -176,7 +177,14 @@ def __init__(
QiskitError: If no frequencies are given and absolute frequencies are desired and
no backend is given or the backend does not have default measurement frequencies.
"""
analysis = ResonatorSpectroscopyAnalysis()
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message="deprecation of Qiskit Pulse",
module="qiskit_experiments",
category=DeprecationWarning,
)
analysis = ResonatorSpectroscopyAnalysis()

if frequencies is None:
frequencies = np.linspace(-20.0e6, 20.0e6, 51)
Expand Down
10 changes: 9 additions & 1 deletion qiskit_experiments/library/characterization/spectroscopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

"""Abstract spectroscopy experiment base class."""

import warnings
from abc import ABC, abstractmethod
from typing import Iterable, Optional, Sequence

Expand Down Expand Up @@ -93,7 +94,14 @@ def __init__(
QiskitError: If there are less than three frequency shifts.
"""
analysis = analysis or ResonanceAnalysis()
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message="deprecation of Qiskit Pulse",
module="qiskit_experiments",
category=DeprecationWarning,
)
analysis = analysis or ResonanceAnalysis()

super().__init__(physical_qubits, analysis=analysis, backend=backend)

Expand Down
12 changes: 11 additions & 1 deletion qiskit_experiments/library/driven_freq_tuning/p1_spect.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from __future__ import annotations

import warnings
from collections.abc import Sequence

import numpy as np
Expand Down Expand Up @@ -98,9 +99,18 @@ def __init__(
"""
self._timing = None

with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message="deprecation of Qiskit Pulse",
module="qiskit_experiments",
category=DeprecationWarning,
)
analysis = StarkP1SpectAnalysis()

super().__init__(
physical_qubits=physical_qubits,
analysis=StarkP1SpectAnalysis(),
analysis=analysis,
backend=backend,
)
self.set_experiment_options(**experiment_options)
Expand Down
12 changes: 11 additions & 1 deletion qiskit_experiments/library/driven_freq_tuning/ramsey_amp_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from __future__ import annotations

import warnings
from collections.abc import Sequence

import numpy as np
Expand Down Expand Up @@ -118,9 +119,18 @@ def __init__(
"""
self._timing = None

with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message="deprecation of Qiskit Pulse",
module="qiskit_experiments",
category=DeprecationWarning,
)
analysis = StarkRamseyXYAmpScanAnalysis()

super().__init__(
physical_qubits=physical_qubits,
analysis=StarkRamseyXYAmpScanAnalysis(),
analysis=analysis,
backend=backend,
)
self.set_experiment_options(**experiment_options)
Expand Down

0 comments on commit a176cde

Please sign in to comment.