Skip to content

Commit

Permalink
Release notes 0.4 (#869)
Browse files Browse the repository at this point in the history
  • Loading branch information
coruscating authored Aug 16, 2022
1 parent 670bf3b commit e6636be
Show file tree
Hide file tree
Showing 35 changed files with 176 additions and 131 deletions.
2 changes: 1 addition & 1 deletion docs/release_notes.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.. release-notes:: Release Notes
.. release-notes:: Release Notes
6 changes: 6 additions & 0 deletions qiskit_experiments/data_processing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
AverageData
BasisExpectationValue
MinMaxNormalize
RestlessNode
RestlessToCounts
RestlessToIQ
Discriminators
Expand All @@ -90,6 +93,9 @@
AverageData,
BasisExpectationValue,
MinMaxNormalize,
RestlessNode,
RestlessToCounts,
RestlessToIQ,
)

from .data_processor import DataProcessor
Expand Down
2 changes: 1 addition & 1 deletion qiskit_experiments/data_processing/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ class RestlessToIQ(RestlessNode):
one, i.e. :math:`(I_2 - I_1) + i(Q_2 - Q_1)` for consecutively measured IQ points
:math:`I_1 + iQ_1` and :math:`I_2 + iQ_2`. Following this, it takes the absolute
value of the in-phase and quadrature component and returns a sequence of circuit-
ordered IQ values, e.g. containing :math:`\abs{(I_2 - I_1)} + i\abs{(Q_2 - Q_1)}`.
ordered IQ values, e.g. containing :math:`|I_2 - I_1| + i|Q_2 - Q_1|`.
This procedure is based on M. Werninghaus, et al., PRX Quantum 2, 020324 (2021).
"""

Expand Down
2 changes: 2 additions & 0 deletions qiskit_experiments/framework/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,13 @@
ExperimentStatus
JobStatus
AnalysisStatus
AnalysisResult
AnalysisResultData
ExperimentConfig
AnalysisConfig
ExperimentEncoder
ExperimentDecoder
BackendData
FigureData
.. _composite-experiment:
Expand Down
1 change: 1 addition & 0 deletions qiskit_experiments/framework/analysis_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class AnalysisResult:
capable of holding arbitrary values (in a dictionary indexed by a string).
The data fields in the `db_data` dataclass are:
* `experiment_id`: `str`
* `result_id`: `str`
* `result_type`: `str`
Expand Down
10 changes: 8 additions & 2 deletions qiskit_experiments/framework/experiment_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,16 @@ def _wrapped(self, *args, **kwargs):


class FigureData:
"""Wrapper for figures and figure metadata"""
"""Wrapper class for figures and figure metadata. The raw figure can be accessed with
the ``figure`` attribute."""

def __init__(self, figure, name=None, metadata=None):
"""Creates a new figure data object"""
"""Creates a new figure data object.
Args:
figure: the raw figure itself. Can be SVG or matplotlib.Figure.
name: Optional, the name of the figure.
metadata: Optional, any metadata to be stored with the figure."""
self.figure = figure
self._name = name
self.metadata = metadata or {}
Expand Down
18 changes: 15 additions & 3 deletions qiskit_experiments/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,31 @@
act like a normal :class:`~qiskit.providers.BackendV1` for a real device but
instead call a simulator internally.
.. autosummary::
:toctree: ../stubs/
FakeJob
FakeService
.. _backends:
Fake Backends
=============
Mock backends for running simulated jobs.
.. autosummary::
:toctree: ../stubs/
MockIQBackend
MockIQParallelBackend
T2HahnBackend
NoisyDelayAerBackend
FakeJob
FakeService
"""

from .utils import FakeJob
from .mock_iq_backend import MockIQBackend
from .mock_iq_backend import MockIQBackend, MockIQParallelBackend
from .noisy_delay_aer_simulator import NoisyDelayAerBackend
from .t2hahn_backend import T2HahnBackend
from .fake_service import FakeService
64 changes: 38 additions & 26 deletions qiskit_experiments/test/mock_iq_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ def _draw_iq_shots(
) -> List[List[List[Union[float, complex]]]]:
"""
Produce an IQ shot.
Args:
prob: A list of probabilities for each output.
shots: The number of times the circuit will run.
Expand Down Expand Up @@ -378,6 +379,7 @@ def _generate_data(
) -> Dict[str, Any]:
"""
Generate data for the circuit.
Args:
prob_dict: A dictionary whose keys are strings representing the output vectors and
their values are the probability to get the output in this circuit.
Expand Down Expand Up @@ -426,20 +428,24 @@ def _generate_data(
def run(self, run_input: List[QuantumCircuit], **run_options) -> FakeJob:
"""
Run the IQ backend.
Args:
run_input: A list of QuantumCircuit for which the backend will generate
data.
**run_options: Experiment running options. The options that are supported in this backend are
'meas_level', 'meas_return' and 'shots'.
'meas_level': To generate data in the IQ plane, 'meas_level' should be assigned 1 or
MeasLevel.KERNELED. If 'meas_level' is 2 or MeasLevel.CLASSIFIED, the generated data
will be in the form of 'counts'.
'meas_return': This option will only take effect if 'meas_level' = MeasLevel.CLASSIFIED.
It can get either MeasReturnType.AVERAGE or MeasReturnType.SINGLE. For the value
MeasReturnType.SINGLE the data of each shot will be stored in the result. For
MeasReturnType.AVERAGE, an average of all the shots will be calculated and stored
in the result.
'shots': The number of times the circuit will run.
data.
**run_options: Experiment running options. The options that are supported
in this backend are `meas_level`, `meas_return` and `shots`:
* meas_level: To generate data in the IQ plane, `meas_level` should be
assigned 1 or ``MeasLevel.KERNELED``. If `meas_level` is 2 or
``MeasLevel.CLASSIFIED``, the generated data will be in the form
of `counts`.
* meas_return: This option will only take effect if `meas_level` =
``MeasLevel.CLASSIFIED``. It can get either
``MeasReturnType.AVERAGE`` or ``MeasReturnType.SINGLE``. For
``MeasReturnType.SINGLE``, the data of each shot will be stored in
the result. For ``MeasReturnType.AVERAGE``, an average of all the
shots will be calculated and stored in the result.
* shots: The number of times the circuit will run.
Returns:
FakeJob: A job that contains the simulated data.
Expand Down Expand Up @@ -488,9 +494,10 @@ def __init__(
):
"""
Initialize the backend.
Args:
experiment_helper: Parallel experiment helper class that contains
helper classes for each experiment.
helper classes for each experiment.
rng_seed: The random seed value.
"""
super().__init__(experiment_helper, rng_seed)
Expand All @@ -504,6 +511,7 @@ def experiment_helper(self):
def experiment_helper(self, value):
"""
Setter for the experiment helper.
Args:
value(MockIQParallelExperimentHelper): The helper for the backend to use for generating IQ
shots.
Expand All @@ -529,7 +537,7 @@ def _parallel_draw_iq_shots(
Produce an IQ shot.
Args:
list_exp_dict: A list of dictionaries for each experiment. It is determined by the
'MockIQParallelExperimentHelper' object provided to the backend.
``MockIQParallelExperimentHelper`` object provided to the backend.
shots: The number of times the circuit will run.
circ_qubits: List of qubits that are used in this circuit.
circ_idx: The circuit index.
Expand Down Expand Up @@ -651,20 +659,24 @@ def _parallel_generate_data(
def run(self, run_input: List[QuantumCircuit], **run_options) -> FakeJob:
"""
Run the IQ backend.
Args:
run_input: A list of QuantumCircuit for which the backend will generate
data.
**run_options: Experiment running options. The options that are supported in this backend are
'meas_level', 'meas_return' and 'shots'.
'meas_level': To generate data in the IQ plane, 'meas_level' should be assigned 1 or
MeasLevel.KERNELED. The backend currently doesn't support 'meas_level' = 2 or
MeasLevel.CLASSIFIED.
'meas_return': This option will only take effect if 'meas_level' = MeasLevel.CLASSIFIED.
It can get either MeasReturnType.AVERAGE or MeasReturnType.SINGLE. For the value
MeasReturnType.SINGLE the data of each shot will be stored in the result. For
MeasReturnType.AVERAGE, an average of all the shots will be calculated and stored
in the result.
'shots': The number of times the circuit will run.
data.
**run_options: Experiment running options. The options that are supported
in this backend are `meas_level`, `meas_return` and `shots`:
* meas_level: To generate data in the IQ plane, `meas_level` should be
assigned 1 or ``MeasLevel.KERNELED``. If `meas_level` is 2 or
``MeasLevel.CLASSIFIED``, the generated data will be in the form
of `counts`.
* meas_return: This option will only take effect if `meas_level` =
``MeasLevel.CLASSIFIED``. It can get either
``MeasReturnType.AVERAGE`` or ``MeasReturnType.SINGLE``. For
``MeasReturnType.SINGLE``, the data of each shot will be stored in
the result. For ``MeasReturnType.AVERAGE``, an average of all the
shots will be calculated and stored in the result.
* shots: The number of times the circuit will run.
Returns:
FakeJob: A job that contains the simulated data.
Expand Down
6 changes: 4 additions & 2 deletions qiskit_experiments/test/mock_iq_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(
`iq_cluster_centers` as follows:
.. code-block:: python
iq_center = helper.iq_cluster_centers[i_qbt][i_state]
center_inphase = iq_center[0]
center_quadrature = iq_center[1]
Expand All @@ -55,9 +56,10 @@ def __init__(
standard-deviation of the IQ cluster for qubit `i_qbt` is
.. code-block:: python
iq_width = helper.iq_cluster_width[i_qbt]
Subclasses must call `super().__init__(iq_cluster_centers,iq_cluster_width)` so that these
Subclasses must call ``super().__init__(iq_cluster_centers,iq_cluster_width)`` so that these
properties are stored appropriately.
Args:
Expand Down Expand Up @@ -226,7 +228,7 @@ def __init__(
Raises:
ValueError: Raised if the list are empty or if they don't have the same length.
QiskitError: Raised if `exp_helper_list` contains an object of type
`MockIQParallelExperimentHelper`, because the parallel mock backend currently does not
``MockIQParallelExperimentHelper``, because the parallel mock backend currently does not
support parallel sub-experiments.`.
Examples:
Expand Down
6 changes: 5 additions & 1 deletion qiskit_experiments/test/t2hahn_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def _qubit_initialization(self, nqubits: int) -> List[dict]:
"""
Initialize the list of qubits state. If initialization error is provided to the backend it will
use it to determine the initialized state.
Args:
nqubits(int): the number of qubits in the circuit.
Expand Down Expand Up @@ -129,6 +130,7 @@ def _delay_gate(self, qubit_state: dict, delay: float, t2hahn: float, frequency:
"""
Apply delay gate to the qubit. From the delay time we can calculate the probability
that an error has accrued.
Args:
qubit_state(dict): The state of the qubit before operating the gate.
delay(float): The time in which there are no operation on the qubit.
Expand Down Expand Up @@ -172,6 +174,7 @@ def _delay_gate(self, qubit_state: dict, delay: float, t2hahn: float, frequency:
def _rx_gate(self, qubit_state: dict, angle: float) -> dict:
"""
Apply Rx gate.
Args:
qubit_state(dict): The state of the qubit before operating the gate.
angle(float): The angle of the rotation.
Expand Down Expand Up @@ -247,7 +250,8 @@ def _rx_gate(self, qubit_state: dict, angle: float) -> dict:

def _measurement_gate(self, qubit_state: dict) -> int:
"""
implementing measurement on qubit with read-out error.
Implementing measurement on qubit with read-out error.
Args:
qubit_state(dict): The state of the qubit at the end of the circuit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ deprecations:
Boolean values for the ``analysis`` kwarg in
:meth:`qiskit_experiments.framework.BaseExperiment.run` have been deprecated.
Use ``analysis="default"`` instead of ``analysis=True``, and
``analysis=None``instead of ``analysis=False``.
``analysis=None`` instead of ``analysis=False``.
- |
Using the ``__analysis_class__`` class attrbiute to define a default
:class:`~qiskit_experiments.framework.BaseAnalysis` class in a
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/0.4/0_4_release-5716aa7442b995b2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
prelude: >
The Qiskit Experiments 0.4 release includes major improvements to the :class:`.CurveAnalysis`
class and other bug fixes and improvements. The database service has switched to the
`qiskit-ibm-experiment <https://github.com/Qiskit/qiskit-ibm-experiment>`_ provider.
Several new data processing nodes have been added.
4 changes: 4 additions & 0 deletions releasenotes/notes/0.4/after-job-fail-aaaa0de4f28ae40c.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
Fixes a bug that caused analysis to sometimes run after job or previous analysis failure.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
features:
- |
Adds a new class, :class:`.BackendData` which provides a common access inferface
for both :class:`.BackendV1` and :class:`.BackendV2` data fields, since those
Adds a new class, :class:`.BackendData`, which provides a common access inferface
for both :class:`~qiskit.providers.backend.BackendV1` and
:class:`~qiskit.providers.backend.BackendV2` data fields, since those
classes do not share the same interface. The :class:`.BackendData` can be called
on a backend and used immediately, and it is also automatically stored as the
`_backend_data` field of :class:`Experiment`. Note that not all data fields
``_backend_data`` field of :class:`.BaseExperiment`. Note that not all data fields
are currently accessible via :class:`.BackendData`; to access additional
fields, the corresponding method should be added to :class:`.BackendData`
with correct treatment for both V1 and V2 backends.
Loading

0 comments on commit e6636be

Please sign in to comment.