Skip to content
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
19b57ea
implement HEAT ZY experiment
Oct 25, 2021
0c4844e
Merge branch 'main' of github.com:Qiskit/qiskit-experiments into expe…
Oct 26, 2021
128da19
code cleanup
Oct 26, 2021
64dc82b
update method name
Oct 26, 2021
de7b49e
minor update doc
Oct 26, 2021
2e99cb7
Update qiskit_experiments/library/characterization/heat.py
nkanazawa1989 Oct 26, 2021
1c82d77
fix class name
Oct 26, 2021
832e708
class name to be more specific
Oct 27, 2021
6ef4648
reorganization
Oct 27, 2021
b59ae69
remove import
Oct 27, 2021
e93aca1
Update qiskit_experiments/library/heat/base_experiment.py
nkanazawa1989 Nov 1, 2021
bd4dd7b
Update qiskit_experiments/library/heat/base_experiment.py
nkanazawa1989 Nov 1, 2021
1797fc5
comments
Nov 1, 2021
508c4ca
Merge branch 'experiment/heat' of github.com:nkanazawa1989/qiskit-exp…
Nov 1, 2021
cb4d564
simplify the class structure
Nov 1, 2021
4aa3355
Merge branch 'main' of github.com:Qiskit/qiskit-experiments into expe…
Nov 1, 2021
c2269be
conform to #462
Nov 1, 2021
2468670
add comment
Nov 1, 2021
1efd760
set default opt level=0
Nov 1, 2021
b69b166
update opt level to 1
Nov 3, 2021
facae9c
fix gate name
Nov 5, 2021
149b598
separate analysis
Nov 5, 2021
ba5f37c
Merge branch 'main' of github.com:Qiskit/qiskit-experiments into expe…
Nov 5, 2021
3dd3763
conform to new composite analysis
Nov 5, 2021
e6787e6
remove dedicated analysis
Nov 5, 2021
1e2655a
cleanup
Nov 5, 2021
bfdf62d
Merge branch 'main' of github.com:Qiskit/qiskit-experiments into expe…
nkanazawa1989 Dec 10, 2021
5eb5086
remove decorator
nkanazawa1989 Dec 10, 2021
c6a0791
use stateful analysis class
nkanazawa1989 Dec 10, 2021
cfe5810
use callback
nkanazawa1989 Dec 13, 2021
0da7655
cleanup curve analysis (#574)
Dec 10, 2021
577eeb1
Release note for calibrations (#575)
eggerdj Dec 10, 2021
5c3b8e6
Calibration tutorials (#577)
eggerdj Dec 13, 2021
260fcb1
Update fit_result_plotters.py (#578)
Dec 14, 2021
60f6013
Small bugfix in interleaved RB data processing (#580)
gadial Dec 14, 2021
98c020c
renamed file remsey_xy_analysis.py to ramsey_xy_analysis.py (#581)
yaelbh Dec 14, 2021
a4042b3
Update resultsdb tutorial (#582)
coruscating Dec 14, 2021
72eb4b6
Update T2, T2 tutorials to use Aer 0.10 noise model (#579)
chriseclectic Dec 14, 2021
798007b
Edit and condense release notes for 0.2 release (#576)
chriseclectic Dec 14, 2021
f7d7e5f
Bump package version (#597)
chriseclectic Jan 7, 2022
f6ee573
Copied changes to readoutAngle from qiskit-monitoring to qiskit-exper…
merav-aharoni Jan 10, 2022
14ed531
Fix bug with nested composite analysis (#596)
chriseclectic Jan 12, 2022
da129e6
Mitigation experiment (#415)
gadial Jan 13, 2022
29eaf03
Removed sub-experiment info from composite analysis result (#603)
yaelbh Jan 13, 2022
c8b2486
Deleted some lines that are not needed anymore (#594)
yaelbh Jan 17, 2022
735b58b
class reorganization
nkanazawa1989 Jan 19, 2022
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
14 changes: 0 additions & 14 deletions qiskit_experiments/framework/base_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from qiskit.providers import BaseJob
from qiskit.providers.backend import Backend
from qiskit.providers.basebackend import BaseBackend as LegacyBackend
from qiskit.test.mock import FakeBackend
from qiskit.exceptions import QiskitError
from qiskit.qobj.utils import MeasLevel
from qiskit_experiments.framework import Options
Expand Down Expand Up @@ -109,19 +108,6 @@ def run(
run_opts.update_options(**run_options)
run_opts = run_opts.__dict__

# Scheduling parameters
if backend.configuration().simulator is False and isinstance(backend, FakeBackend) is False:
timing_constraints = getattr(self.transpile_options.__dict__, "timing_constraints", {})
timing_constraints["acquire_alignment"] = getattr(
timing_constraints, "acquire_alignment", 16
)
scheduling_method = getattr(
self.transpile_options.__dict__, "scheduling_method", "alap"
)
self.set_transpile_options(
timing_constraints=timing_constraints, scheduling_method=scheduling_method
)

# Generate and transpile circuits
transpile_opts = copy.copy(self.transpile_options.__dict__)
transpile_opts["initial_layout"] = list(self._physical_qubits)
Expand Down
1 change: 1 addition & 0 deletions qiskit_experiments/library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class instance to manage parameters and pulse schedules.
)
from .randomized_benchmarking import StandardRB, InterleavedRB
from .tomography import StateTomography, ProcessTomography
from .heat import ZXHeatZError, ZXHeatYError
from .quantum_volume import QuantumVolume

# Experiment Sub-modules
Expand Down
15 changes: 15 additions & 0 deletions qiskit_experiments/library/characterization/t1.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import numpy as np

from qiskit.providers import Backend
from qiskit.test.mock import FakeBackend
from qiskit.circuit import QuantumCircuit

from qiskit_experiments.framework import BaseExperiment, Options
Expand Down Expand Up @@ -102,6 +103,20 @@ def circuits(self, backend: Optional[Backend] = None) -> List[QuantumCircuit]:
Raises:
AttributeError: if unit is dt but dt parameter is missing in the backend configuration
"""
# Scheduling parameters
# TODO wait for base class refactoring
if backend.configuration().simulator is False and isinstance(backend, FakeBackend) is False:
timing_constraints = getattr(self.transpile_options.__dict__, "timing_constraints", {})
timing_constraints["acquire_alignment"] = getattr(
timing_constraints, "acquire_alignment", 16
)
scheduling_method = getattr(
self.transpile_options.__dict__, "scheduling_method", "alap"
)
self.set_transpile_options(
timing_constraints=timing_constraints, scheduling_method=scheduling_method
)

if self.experiment_options.unit == "dt":
try:
dt_factor = getattr(backend.configuration(), "dt")
Expand Down
15 changes: 15 additions & 0 deletions qiskit_experiments/library/characterization/t2ramsey.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import qiskit
from qiskit.utils import apply_prefix
from qiskit.providers import Backend
from qiskit.test.mock import FakeBackend
from qiskit.circuit import QuantumCircuit
from qiskit_experiments.framework import BaseExperiment, Options
from .t2ramsey_analysis import T2RamseyAnalysis
Expand Down Expand Up @@ -117,6 +118,20 @@ def circuits(self, backend: Optional[Backend] = None) -> List[QuantumCircuit]:
Raises:
AttributeError: if unit is 'dt', but 'dt' parameter is missing in the backend configuration.
"""
# Scheduling parameters
# TODO wait for base class refactoring
if backend.configuration().simulator is False and isinstance(backend, FakeBackend) is False:
timing_constraints = getattr(self.transpile_options.__dict__, "timing_constraints", {})
timing_constraints["acquire_alignment"] = getattr(
timing_constraints, "acquire_alignment", 16
)
scheduling_method = getattr(
self.transpile_options.__dict__, "scheduling_method", "alap"
)
self.set_transpile_options(
timing_constraints=timing_constraints, scheduling_method=scheduling_method
)

conversion_factor = 1
if self.experiment_options.unit == "dt":
try:
Expand Down
16 changes: 16 additions & 0 deletions qiskit_experiments/library/heat/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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.
"""
Hamiltonian Error Amplifying Tomography Experiments.
"""

from .zx_heat import ZXHeatYError, ZXHeatZError
126 changes: 126 additions & 0 deletions qiskit_experiments/library/heat/base_analysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# 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.
"""
Analysis for HEAT experiments.
"""

from abc import ABC

import numpy as np

from qiskit_experiments.curve_analysis import ErrorAmplificationAnalysis
from qiskit_experiments.exceptions import AnalysisError
from qiskit_experiments.framework import (
CompositeAnalysis,
CompositeExperimentData,
AnalysisResultData,
Options,
FitVal,
)


class HeatAnalysis(ErrorAmplificationAnalysis):
"""An analysis class for HEAT experiment to define the fixed parameters."""

__fixed_parameters__ = ["angle_per_gate", "phase_offset", "amp"]

@classmethod
def _default_options(cls) -> Options:
"""Default analysis options."""
options = super()._default_options()
options.angle_per_gate = np.pi
options.phase_offset = np.pi / 2
options.amp = 1.0

return options


class CompositeHeatAnalysis(CompositeAnalysis, ABC):
r"""A composite error amplification analysis to get unitary error coefficients.

# section: fit_model

This analysis takes a set of `d_theta` parameters from two error amplification
analysis results. Each parameter is extracted from the HEAT experiment with
different control qubit states. Namely,

.. math::

A_{I\beta} = \frac{{d\theta_{\beta 0}} + d\theta_{\beta 1}}}{2}

A_{Z\beta} = \frac{{d\theta_{\beta 0}} - d\theta_{\beta 1}}}{2}

where, :math:`\beta \in [X, Y, Z]` is one of single qubit Pauli terms,
:math:`d\theta_{\beta k}` is `d_theta` parameter extracted from the HEAT experiment
with the control qubit state :math:`|k\rangle \in [|0\rangle, |1\rangle]`.

# section: see_also
qiskit_experiments.curve_analysis.standard_analysis.error_amplification_analysis.\
ErrorAmplificationAnalysis

"""
__fit_params__ = []
__out_params__ = []

def _run_analysis(self, experiment_data: CompositeExperimentData, **options):

# Validate setup
if len(self.__fit_params__) != 2:
raise AnalysisError(
f"{self.__class__.__name__} assumes two fit parameters extracted from "
"a set of experiments with different control qubit state input. "
f"{len(self.__fit_params__)} input parameter names are specified."
)

if len(self.__out_params__) != 2:
raise AnalysisError(
f"{self.__class__.__name__} assumes two output parameters computed with "
"a set of experiment results with different control qubit state input. "
f"{len(self.__out_params__)} output parameter names are specified."
)

# Create analysis data of nested experiment and discard redundant entry.
# Note that experiment_data is mutable.
super()._run_analysis(experiment_data, **options)

sub_analysis_results = [
experiment_data.component_experiment_data(i).analysis_results(pname)
for i, pname in enumerate(self.__fit_params__)
]

# Check data quality
is_good_quality = all(r.quality == "good" for r in sub_analysis_results)

# Compute unitary terms
ib = (sub_analysis_results[0].value.value + sub_analysis_results[1].value.value) / 2
zb = (sub_analysis_results[0].value.value - sub_analysis_results[1].value.value) / 2

# Compute new variance
sigma = np.sqrt(
sub_analysis_results[0].value.stderr ** 2 + sub_analysis_results[1].value.stderr ** 2
)

estimate_ib = AnalysisResultData(
name=self.__out_params__[0],
value=FitVal(value=ib, stderr=sigma, unit="rad"),
quality="good" if is_good_quality else "bad",
)

estimate_zb = AnalysisResultData(
name=self.__out_params__[1],
value=FitVal(value=zb, stderr=sigma, unit="rad"),
quality="good" if is_good_quality else "bad",
)

composite_analysis_results = [estimate_ib, estimate_zb]

return composite_analysis_results, None
Loading