From ad6d660f207ec9ff8254dfc4d3d95e4a7c301dd9 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa Date: Fri, 15 Sep 2023 09:17:11 +0900 Subject: [PATCH 001/113] FineFrequencyCal (failed) --- .../library/calibration/fine_frequency_cal.py | 49 ++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/fine_frequency_cal.py b/qiskit_experiments/library/calibration/fine_frequency_cal.py index 5fe3251f89..51312ff660 100644 --- a/qiskit_experiments/library/calibration/fine_frequency_cal.py +++ b/qiskit_experiments/library/calibration/fine_frequency_cal.py @@ -28,7 +28,54 @@ class FineFrequencyCal(BaseCalibrationExperiment, FineFrequency): - """A calibration version of the fine frequency experiment.""" + """A calibration version of the fine frequency experiment. + + # section: example + ..jupyter-execute:: + + # mwc + import pandas as pd + import numpy as np + import qiskit.pulse as pulse + from qiskit.circuit import Parameter + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit import schedule + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + + ..jupyter-execute:: + :hide-code: + + # backend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, noise=False, seed=100) + + ..jupyter-execute:: + + # mwc + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + + qubit = 0 + library = FixedFrequencyTransmon(default_values={"duration": 320}) + cals = Calibrations.from_backend(backend, libraries=[library]) + + from qiskit_experiments.library import FineFrequencyCal + + freq_cal = FineFrequencyCal([qubit], + cals, + backend=backend, + delay_duration=None, + repetitions=None, + auto_update=True, + gate_name="sx", + ) + + freq_cal.set_transpile_options(scheduling_method="asap", + optimization_level=3, + basis_gates=["sx", "rz", "delay"] + ) + + exp_data_x90p = freq_cal.run().block_for_results() + exp_data_x90p.figure(0) + """ def __init__( self, From 56efc5f734d753b00e95138f1db99da340a320aa Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa Date: Wed, 8 Nov 2023 12:18:21 +0900 Subject: [PATCH 002/113] fine_frequency_cal : a bit improved --- .../library/calibration/fine_frequency_cal.py | 49 +------------------ 1 file changed, 1 insertion(+), 48 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_frequency_cal.py b/qiskit_experiments/library/calibration/fine_frequency_cal.py index 51312ff660..5fe3251f89 100644 --- a/qiskit_experiments/library/calibration/fine_frequency_cal.py +++ b/qiskit_experiments/library/calibration/fine_frequency_cal.py @@ -28,54 +28,7 @@ class FineFrequencyCal(BaseCalibrationExperiment, FineFrequency): - """A calibration version of the fine frequency experiment. - - # section: example - ..jupyter-execute:: - - # mwc - import pandas as pd - import numpy as np - import qiskit.pulse as pulse - from qiskit.circuit import Parameter - from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit import schedule - from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend - - ..jupyter-execute:: - :hide-code: - - # backend - backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, noise=False, seed=100) - - ..jupyter-execute:: - - # mwc - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon - - qubit = 0 - library = FixedFrequencyTransmon(default_values={"duration": 320}) - cals = Calibrations.from_backend(backend, libraries=[library]) - - from qiskit_experiments.library import FineFrequencyCal - - freq_cal = FineFrequencyCal([qubit], - cals, - backend=backend, - delay_duration=None, - repetitions=None, - auto_update=True, - gate_name="sx", - ) - - freq_cal.set_transpile_options(scheduling_method="asap", - optimization_level=3, - basis_gates=["sx", "rz", "delay"] - ) - - exp_data_x90p = freq_cal.run().block_for_results() - exp_data_x90p.figure(0) - """ + """A calibration version of the fine frequency experiment.""" def __init__( self, From 610b2257273a88f19796c0ed544ef3e3a832c638 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 26 Oct 2024 15:28:06 +0900 Subject: [PATCH 003/113] Update fine_amplitude.py update fine_amplitude.py --- .../library/calibration/fine_amplitude.py | 102 +++++++++++++++++- 1 file changed, 100 insertions(+), 2 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_amplitude.py b/qiskit_experiments/library/calibration/fine_amplitude.py index 8e3ff17972..c99f8d4768 100644 --- a/qiskit_experiments/library/calibration/fine_amplitude.py +++ b/qiskit_experiments/library/calibration/fine_amplitude.py @@ -36,6 +36,40 @@ class FineAmplitudeCal(BaseCalibrationExperiment, FineAmplitude): experiment the circuits that are run have a custom gate with the pulse schedule attached to it through the calibrations. + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=101) + + .. jupyter-execute:: + + import numpy as np + from qiskit.circuit.library import XGate + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library import FineAmplitudeCal + + library = FixedFrequencyTransmon() + cals = Calibrations.from_backend(backend=backend, libraries=[library]) + exp_cal = FineAmplitudeCal(physical_qubits=(0,), + calibrations=cals, + schedule_name="x", + backend=backend, + cal_parameter_name="amp", + auto_update=True, + gate=XGate(), + measurement_qubits=(0,)) + # This option is necessary! + exp_cal.analysis.set_options(fixed_parameters={"angle_per_gate" : np.pi, "phase_offset" : np.pi/2}) + + print(exp_cal.circuits()[5]) + + cal_data = exp_cal.run().block_for_results() + display(cal_data.figure(0)) + cal_data.analysis_results(dataframe=True) """ def __init__( @@ -156,8 +190,38 @@ def update_calibrations(self, experiment_data: ExperimentData): class FineXAmplitudeCal(FineAmplitudeCal): - """A calibration experiment to calibrate the amplitude of the X schedule.""" + r"""A calibration experiment to calibrate the amplitude of the X schedule. + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=True, seed=111) + + .. jupyter-execute:: + + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library import FineXAmplitudeCal + + library = FixedFrequencyTransmon(default_values={"duration": 320}) + cals = Calibrations.from_backend(backend, libraries=[library]) + + exp_cal = FineXAmplitudeCal((0,), + cals, + schedule_name="x", + backend=backend, + cal_parameter_name="amp", + auto_update=True, + ) + + exp_data = exp_cal.run().block_for_results() + display(exp_data.figure(0)) + exp_data.analysis_results(dataframe=True) + """ + def __init__( self, physical_qubits: Sequence[int], @@ -204,7 +268,41 @@ def _pre_circuit(self, num_clbits: int) -> QuantumCircuit: class FineSXAmplitudeCal(FineAmplitudeCal): - """A calibration experiment to calibrate the amplitude of the SX schedule.""" + r"""A calibration experiment to calibrate the amplitude of the SX schedule. + + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=True, seed=105) + + .. jupyter-execute:: + + import numpy as np + import qiskit.pulse as pulse + from qiskit import schedule + from qiskit.circuit import Parameter + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library import FineSXAmplitudeCal + + library = FixedFrequencyTransmon(default_values={"duration": 320}) + cals = Calibrations.from_backend(backend, libraries=[library]) + + exp_cal = FineSXAmplitudeCal((0,), + cals, + schedule_name="sx", + backend=backend, + cal_parameter_name="amp", + auto_update=True, + ) + + cal_data = exp_cal.run().block_for_results() + display(cal_data.figure(0)) + cal_data.analysis_results(dataframe=True) + """ def __init__( self, From 406ed4634c01df7f04dfab91624a3e9a02a40d99 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 26 Oct 2024 15:49:46 +0900 Subject: [PATCH 004/113] Update fine_drag_cal.py update fine_drag_cal.py --- .../library/calibration/fine_drag_cal.py | 104 +++++++++++++++++- 1 file changed, 101 insertions(+), 3 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_drag_cal.py b/qiskit_experiments/library/calibration/fine_drag_cal.py index 74ff341657..5735eaf4f6 100644 --- a/qiskit_experiments/library/calibration/fine_drag_cal.py +++ b/qiskit_experiments/library/calibration/fine_drag_cal.py @@ -30,7 +30,38 @@ class FineDragCal(BaseCalibrationExperiment, FineDrag): - """A calibration version of the fine DRAG experiment.""" + r"""A calibration version of the fine DRAG experiment. + + # section: example + .. jupyter-execute:: + :hide-code: + + #backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=108) + + .. jupyter-execute:: + + import numpy as np + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library import FineDragCal + + library = FixedFrequencyTransmon(default_values={"duration": 320}) + cals = Calibrations.from_backend(backend, libraries=[library]) + + exp_cal = FineDragCal((0,), + cals, + backend=backend, + schedule_name="sx", + cal_parameter_name="β", + auto_update=True, + ) + + cal_data = exp_cal.run().block_for_results() + display(cal_data.figure(0)) + cal_data.analysis_results(dataframe=True) + """ def __init__( self, @@ -146,7 +177,44 @@ def update_calibrations(self, experiment_data: ExperimentData): class FineXDragCal(FineDragCal): - """Fine DRAG calibration of X gate.""" + r"""Fine DRAG calibration of X gate. + + # section: example + .. jupyter-execute:: + :hide-code: + + #backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=118) + + .. jupyter-execute:: + + import numpy as np + import pandas as pd + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library import FineXDragCal + + library = FixedFrequencyTransmon(default_values={"duration": 320, "amp": 0.4}) + cals = Calibrations.from_backend(backend, libraries=[library]) + + exp_cal = FineXDragCal((0,), + cals, + backend=backend, + cal_parameter_name="β", + auto_update=True, + ) + + cal_data = exp_cal.run().block_for_results() + display(cal_data.figure(0)) + display(cal_data.analysis_results(dataframe=True)) + + pd.DataFrame(**cals.parameters_table(qubit_list=[0])) + + cal_data = exp_cal.run().block_for_results() + display(cal_data.figure(0)) + cal_data.analysis_results(dataframe=True) + """ def __init__( self, @@ -178,7 +246,37 @@ def __init__( class FineSXDragCal(FineDragCal): - """Fine DRAG calibration of X gate.""" + r"""Fine DRAG calibration of X gate. + + # section: example + .. jupyter-execute:: + :hide-code: + + #backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=118) + + .. jupyter-execute:: + + import numpy as np + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library import FineSXDragCal + + library = FixedFrequencyTransmon(default_values={"duration": 320}) + cals = Calibrations.from_backend(backend=backend, libraries=[library]) + + exp_cal = FineSXDragCal((0,), + cals, + backend=backend, + cal_parameter_name="β", + auto_update=True, + ) + + cal_data = exp_cal.run().block_for_results() + display(cal_data.figure(0)) + cal_data.analysis_results(dataframe=True) + """ def __init__( self, From a8c7b910989d8dc9879ac323bc1f3187ba14e497 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 26 Oct 2024 15:56:21 +0900 Subject: [PATCH 005/113] Update fine_frequency_cal.py update fine_frequency_cal.py --- .../library/calibration/fine_frequency_cal.py | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/fine_frequency_cal.py b/qiskit_experiments/library/calibration/fine_frequency_cal.py index 13b1c64b62..7cc161d5f6 100644 --- a/qiskit_experiments/library/calibration/fine_frequency_cal.py +++ b/qiskit_experiments/library/calibration/fine_frequency_cal.py @@ -28,7 +28,31 @@ class FineFrequencyCal(BaseCalibrationExperiment, FineFrequency): - """A calibration version of the fine frequency experiment.""" + r"""A calibration version of the fine frequency experiment. + + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_ibm_runtime.fake_provider import FakePerth + from qiskit_aer import AerSimulator + + backend = AerSimulator.from_backend(FakePerth()) + + .. jupyter-execute:: + + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library.calibration.fine_frequency_cal import FineFrequencyCal + + cals = Calibrations.from_backend(backend=backend, libraries=[FixedFrequencyTransmon()]) + exp_cal = FineFrequencyCal((0,), cals, backend=backend, auto_update=True, gate_name="sx") + + cal_data=exp_cal.run().block_for_results() + display(cal_data.figure(0)) + cal_data.analysis_results(dataframe=True) + """ def __init__( self, From edf38217d16bb420190b48d13547bc4aa61d48c0 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 26 Oct 2024 16:02:11 +0900 Subject: [PATCH 006/113] Update frequency_cal.py update frequency_cal.py --- .../library/calibration/frequency_cal.py | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/frequency_cal.py b/qiskit_experiments/library/calibration/frequency_cal.py index 5f683b217d..e96d23812b 100644 --- a/qiskit_experiments/library/calibration/frequency_cal.py +++ b/qiskit_experiments/library/calibration/frequency_cal.py @@ -27,7 +27,31 @@ class FrequencyCal(BaseCalibrationExperiment, RamseyXY): - """A qubit frequency calibration experiment based on the Ramsey XY experiment.""" + r"""A qubit frequency calibration experiment based on the Ramsey XY experiment. + + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_ibm_runtime.fake_provider import FakePerth + from qiskit_aer import AerSimulator + + backend = AerSimulator.from_backend(FakePerth()) + + .. jupyter-execute:: + + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library.calibration.frequency_cal import FrequencyCal + + cals = Calibrations.from_backend(backend=backend, libraries=[FixedFrequencyTransmon()]) + exp_cal = FrequencyCal((0,), cals, backend=backend, auto_update=True) + + cal_data=exp_cal.run().block_for_results() + display(cal_data.figure(0)) + cal_data.analysis_results(dataframe=True) + """ def __init__( self, From 2aed40fcd10672c816de1fa6b1bed4d7b0eb0883 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 26 Oct 2024 16:08:22 +0900 Subject: [PATCH 007/113] Update half_angle_cal.py update half_angle_cal.py --- .../library/calibration/half_angle_cal.py | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/half_angle_cal.py b/qiskit_experiments/library/calibration/half_angle_cal.py index e3c3784ba3..696e0057f5 100644 --- a/qiskit_experiments/library/calibration/half_angle_cal.py +++ b/qiskit_experiments/library/calibration/half_angle_cal.py @@ -28,7 +28,40 @@ class HalfAngleCal(BaseCalibrationExperiment, HalfAngle): - """Calibration version of the :class:`.HalfAngle` experiment.""" + r"""Calibration version of the :class:`.HalfAngle` experiment. + + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=199) + + .. jupyter-execute:: + + from qiskit import pulse + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library.calibration.half_angle_cal import HalfAngleCal + + library = FixedFrequencyTransmon(default_values={"duration": 640}) + cals = Calibrations.from_backend(backend=backend, libraries=[library]) + exp_cal = HalfAngleCal((0,), cals, backend=backend) + + inst_map = backend.defaults().instruction_schedule_map + with pulse.build(backend=backend, name="y") as sched_build: + pulse.play(pulse.Drag(duration=160, + sigma=40, + beta=5, + amp=0.05821399464431249, + angle=0.0,), pulse.DriveChannel(0),) + inst_map.add("y", (0,), sched_build) + + cal_data = exp_cal.run().block_for_results() + display(cal_data.figure(0)) + cal_data.analysis_results(dataframe=True) + """ def __init__( self, From 3ce9c6bbb835c888bb98d9d6d2ab82c10a715867 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 26 Oct 2024 16:25:54 +0900 Subject: [PATCH 008/113] Update rough_amplitude_cal.py update rough_amplitude_cal.py --- .../calibration/rough_amplitude_cal.py | 133 +++++++++++++++++- 1 file changed, 131 insertions(+), 2 deletions(-) diff --git a/qiskit_experiments/library/calibration/rough_amplitude_cal.py b/qiskit_experiments/library/calibration/rough_amplitude_cal.py index c6bea05d53..24f67522f0 100644 --- a/qiskit_experiments/library/calibration/rough_amplitude_cal.py +++ b/qiskit_experiments/library/calibration/rough_amplitude_cal.py @@ -31,7 +31,40 @@ class RoughAmplitudeCal(BaseCalibrationExperiment, Rabi): - """A calibration version of the Rabi experiment.""" + r"""A calibration version of the Rabi experiment. + + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=True, seed=106) + + .. jupyter-execute:: + + import numpy as np + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library.calibration import RoughAmplitudeCal + + library = FixedFrequencyTransmon() + cals = Calibrations.from_backend(backend=backend, libraries=[library]) + + exp_cal = RoughAmplitudeCal(physical_qubits=(0,), + calibrations=cals, + schedule_name="x", + amplitudes=np.linspace(-0.1, 0.1, 51), + cal_parameter_name="amp", + target_angle=np.pi, + auto_update=True, + group="default", + backend=backend) + + cal_data = exp_cal.run().block_for_results() + display(cal_data.figure(0)) + cal_data.analysis_results(dataframe=True) + """ def __init__( self, @@ -189,7 +222,31 @@ def update_calibrations(self, experiment_data: ExperimentData): class RoughXSXAmplitudeCal(RoughAmplitudeCal): - """A rough amplitude calibration of x and sx gates.""" + r"""A rough amplitude calibration of x and sx gates. + + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=True, seed=180) + + .. jupyter-execute:: + + import numpy as np + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library.calibration import RoughXSXAmplitudeCal + + library = FixedFrequencyTransmon() + cals = Calibrations.from_backend(backend, libraries=[library]) + exp_cal = RoughXSXAmplitudeCal((0,), cals, backend=backend, amplitudes=np.linspace(-0.1, 0.1, 51)) + + cal_data = exp_cal.run().block_for_results() + display(cal_data.figure(0)) + cal_data.analysis_results(dataframe=True) + """ def __init__( self, @@ -220,6 +277,78 @@ def __init__( class EFRoughXSXAmplitudeCal(RoughAmplitudeCal): r"""A rough amplitude calibration of :math:`X` and :math:`SX` gates on the :math:`|1\rangle` <-> :math:`|2\rangle` transition. + + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=True, seed=180) + + .. jupyter-execute:: + + import numpy as np + import pandas as pd + import qiskit.pulse as pulse + from qiskit.compiler import schedule + from qiskit.circuit import Parameter + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library.calibration import EFRoughXSXAmplitudeCal + + library = FixedFrequencyTransmon() + cals = Calibrations.from_backend( + backend=backend, + libraries=[library] + ) + + amp = Parameter("amp") + + with pulse.build(name="x12") as build_x12: + with pulse.align_left(): + pulse.shift_frequency(-.25e9, pulse.DriveChannel(0)) + pulse.play(pulse.Drag(160, + amp, + 40, + 0., + 0., + ), pulse.DriveChannel(0)) + + with pulse.build(name="sx12") as build_sx12: + with pulse.align_left(): + pulse.shift_frequency(-.25e9, pulse.DriveChannel(0)) + pulse.play(pulse.Drag(160, + amp / 2, + 40, + 0., + 0., + ), pulse.DriveChannel(0)) + + cals.add_schedule(build_x12, qubits=(0,), num_qubits=1) + cals.add_schedule(build_sx12, qubits=(0,), num_qubits=1) + for sched in ["x", "x12"]: + cals.add_parameter_value(0.5, "amp", (0,), schedule=sched) + + for sched in ["sx", "sx12"]: + cals.add_parameter_value(0.25, "amp", (0,), schedule=sched) + + columns_to_show = ["parameter", "qubits", "schedule", "value", "date_time"] + pd.DataFrame(**cals.parameters_table(qubit_list=[0, ()]))[columns_to_show] + + exp_cal = EFRoughXSXAmplitudeCal(physical_qubits=(0,), + calibrations=cals, + amplitudes=np.linspace(-0.1, 0.1, 51), + backend=backend, + ef_pulse_label="12",) + + print(exp_cal.calibrations) + print(exp_cal.circuits()[0]) + print(exp_cal.circuits()[0].calibrations) + + cal_data = exp_cal.run().block_for_results() + display(cal_data.figure(0)) + cal_data.analysis_results(dataframe=True) """ __outcome__ = "rabi_rate_12" From 299b66e85bf97697cf6094882dcb43496053b6bf Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 26 Oct 2024 16:36:09 +0900 Subject: [PATCH 009/113] Update rough_drag_cal.py update rough_drag_cal.py --- .../library/calibration/rough_drag_cal.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/qiskit_experiments/library/calibration/rough_drag_cal.py b/qiskit_experiments/library/calibration/rough_drag_cal.py index 21e055f8c4..afe8a2599e 100644 --- a/qiskit_experiments/library/calibration/rough_drag_cal.py +++ b/qiskit_experiments/library/calibration/rough_drag_cal.py @@ -32,6 +32,32 @@ class RoughDragCal(BaseCalibrationExperiment, RoughDrag): # section: manual :ref:`DRAG Calibration` + # section: example + .. jupyter-execute:: + :hide-code: + + #backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=161) + + .. jupyter-execute:: + + import numpy as np + import qiskit.pulse as pulse + from qiskit import schedule + from qiskit.circuit import Parameter + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library import RoughDragCal + + library = FixedFrequencyTransmon(default_values={"duration": 320, "amp": 0.03}) + cals = Calibrations.from_backend(backend=backend, libraries=[library]) + exp_cal = RoughDragCal((0,), cals, backend=backend, betas=np.linspace(-20, 20, 25)) + exp_cal.set_experiment_options(reps=[3, 5, 7]) + + cal_data = exp_cal.run().block_for_results() + display(cal_data.figure(0)) + cal_data.analysis_results(dataframe=True) """ def __init__( From df39f1ed4fbb4886ab4b7c1638b13d7120a3f142 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 26 Oct 2024 16:45:14 +0900 Subject: [PATCH 010/113] Update rough_frequency.py update rough_frequency.py remark: RoughEFFrequencyCal is missing --- .../library/calibration/rough_frequency.py | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/qiskit_experiments/library/calibration/rough_frequency.py b/qiskit_experiments/library/calibration/rough_frequency.py index a40f7dcb80..2d5bbff39e 100644 --- a/qiskit_experiments/library/calibration/rough_frequency.py +++ b/qiskit_experiments/library/calibration/rough_frequency.py @@ -27,8 +27,37 @@ class RoughFrequencyCal(BaseCalibrationExperiment, QubitSpectroscopy): - """A calibration experiment that runs :class:`.QubitSpectroscopy` to calibrate the qubit - transition frequency.""" + r"""A calibration experiment that runs :class:`.QubitSpectroscopy` to calibrate the qubit + transition frequency. + + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=True, seed=100) + + .. jupyter-execute:: + + import numpy as np + from qiskit_experiments.calibration_management.calibrations import Calibrations + from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.library.calibration.rough_frequency import RoughFrequencyCal + + qubit=0 + library = FixedFrequencyTransmon() + cals = Calibrations.from_backend(backend=backend, libraries=[library]) + + freq_est = backend.defaults().qubit_freq_est[qubit] + frequencies = np.linspace(freq_est-15e6, freq_est+15e6, 51) + exp_cal = RoughFrequencyCal((qubit,), cals, frequencies, backend=backend) + exp_cal.set_experiment_options(amp=0.005) + + cal_data = exp_cal.run().block_for_results() + display(cal_data.figure(0)) + cal_data.analysis_results(dataframe=True) + """ def __init__( self, @@ -78,6 +107,11 @@ def _attach_calibrations(self, circuit: QuantumCircuit): class RoughEFFrequencyCal(BaseCalibrationExperiment, EFSpectroscopy): r"""A calibration experiment that runs :class:`.QubitSpectroscopy` for the :math:`|1\rangle` <-> :math:`|2\rangle` transition. + + + + + """ __updater__ = Frequency From 9754dca7c210969e30180b443b7c735dca80c320 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Mon, 28 Oct 2024 22:49:07 +0900 Subject: [PATCH 011/113] Update qst_experiment.py update QST --- .../library/tomography/qst_experiment.py | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/qst_experiment.py b/qiskit_experiments/library/tomography/qst_experiment.py index 39c17a11d6..226f67cfa5 100644 --- a/qiskit_experiments/library/tomography/qst_experiment.py +++ b/qiskit_experiments/library/tomography/qst_experiment.py @@ -26,7 +26,7 @@ class StateTomography(TomographyExperiment): - """An experiment to reconstruct the quantum state from measurement data. + r"""An experiment to reconstruct the quantum state from measurement data. # section: overview Quantum state tomography (QST) is a method for experimentally @@ -47,6 +47,41 @@ class StateTomography(TomographyExperiment): # section: manual :doc:`/manuals/verification/state_tomography` + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_aer import AerSimulator + from qiskit_ibm_runtime.fake_provider import FakePerth + + backend = AerSimulator.from_backend(FakePerth()) + + .. jupyter-execute:: + + from qiskit import QuantumCircuit + from qiskit_experiments.library import TomographyExperiment + from qiskit_experiments.library.tomography.basis import PauliMeasurementBasis + from qiskit.visualization import plot_state_city + + nq = 2 + qc_ghz = QuantumCircuit(nq) + qc_ghz.h(0) + qc_ghz.s(0) + + for i in range(1, nq): + qc_ghz.cx(0, i) + + qstexp = TomographyExperiment( + circuit=qc_ghz, + backend=backend, + physical_qubits=(0,1), + measurement_basis=PauliMeasurementBasis(), + ) + + qstdata = qstexp.run(backend=backend, shots=1000, seed_simulator=100).block_for_results() + state_result = qstdata.analysis_results("state") + plot_state_city(state_result.value, title="Density Matrix") """ def __init__( From f0bfe3613a27505d2b528ab2fa4eba4bf1c4def8 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Mon, 28 Oct 2024 22:56:58 +0900 Subject: [PATCH 012/113] Update qst_experiment.py upsate StateTomography --- .../library/tomography/qst_experiment.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/qiskit_experiments/library/tomography/qst_experiment.py b/qiskit_experiments/library/tomography/qst_experiment.py index 226f67cfa5..e5fdaae4f4 100644 --- a/qiskit_experiments/library/tomography/qst_experiment.py +++ b/qiskit_experiments/library/tomography/qst_experiment.py @@ -51,7 +51,7 @@ class StateTomography(TomographyExperiment): .. jupyter-execute:: :hide-code: - # backend + # backend from qiskit_aer import AerSimulator from qiskit_ibm_runtime.fake_provider import FakePerth @@ -60,8 +60,7 @@ class StateTomography(TomographyExperiment): .. jupyter-execute:: from qiskit import QuantumCircuit - from qiskit_experiments.library import TomographyExperiment - from qiskit_experiments.library.tomography.basis import PauliMeasurementBasis + from qiskit_experiments.library import StateTomography from qiskit.visualization import plot_state_city nq = 2 @@ -72,17 +71,11 @@ class StateTomography(TomographyExperiment): for i in range(1, nq): qc_ghz.cx(0, i) - qstexp = TomographyExperiment( - circuit=qc_ghz, - backend=backend, - physical_qubits=(0,1), - measurement_basis=PauliMeasurementBasis(), - ) - + qstexp = StateTomography(qc_ghz) qstdata = qstexp.run(backend=backend, shots=1000, seed_simulator=100).block_for_results() state_result = qstdata.analysis_results("state") plot_state_city(state_result.value, title="Density Matrix") - """ + """ def __init__( self, From 6c432531ec94bd74c3caeb66f3486edd6a6860b3 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Mon, 28 Oct 2024 23:03:15 +0900 Subject: [PATCH 013/113] Update tomography_experiment.py update TomographyExperiment --- .../tomography/tomography_experiment.py | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/tomography_experiment.py b/qiskit_experiments/library/tomography/tomography_experiment.py index bced816a49..f28aab561d 100644 --- a/qiskit_experiments/library/tomography/tomography_experiment.py +++ b/qiskit_experiments/library/tomography/tomography_experiment.py @@ -27,10 +27,46 @@ class TomographyExperiment(BaseExperiment): - """Base experiment for quantum state and process tomography. + r"""Base experiment for quantum state and process tomography. # section: analysis_ref :class:`TomographyAnalysis` + + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_aer import AerSimulator + from qiskit_ibm_runtime.fake_provider import FakePerth + + backend = AerSimulator.from_backend(FakePerth()) + + .. jupyter-execute:: + + from qiskit import QuantumCircuit + from qiskit_experiments.library import TomographyExperiment + from qiskit_experiments.library.tomography.basis import PauliMeasurementBasis + from qiskit.visualization import plot_state_city + + nq = 2 + qc_ghz = QuantumCircuit(nq) + qc_ghz.h(0) + qc_ghz.s(0) + + for i in range(1, nq): + qc_ghz.cx(0, i) + + qstexp = TomographyExperiment( + circuit=qc_ghz, + backend=backend, + physical_qubits=(0,1), + measurement_basis=PauliMeasurementBasis(), + ) + + qstdata = qstexp.run(backend=backend, shots=1000, seed_simulator=100).block_for_results() + state_result = qstdata.analysis_results("state") + plot_state_city(state_result.value, title="Density Matrix") """ @classmethod From 0e8e6adb8c266568c9be859637d4854bffa3ba5c Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Mon, 28 Oct 2024 23:14:57 +0900 Subject: [PATCH 014/113] Update mit_qst_experiment.py update MitigatedStateTomography --- .../library/tomography/mit_qst_experiment.py | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/mit_qst_experiment.py b/qiskit_experiments/library/tomography/mit_qst_experiment.py index 98bec48fe2..cf7c7308ff 100644 --- a/qiskit_experiments/library/tomography/mit_qst_experiment.py +++ b/qiskit_experiments/library/tomography/mit_qst_experiment.py @@ -25,7 +25,7 @@ class MitigatedStateTomography(BatchExperiment): - """A batched experiment to characterize readout error then perform state tomography + r"""A batched experiment to characterize readout error then perform state tomography for doing readout error mitigated state tomography. # section: overview @@ -50,6 +50,41 @@ class MitigatedStateTomography(BatchExperiment): * :py:class:`qiskit_experiments.library.tomography.StateTomography` * :py:class:`qiskit_experiments.library.characterization.LocalReadoutError` + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_aer import AerSimulator + from qiskit_ibm_runtime.fake_provider import FakePerth + from qiskit_aer.noise import NoiseModel + + noise_model = NoiseModel.from_backend(FakePerth(), + thermal_relaxation=False, + gate_error=False, + readout_error=True, + ) + + backend = AerSimulator.from_backend(FakePerth(), noise_model=noise_model) + + .. jupyter-execute:: + + from qiskit import QuantumCircuit + from qiskit_experiments.library import MitigatedStateTomography + from qiskit.visualization import plot_state_city + + nq = 2 + qc_ghz = QuantumCircuit(nq) + qc_ghz.h(0) + qc_ghz.s(0) + + for i in range(1, nq): + qc_ghz.cx(0, i) + + mitqstexp = MitigatedStateTomography(qc_ghz) + mitqstdata = mitqstexp.run(backend=backend, shots=1000, seed_simulator=100).block_for_results() + state_result = mitqstdata.analysis_results("state") + plot_state_city(state_result.value, title="mitigated Density Matrix") """ def __init__( From 5eeea9b329b107d4ea80bbd694b071cb53ef3778 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Mon, 28 Oct 2024 23:22:03 +0900 Subject: [PATCH 015/113] Update qpt_experiment.py update ProcessTomography --- .../library/tomography/qpt_experiment.py | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/qpt_experiment.py b/qiskit_experiments/library/tomography/qpt_experiment.py index 17d7d7347b..f0b07bc078 100644 --- a/qiskit_experiments/library/tomography/qpt_experiment.py +++ b/qiskit_experiments/library/tomography/qpt_experiment.py @@ -27,7 +27,7 @@ class ProcessTomography(TomographyExperiment): - """An experiment to reconstruct the quantum channel from measurement data. + r"""An experiment to reconstruct the quantum channel from measurement data. # section: overview Quantum process tomography (QPT) is a method for experimentally @@ -46,6 +46,49 @@ class ProcessTomography(TomographyExperiment): # section: analysis_ref :class:`ProcessTomographyAnalysis` + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_aer import AerSimulator + from qiskit_ibm_runtime.fake_provider import FakePerth + + backend = AerSimulator.from_backend(FakePerth()) + + .. jupyter-execute:: + + import numpy as np + from qiskit import QuantumCircuit + from qiskit_experiments.library import ProcessTomography + + num_qubits = 2 + qc_ghz = QuantumCircuit(num_qubits) + qc_ghz.h(0) + qc_ghz.s(0) + + for i in range(1, num_qubits): + qc_ghz.cx(0, i) + + qptexp = ProcessTomography(qc_ghz) + qptdata = qptexp.run(backend=backend, shots=1000, seed_simulator=100).block_for_results() + choi_out = qptdata.analysis_results("state").value + + # extracting a densitymatrix from choi_out + from qiskit.visualization import plot_state_city + import qiskit.quantum_info as qinfo + + _rho_exp_00 = np.array([[None, None, None, None], + [None, None, None, None], + [None, None, None, None], + [None, None, None, None]]) + + for i in range(4): + for j in range(4): + _rho_exp_00[i][j] = choi_out.data[i][j] + + rho_exp_00 = qinfo.DensityMatrix(_rho_exp_00) + display(plot_state_city(rho_exp_00, title="Density Matrix")) """ def __init__( From 0be4c0ddf48c89f19ae1185e9ae9da4b3cff44de Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Mon, 28 Oct 2024 23:32:01 +0900 Subject: [PATCH 016/113] Update mit_qpt_experiment.py update MitigatedProcessTomography --- .../library/tomography/mit_qpt_experiment.py | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/mit_qpt_experiment.py b/qiskit_experiments/library/tomography/mit_qpt_experiment.py index bdebf34bd0..0d31d79c06 100644 --- a/qiskit_experiments/library/tomography/mit_qpt_experiment.py +++ b/qiskit_experiments/library/tomography/mit_qpt_experiment.py @@ -25,7 +25,7 @@ class MitigatedProcessTomography(BatchExperiment): - """A batched experiment to characterize readout error then perform process tomography + r"""A batched experiment to characterize readout error then perform process tomography for doing readout error mitigated process tomography. # section: overview @@ -50,6 +50,49 @@ class MitigatedProcessTomography(BatchExperiment): * :py:class:`qiskit_experiments.library.tomography.ProcessTomography` * :py:class:`qiskit_experiments.library.characterization.LocalReadoutError` + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_aer import AerSimulator + from qiskit_ibm_runtime.fake_provider import FakePerth + + backend = AerSimulator.from_backend(FakePerth()) + + ..jupyter-execute:: + + import numpy as np + from qiskit import QuantumCircuit + from qiskit_experiments.library import MitigatedProcessTomography + + num_qubits = 2 + qc_ghz = QuantumCircuit(num_qubits) + qc_ghz.h(0) + qc_ghz.s(0) + + for i in range(1, num_qubits): + qc_ghz.cx(0, i) + + mitqptexp = MitigatedProcessTomography(qc_ghz) + mitqptdata = mitqptexp.run(backend=backend, shots=1000, seed_simulator=100).block_for_results() + mitigated_choi_out = mitqptdata.analysis_results("state").value + + # extracting a densitymatrix from mitigated_choi_out + from qiskit.visualization import plot_state_city + import qiskit.quantum_info as qinfo + + _rho_exp_00 = np.array([[None, None, None, None], + [None, None, None, None], + [None, None, None, None], + [None, None, None, None]]) + + for i in range(4): + for j in range(4): + _rho_exp_00[i][j] = mitigated_choi_out.data[i][j] + + mitigated_rho_exp_00 = qinfo.DensityMatrix(_rho_exp_00) + display(plot_state_city(mitigated_rho_exp_00, title="mitigated Density Matrix")) """ def __init__( From fea22e902006c5fbd88286944ee7390802f1a33b Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 04:53:52 +0900 Subject: [PATCH 017/113] Update mit_qpt_experiment.py update MitigatedProcessTomography --- qiskit_experiments/library/tomography/mit_qpt_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/mit_qpt_experiment.py b/qiskit_experiments/library/tomography/mit_qpt_experiment.py index 0d31d79c06..4c8825a930 100644 --- a/qiskit_experiments/library/tomography/mit_qpt_experiment.py +++ b/qiskit_experiments/library/tomography/mit_qpt_experiment.py @@ -60,7 +60,7 @@ class MitigatedProcessTomography(BatchExperiment): backend = AerSimulator.from_backend(FakePerth()) - ..jupyter-execute:: + .. jupyter-execute:: import numpy as np from qiskit import QuantumCircuit From a252cc83e42a412f08d15b08df7980fcae8d10c6 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 05:52:36 +0900 Subject: [PATCH 018/113] Update qv_experiment.py update QuantumVolume --- .../library/quantum_volume/qv_experiment.py | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/quantum_volume/qv_experiment.py b/qiskit_experiments/library/quantum_volume/qv_experiment.py index 5d64b37377..694ad2fe03 100644 --- a/qiskit_experiments/library/quantum_volume/qv_experiment.py +++ b/qiskit_experiments/library/quantum_volume/qv_experiment.py @@ -28,7 +28,7 @@ class QuantumVolume(BaseExperiment): - """An experiment to measure the largest random square circuit that can be run on a processor. + r"""An experiment to measure the largest random square circuit that can be run on a processor. # section: overview Quantum Volume (QV) is a single-number metric that can be measured using a concrete protocol @@ -66,6 +66,31 @@ class QuantumVolume(BaseExperiment): .. ref_arxiv:: 1 1811.12926 .. ref_arxiv:: 2 2008.08571 + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_aer import AerSimulator + from qiskit_ibm_runtime.fake_provider import FakeSydneyV2 + backend = AerSimulator.from_backend(FakeSydneyV2()) + + .. jupyter-execute:: + + from qiskit_experiments.framework import BatchExperiment + from qiskit_experiments.library import QuantumVolume + + qubits = tuple(range(4)) # Can use specific qubits. for example [2, 4, 7, 10] + qv_exp = QuantumVolume(qubits, seed=42) + qv_exp.set_transpile_options(optimization_level=3) + qv_exp.set_run_options(shots=1000) + + expdata = qv_exp.run(backend).block_for_results() + + display(expdata.figure(0)) + + for result in expdata.analysis_results(): + print(result) """ def __init__( From 2fc0ee3ee764315d546030d53b4a2345458010ec Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 09:17:27 +0900 Subject: [PATCH 019/113] Update standard_rb.py update StandardRB --- .../randomized_benchmarking/standard_rb.py | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py index 43c77bb8c1..1ab7b71350 100644 --- a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py +++ b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py @@ -84,6 +84,51 @@ class StandardRB(BaseExperiment, RestlessMixin): # section: reference .. ref_arxiv:: 1 1009.3639 .. ref_arxiv:: 2 1109.6887 + + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_aer import AerSimulator + from qiskit_ibm_runtime.fake_provider import FakePerth + + backend = AerSimulator.from_backend(FakePerth()) + print(backend.coupling_map) + + .. jupyter-execute:: + + import numpy as np + from qiskit_experiments.library import StandardRB, InterleavedRB + from qiskit_experiments.framework import ParallelExperiment, BatchExperiment + import qiskit.circuit.library as circuits + + lengths_2_qubit = np.arange(1, 200, 30) + lengths_1_qubit = np.arange(1, 800, 200) + num_samples = 10 + seed = 1010 + qubits = (1, 2) + + # Run a 1-qubit RB experiment on qubits 1, 2 to determine the error-per-gate of 1-qubit gates + single_exps = BatchExperiment( + [ + StandardRB((qubit,), lengths_1_qubit, num_samples=num_samples, seed=seed) + for qubit in qubits + ] + ) + expdata_1q = single_exps.run(backend).block_for_results() + + exp_2q = StandardRB(qubits, lengths_2_qubit, num_samples=num_samples, seed=seed) + + # Use the EPG data of the 1-qubit runs to ensure correct 2-qubit EPG computation + exp_2q.analysis.set_options(epg_1_qubit=expdata_1q.analysis_results()) + + expdata_2q = exp_2q.run(backend).block_for_results() + + print("Gate error ratio: %s" % expdata_2q.experiment.analysis.options.gate_error_ratio) + display(expdata_2q.figure(0)) + for result in expdata_2q.analysis_results(): + print(result) """ def __init__( From b4a81fe6c64d9731e9ecbece522fe19932d71ba4 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 09:18:12 +0900 Subject: [PATCH 020/113] Update standard_rb.py update StandardRB --- .../library/randomized_benchmarking/standard_rb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py index 1ab7b71350..6a6855bafe 100644 --- a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py +++ b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py @@ -54,7 +54,7 @@ class StandardRB(BaseExperiment, RestlessMixin): - """An experiment to characterize the error rate of a gate set on a device. + r"""An experiment to characterize the error rate of a gate set on a device. # section: overview From 8d41d011dd1731ffacbeb1428c6a0ec714157025 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 09:24:25 +0900 Subject: [PATCH 021/113] Update interleaved_rb_experiment.py update InterleavedRB --- .../interleaved_rb_experiment.py | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/randomized_benchmarking/interleaved_rb_experiment.py b/qiskit_experiments/library/randomized_benchmarking/interleaved_rb_experiment.py index 114f23b8a5..9d77725a4f 100644 --- a/qiskit_experiments/library/randomized_benchmarking/interleaved_rb_experiment.py +++ b/qiskit_experiments/library/randomized_benchmarking/interleaved_rb_experiment.py @@ -32,7 +32,7 @@ class InterleavedRB(StandardRB): - """An experiment to characterize the error rate of a specific gate on a device. + r"""An experiment to characterize the error rate of a specific gate on a device. # section: overview Interleaved Randomized Benchmarking (RB) is a method @@ -53,6 +53,37 @@ class InterleavedRB(StandardRB): # section: reference .. ref_arxiv:: 1 1203.4550 + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_aer import AerSimulator + from qiskit_ibm_runtime.fake_provider import FakePerth + + backend = AerSimulator.from_backend(FakePerth()) + + .. jupyter-execute:: + + import numpy as np + from qiskit_experiments.library import StandardRB, InterleavedRB + from qiskit_experiments.framework import ParallelExperiment, BatchExperiment + import qiskit.circuit.library as circuits + + lengths = np.arange(1, 200, 30) + num_samples = 10 + seed = 1010 + qubits = (1, 2) + + int_exp2 = InterleavedRB( + circuits.CXGate(), qubits, lengths, num_samples=num_samples, seed=seed) + + int_expdata2 = int_exp2.run(backend).block_for_results() + int_results2 = int_expdata2.analysis_results() + + display(int_expdata2.figure(0)) + for result in int_results2: + print(result) """ def __init__( From 8faa9e8559d3923ef4f02d32ecf1d3805d671fb3 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 09:34:33 +0900 Subject: [PATCH 022/113] Update layer_fidelity.py update LayerFidelity --- .../randomized_benchmarking/layer_fidelity.py | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py b/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py index 40c5247f87..5c36822304 100644 --- a/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py +++ b/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py @@ -76,6 +76,52 @@ class LayerFidelity(BaseExperiment, RestlessMixin): # section: reference .. ref_arxiv:: 1 2311.05933 + + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_aer import AerSimulator + from qiskit_ibm_runtime.fake_provider import FakePerth + backend = AerSimulator.from_backend(FakePerth()) + + print(backend.coupling_map) + + .. jupyter-execute:: + + import numpy as np + from qiskit_experiments.library import StandardRB + from qiskit_experiments.library.randomized_benchmarking import LayerFidelity + + lengths = np.arange(1, 800, 200) + two_qubit_layers=[[(0, 1), (3, 5)], [(1, 3), (5, 6)]] + + for qpair in two_qubit_layers: + for qpair_ in backend.coupling_map: + if qpair_ == qpair: + pass + + num_samples = 6 + seed = 1010 + + exp = LayerFidelity( + physical_qubits=[0, 1, 3, 5, 6], + two_qubit_layers=two_qubit_layers, + lengths=lengths, + backend=backend, + num_samples=num_samples, + seed=seed, + two_qubit_gate=None, + one_qubit_basis_gates=None, + ) + + exp.set_run_options(shots=5000) + expdata = exp.run().block_for_results() + results = expdata.analysis_results() + + for i in range(4): + display(expdata.figure(i)) """ def __init__( From ccfd09b438ceadbe5a170e6df8ffb334fe8b9c8f Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:37:51 +0900 Subject: [PATCH 023/113] Update rabi.py update EFRabi --- .../library/characterization/rabi.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/qiskit_experiments/library/characterization/rabi.py b/qiskit_experiments/library/characterization/rabi.py index 7306ce23f5..cdf26e8c40 100644 --- a/qiskit_experiments/library/characterization/rabi.py +++ b/qiskit_experiments/library/characterization/rabi.py @@ -256,8 +256,8 @@ class EFRabi(Rabi): ) # backend - from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend - backend = SingleTransmonTestBackend(5.2e9, -0.25e9, 1e9, 0.8e9, 1e4, noise=True, seed=198) + from qiskit_experiments.test import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5e9, -0.25e9, 1e9, 0.8e9, 1e4, noise=True) .. jupyter-execute:: @@ -267,12 +267,16 @@ class EFRabi(Rabi): from qiskit_experiments.library import EFRabi with pulse.build() as build_sched: - pulse.play(pulse.Gaussian(160, Parameter("amp"), sigma=40), pulse.DriveChannel(0)) + with pulse.align_left(): + pulse.shift_frequency(-0.25e9, pulse.DriveChannel(0)) + pulse.play(pulse.Gaussian(160, Parameter("amp"), 40), pulse.DriveChannel(0)) exp = EFRabi(physical_qubits=(0,), - backend=backend, schedule=build_sched, - amplitudes=np.linspace(-0.1, 0.1, 21),) + amplitudes=np.linspace(-0.1, 0.1, 21), + backend=backend,) + + display(exp.circuits()[1].draw()) exp_data = exp.run().block_for_results() display(exp_data.figure(0)) From a2648597843a365eb2665aceac6244ee5feb7686 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:42:55 +0900 Subject: [PATCH 024/113] Update ef_spectroscopy.py update EFSpectroscopy --- .../library/characterization/ef_spectroscopy.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/qiskit_experiments/library/characterization/ef_spectroscopy.py b/qiskit_experiments/library/characterization/ef_spectroscopy.py index 0b28c6636f..51107e47cb 100644 --- a/qiskit_experiments/library/characterization/ef_spectroscopy.py +++ b/qiskit_experiments/library/characterization/ef_spectroscopy.py @@ -22,7 +22,7 @@ class EFSpectroscopy(QubitSpectroscopy): - """A spectroscopy experiment to obtain a frequency sweep of the qubit's e-f transition. + r"""A spectroscopy experiment to obtain a frequency sweep of the qubit's e-f transition. # section: overview The circuits produced by spectroscopy, i.e. @@ -49,12 +49,15 @@ class EFSpectroscopy(QubitSpectroscopy): qubit = 0 freq01_estimate = backend.defaults().qubit_freq_est[qubit] - frequencies = np.linspace(freq01_estimate-15e6, freq01_estimate+15e6, 51) - - exp = EFSpectroscopy(physical_qubits = (0,), - frequencies = frequencies, - backend = backend, - ) + freq12_estimate = freq01_estimate + (-.25e9) + frequencies = np.linspace(freq12_estimate-15e6, freq12_estimate+15e6, 51) + + exp = EFSpectroscopy( + physical_qubits = (0,), + frequencies = frequencies, + backend = backend, + absolute = True, + ) exp.set_experiment_options(amp=0.005) exp_data = exp.run().block_for_results() From b6bd9b5428dafaa4bc5a0743d6dbb19134492cc1 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:34:08 +0900 Subject: [PATCH 025/113] update fine_amplitude.py --- qiskit_experiments/library/calibration/fine_amplitude.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_amplitude.py b/qiskit_experiments/library/calibration/fine_amplitude.py index c99f8d4768..88a5f909ce 100644 --- a/qiskit_experiments/library/calibration/fine_amplitude.py +++ b/qiskit_experiments/library/calibration/fine_amplitude.py @@ -220,8 +220,8 @@ class FineXAmplitudeCal(FineAmplitudeCal): exp_data = exp_cal.run().block_for_results() display(exp_data.figure(0)) exp_data.analysis_results(dataframe=True) - """ - + """ + def __init__( self, physical_qubits: Sequence[int], @@ -269,7 +269,7 @@ def _pre_circuit(self, num_clbits: int) -> QuantumCircuit: class FineSXAmplitudeCal(FineAmplitudeCal): r"""A calibration experiment to calibrate the amplitude of the SX schedule. - + # section: example .. jupyter-execute:: :hide-code: From a58e115e777bf42d853fc8837b37cb31c65e05e1 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:35:17 +0900 Subject: [PATCH 026/113] update rough_frequency.py --- qiskit_experiments/library/calibration/rough_frequency.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/rough_frequency.py b/qiskit_experiments/library/calibration/rough_frequency.py index 2d5bbff39e..8f82b84bfc 100644 --- a/qiskit_experiments/library/calibration/rough_frequency.py +++ b/qiskit_experiments/library/calibration/rough_frequency.py @@ -111,7 +111,7 @@ class RoughEFFrequencyCal(BaseCalibrationExperiment, EFSpectroscopy): - + """ __updater__ = Frequency From b45902f3571780967567f8891672c49dd9d9de95 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:37:13 +0900 Subject: [PATCH 027/113] update randomized_benchmarking/layer_fidelity.py --- .../library/randomized_benchmarking/layer_fidelity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py b/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py index 5c36822304..e2da4b56e9 100644 --- a/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py +++ b/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py @@ -81,7 +81,7 @@ class LayerFidelity(BaseExperiment, RestlessMixin): .. jupyter-execute:: :hide-code: - # backend + # backend from qiskit_aer import AerSimulator from qiskit_ibm_runtime.fake_provider import FakePerth backend = AerSimulator.from_backend(FakePerth()) From 9e828b332d96df423a7aaef70cf64fce566f5970 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:38:08 +0900 Subject: [PATCH 028/113] update tomography/qpt_experiment.py --- qiskit_experiments/library/tomography/qpt_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/qpt_experiment.py b/qiskit_experiments/library/tomography/qpt_experiment.py index f0b07bc078..237d10d1a6 100644 --- a/qiskit_experiments/library/tomography/qpt_experiment.py +++ b/qiskit_experiments/library/tomography/qpt_experiment.py @@ -87,7 +87,7 @@ class ProcessTomography(TomographyExperiment): for j in range(4): _rho_exp_00[i][j] = choi_out.data[i][j] - rho_exp_00 = qinfo.DensityMatrix(_rho_exp_00) + rho_exp_00 = qinfo.DensityMatrix(_rho_exp_00) display(plot_state_city(rho_exp_00, title="Density Matrix")) """ From c919d7cf9506e5581287aa653ed399fd17747307 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:39:14 +0900 Subject: [PATCH 029/113] update tomography/qst_experiment.py --- qiskit_experiments/library/tomography/qst_experiment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qiskit_experiments/library/tomography/qst_experiment.py b/qiskit_experiments/library/tomography/qst_experiment.py index e5fdaae4f4..c294519082 100644 --- a/qiskit_experiments/library/tomography/qst_experiment.py +++ b/qiskit_experiments/library/tomography/qst_experiment.py @@ -51,7 +51,7 @@ class StateTomography(TomographyExperiment): .. jupyter-execute:: :hide-code: - # backend + # backend from qiskit_aer import AerSimulator from qiskit_ibm_runtime.fake_provider import FakePerth @@ -75,7 +75,7 @@ class StateTomography(TomographyExperiment): qstdata = qstexp.run(backend=backend, shots=1000, seed_simulator=100).block_for_results() state_result = qstdata.analysis_results("state") plot_state_city(state_result.value, title="Density Matrix") - """ + """ def __init__( self, From ee2e8bb6a467d62e47e545d6bef3f6778969908e Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:24:04 +0900 Subject: [PATCH 030/113] update calibration/fine_drag_cal.py --- qiskit_experiments/library/calibration/fine_drag_cal.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_drag_cal.py b/qiskit_experiments/library/calibration/fine_drag_cal.py index 5735eaf4f6..db84e722cc 100644 --- a/qiskit_experiments/library/calibration/fine_drag_cal.py +++ b/qiskit_experiments/library/calibration/fine_drag_cal.py @@ -44,7 +44,8 @@ class FineDragCal(BaseCalibrationExperiment, FineDrag): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library import FineDragCal library = FixedFrequencyTransmon(default_values={"duration": 320}) @@ -192,7 +193,8 @@ class FineXDragCal(FineDragCal): import numpy as np import pandas as pd from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library import FineXDragCal library = FixedFrequencyTransmon(default_values={"duration": 320, "amp": 0.4}) @@ -260,7 +262,8 @@ class FineSXDragCal(FineDragCal): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library import FineSXDragCal library = FixedFrequencyTransmon(default_values={"duration": 320}) From 1cb91cc0b770f7775a39be6e04184f00a0c7893f Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:25:02 +0900 Subject: [PATCH 031/113] update tomography/mit_qpt_experiment.py --- qiskit_experiments/library/tomography/mit_qpt_experiment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/mit_qpt_experiment.py b/qiskit_experiments/library/tomography/mit_qpt_experiment.py index 4c8825a930..124dbabaa5 100644 --- a/qiskit_experiments/library/tomography/mit_qpt_experiment.py +++ b/qiskit_experiments/library/tomography/mit_qpt_experiment.py @@ -75,7 +75,8 @@ class MitigatedProcessTomography(BatchExperiment): qc_ghz.cx(0, i) mitqptexp = MitigatedProcessTomography(qc_ghz) - mitqptdata = mitqptexp.run(backend=backend, shots=1000, seed_simulator=100).block_for_results() + mitqptexp.set_run_options(shots=1000) + mitqptdata = mitqptexp.run(backend=backend, seed_simulator=100).block_for_results() mitigated_choi_out = mitqptdata.analysis_results("state").value # extracting a densitymatrix from mitigated_choi_out From 063e870d325f5db2e1a839ce61cb572921d7422d Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:25:44 +0900 Subject: [PATCH 032/113] update tomography/mit_qst_experiment.py --- qiskit_experiments/library/tomography/mit_qst_experiment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/mit_qst_experiment.py b/qiskit_experiments/library/tomography/mit_qst_experiment.py index cf7c7308ff..c4dae7c49e 100644 --- a/qiskit_experiments/library/tomography/mit_qst_experiment.py +++ b/qiskit_experiments/library/tomography/mit_qst_experiment.py @@ -82,7 +82,8 @@ class MitigatedStateTomography(BatchExperiment): qc_ghz.cx(0, i) mitqstexp = MitigatedStateTomography(qc_ghz) - mitqstdata = mitqstexp.run(backend=backend, shots=1000, seed_simulator=100).block_for_results() + mitqstexp.set_run_options(shots=1000) + mitqstdata = mitqstexp.run(backend=backend, seed_simulator=100).block_for_results() state_result = mitqstdata.analysis_results("state") plot_state_city(state_result.value, title="mitigated Density Matrix") """ From cc8de312712889591b9820a53bbe7c6e7b0095f4 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:36:13 +0900 Subject: [PATCH 033/113] update tomography/mit_qst_experiment.py --- qiskit_experiments/library/tomography/mit_qst_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/mit_qst_experiment.py b/qiskit_experiments/library/tomography/mit_qst_experiment.py index c4dae7c49e..84ea5200e8 100644 --- a/qiskit_experiments/library/tomography/mit_qst_experiment.py +++ b/qiskit_experiments/library/tomography/mit_qst_experiment.py @@ -82,7 +82,7 @@ class MitigatedStateTomography(BatchExperiment): qc_ghz.cx(0, i) mitqstexp = MitigatedStateTomography(qc_ghz) - mitqstexp.set_run_options(shots=1000) + mitqstexp.set_run_options(shots=1000) mitqstdata = mitqstexp.run(backend=backend, seed_simulator=100).block_for_results() state_result = mitqstdata.analysis_results("state") plot_state_city(state_result.value, title="mitigated Density Matrix") From f0ee881cfa5484e4055633f6c3ad81ffba8f3b28 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:36:39 +0900 Subject: [PATCH 034/113] update tomography/mit_qpt_experiment.py --- qiskit_experiments/library/tomography/mit_qpt_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/mit_qpt_experiment.py b/qiskit_experiments/library/tomography/mit_qpt_experiment.py index 124dbabaa5..f0342d3f5b 100644 --- a/qiskit_experiments/library/tomography/mit_qpt_experiment.py +++ b/qiskit_experiments/library/tomography/mit_qpt_experiment.py @@ -75,7 +75,7 @@ class MitigatedProcessTomography(BatchExperiment): qc_ghz.cx(0, i) mitqptexp = MitigatedProcessTomography(qc_ghz) - mitqptexp.set_run_options(shots=1000) + mitqptexp.set_run_options(shots=1000) mitqptdata = mitqptexp.run(backend=backend, seed_simulator=100).block_for_results() mitigated_choi_out = mitqptdata.analysis_results("state").value From 050fd50d4c68ba0db59d82a4f1315a9e44b3ff1d Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:37:49 +0900 Subject: [PATCH 035/113] update calibration/fine_drag_cal.py --- qiskit_experiments/library/calibration/fine_drag_cal.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_drag_cal.py b/qiskit_experiments/library/calibration/fine_drag_cal.py index db84e722cc..bf9fc04646 100644 --- a/qiskit_experiments/library/calibration/fine_drag_cal.py +++ b/qiskit_experiments/library/calibration/fine_drag_cal.py @@ -45,7 +45,7 @@ class FineDragCal(BaseCalibrationExperiment, FineDrag): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library import FineDragCal library = FixedFrequencyTransmon(default_values={"duration": 320}) @@ -194,7 +194,7 @@ class FineXDragCal(FineDragCal): import pandas as pd from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library import FineXDragCal library = FixedFrequencyTransmon(default_values={"duration": 320, "amp": 0.4}) @@ -263,7 +263,7 @@ class FineSXDragCal(FineDragCal): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library import FineSXDragCal library = FixedFrequencyTransmon(default_values={"duration": 320}) From 2a12c678034eea25bc883eec4a608467ceeb75ae Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:19:10 +0900 Subject: [PATCH 036/113] update calibration/fine_frequency_cal.py --- .../library/calibration/fine_amplitude.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_amplitude.py b/qiskit_experiments/library/calibration/fine_amplitude.py index 88a5f909ce..411165dd26 100644 --- a/qiskit_experiments/library/calibration/fine_amplitude.py +++ b/qiskit_experiments/library/calibration/fine_amplitude.py @@ -49,7 +49,8 @@ class FineAmplitudeCal(BaseCalibrationExperiment, FineAmplitude): import numpy as np from qiskit.circuit.library import XGate from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library import FineAmplitudeCal library = FixedFrequencyTransmon() @@ -63,7 +64,8 @@ class FineAmplitudeCal(BaseCalibrationExperiment, FineAmplitude): gate=XGate(), measurement_qubits=(0,)) # This option is necessary! - exp_cal.analysis.set_options(fixed_parameters={"angle_per_gate" : np.pi, "phase_offset" : np.pi/2}) + exp_cal.analysis.set_options(fixed_parameters={"angle_per_gate" : np.pi, + "phase_offset" : np.pi/2}) print(exp_cal.circuits()[5]) @@ -203,7 +205,8 @@ class FineXAmplitudeCal(FineAmplitudeCal): .. jupyter-execute:: from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library import FineXAmplitudeCal library = FixedFrequencyTransmon(default_values={"duration": 320}) @@ -285,7 +288,8 @@ class FineSXAmplitudeCal(FineAmplitudeCal): from qiskit import schedule from qiskit.circuit import Parameter from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library import FineSXAmplitudeCal library = FixedFrequencyTransmon(default_values={"duration": 320}) From 2b0e196d931106338bb6bbf5575d4d4e72c8d8c6 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:20:22 +0900 Subject: [PATCH 037/113] update calibration/fine_frequency_cal.py --- qiskit_experiments/library/calibration/fine_frequency_cal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/fine_frequency_cal.py b/qiskit_experiments/library/calibration/fine_frequency_cal.py index 7cc161d5f6..801da7ff8a 100644 --- a/qiskit_experiments/library/calibration/fine_frequency_cal.py +++ b/qiskit_experiments/library/calibration/fine_frequency_cal.py @@ -43,7 +43,8 @@ class FineFrequencyCal(BaseCalibrationExperiment, FineFrequency): .. jupyter-execute:: from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library.calibration.fine_frequency_cal import FineFrequencyCal cals = Calibrations.from_backend(backend=backend, libraries=[FixedFrequencyTransmon()]) From 288c021b23632276d47eee279699170add5cd8fe Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:21:14 +0900 Subject: [PATCH 038/113] update calibration/frequency_cal.py --- qiskit_experiments/library/calibration/frequency_cal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/frequency_cal.py b/qiskit_experiments/library/calibration/frequency_cal.py index e96d23812b..24aead4c59 100644 --- a/qiskit_experiments/library/calibration/frequency_cal.py +++ b/qiskit_experiments/library/calibration/frequency_cal.py @@ -42,7 +42,8 @@ class FrequencyCal(BaseCalibrationExperiment, RamseyXY): .. jupyter-execute:: from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library.calibration.frequency_cal import FrequencyCal cals = Calibrations.from_backend(backend=backend, libraries=[FixedFrequencyTransmon()]) From c6686fc503425c025d8c3ad3d9f8ee5c55eeaf67 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:22:27 +0900 Subject: [PATCH 039/113] update calibration/rough_amplitude_cal.py --- .../library/calibration/rough_amplitude_cal.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/qiskit_experiments/library/calibration/rough_amplitude_cal.py b/qiskit_experiments/library/calibration/rough_amplitude_cal.py index 24f67522f0..792c393c99 100644 --- a/qiskit_experiments/library/calibration/rough_amplitude_cal.py +++ b/qiskit_experiments/library/calibration/rough_amplitude_cal.py @@ -45,7 +45,8 @@ class RoughAmplitudeCal(BaseCalibrationExperiment, Rabi): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library.calibration import RoughAmplitudeCal library = FixedFrequencyTransmon() @@ -236,12 +237,17 @@ class RoughXSXAmplitudeCal(RoughAmplitudeCal): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library.calibration import RoughXSXAmplitudeCal library = FixedFrequencyTransmon() cals = Calibrations.from_backend(backend, libraries=[library]) - exp_cal = RoughXSXAmplitudeCal((0,), cals, backend=backend, amplitudes=np.linspace(-0.1, 0.1, 51)) + exp_cal = RoughXSXAmplitudeCal((0,), + cals, + backend=backend, + amplitudes=np.linspace(-0.1, 0.1, 51) + ) cal_data = exp_cal.run().block_for_results() display(cal_data.figure(0)) @@ -294,7 +300,8 @@ class EFRoughXSXAmplitudeCal(RoughAmplitudeCal): from qiskit.compiler import schedule from qiskit.circuit import Parameter from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library.calibration import EFRoughXSXAmplitudeCal library = FixedFrequencyTransmon() From b11fd678bb7d954ec13486abdd844ce472c9cad1 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:23:12 +0900 Subject: [PATCH 040/113] update calibration/rough_drag_cal.py --- qiskit_experiments/library/calibration/rough_drag_cal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/rough_drag_cal.py b/qiskit_experiments/library/calibration/rough_drag_cal.py index afe8a2599e..ce0363fbc4 100644 --- a/qiskit_experiments/library/calibration/rough_drag_cal.py +++ b/qiskit_experiments/library/calibration/rough_drag_cal.py @@ -47,7 +47,8 @@ class RoughDragCal(BaseCalibrationExperiment, RoughDrag): from qiskit import schedule from qiskit.circuit import Parameter from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library import RoughDragCal library = FixedFrequencyTransmon(default_values={"duration": 320, "amp": 0.03}) From 8f4647791fe96f683a09b4d0fd94e71fe938535f Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:24:29 +0900 Subject: [PATCH 041/113] update calibration/rough_frequency.py --- qiskit_experiments/library/calibration/rough_frequency.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/rough_frequency.py b/qiskit_experiments/library/calibration/rough_frequency.py index 8f82b84bfc..535d289ef8 100644 --- a/qiskit_experiments/library/calibration/rough_frequency.py +++ b/qiskit_experiments/library/calibration/rough_frequency.py @@ -42,7 +42,8 @@ class RoughFrequencyCal(BaseCalibrationExperiment, QubitSpectroscopy): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library.calibration.rough_frequency import RoughFrequencyCal qubit=0 From 7c9b2df6555416d74fcced5dde442c4f47286e7d Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:33:07 +0900 Subject: [PATCH 042/113] update calibration/fine_amplitude.py --- qiskit_experiments/library/calibration/fine_amplitude.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_amplitude.py b/qiskit_experiments/library/calibration/fine_amplitude.py index 411165dd26..c38846ab48 100644 --- a/qiskit_experiments/library/calibration/fine_amplitude.py +++ b/qiskit_experiments/library/calibration/fine_amplitude.py @@ -50,7 +50,7 @@ class FineAmplitudeCal(BaseCalibrationExperiment, FineAmplitude): from qiskit.circuit.library import XGate from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library import FineAmplitudeCal library = FixedFrequencyTransmon() @@ -65,7 +65,7 @@ class FineAmplitudeCal(BaseCalibrationExperiment, FineAmplitude): measurement_qubits=(0,)) # This option is necessary! exp_cal.analysis.set_options(fixed_parameters={"angle_per_gate" : np.pi, - "phase_offset" : np.pi/2}) + "phase_offset" : np.pi/2}) print(exp_cal.circuits()[5]) @@ -206,7 +206,7 @@ class FineXAmplitudeCal(FineAmplitudeCal): from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library import FineXAmplitudeCal library = FixedFrequencyTransmon(default_values={"duration": 320}) @@ -289,7 +289,7 @@ class FineSXAmplitudeCal(FineAmplitudeCal): from qiskit.circuit import Parameter from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library import FineSXAmplitudeCal library = FixedFrequencyTransmon(default_values={"duration": 320}) From b615d5e450826846cf3db0c2a0760065999e3458 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:34:04 +0900 Subject: [PATCH 043/113] update calibration/fine_frequency_cal.py --- qiskit_experiments/library/calibration/fine_frequency_cal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/fine_frequency_cal.py b/qiskit_experiments/library/calibration/fine_frequency_cal.py index 801da7ff8a..1d7fa79189 100644 --- a/qiskit_experiments/library/calibration/fine_frequency_cal.py +++ b/qiskit_experiments/library/calibration/fine_frequency_cal.py @@ -44,7 +44,7 @@ class FineFrequencyCal(BaseCalibrationExperiment, FineFrequency): from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library.calibration.fine_frequency_cal import FineFrequencyCal cals = Calibrations.from_backend(backend=backend, libraries=[FixedFrequencyTransmon()]) From 4a11bab79aa35215fa259e3dc5111dbddbe3c64b Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:34:54 +0900 Subject: [PATCH 044/113] update calibration/frequency_cal.py --- qiskit_experiments/library/calibration/frequency_cal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/frequency_cal.py b/qiskit_experiments/library/calibration/frequency_cal.py index 24aead4c59..30e11cede2 100644 --- a/qiskit_experiments/library/calibration/frequency_cal.py +++ b/qiskit_experiments/library/calibration/frequency_cal.py @@ -43,7 +43,7 @@ class FrequencyCal(BaseCalibrationExperiment, RamseyXY): from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library.calibration.frequency_cal import FrequencyCal cals = Calibrations.from_backend(backend=backend, libraries=[FixedFrequencyTransmon()]) From d6aca986fb3245eb5b4d2c25814b2136860a2b62 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:35:54 +0900 Subject: [PATCH 045/113] update calibration/rough_amplitude_cal.py --- .../library/calibration/rough_amplitude_cal.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/qiskit_experiments/library/calibration/rough_amplitude_cal.py b/qiskit_experiments/library/calibration/rough_amplitude_cal.py index 792c393c99..4cba5c7537 100644 --- a/qiskit_experiments/library/calibration/rough_amplitude_cal.py +++ b/qiskit_experiments/library/calibration/rough_amplitude_cal.py @@ -46,7 +46,7 @@ class RoughAmplitudeCal(BaseCalibrationExperiment, Rabi): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library.calibration import RoughAmplitudeCal library = FixedFrequencyTransmon() @@ -238,16 +238,16 @@ class RoughXSXAmplitudeCal(RoughAmplitudeCal): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library.calibration import RoughXSXAmplitudeCal library = FixedFrequencyTransmon() cals = Calibrations.from_backend(backend, libraries=[library]) exp_cal = RoughXSXAmplitudeCal((0,), - cals, - backend=backend, - amplitudes=np.linspace(-0.1, 0.1, 51) - ) + cals, + backend=backend, + amplitudes=np.linspace(-0.1, 0.1, 51) + ) cal_data = exp_cal.run().block_for_results() display(cal_data.figure(0)) @@ -301,7 +301,7 @@ class EFRoughXSXAmplitudeCal(RoughAmplitudeCal): from qiskit.circuit import Parameter from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library.calibration import EFRoughXSXAmplitudeCal library = FixedFrequencyTransmon() From 731c04c1c93c3c0465743f39467bb1cea9b4dd19 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:36:38 +0900 Subject: [PATCH 046/113] update calibration/rough_drag_cal.py --- qiskit_experiments/library/calibration/rough_drag_cal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/rough_drag_cal.py b/qiskit_experiments/library/calibration/rough_drag_cal.py index ce0363fbc4..cb7ec7bb1d 100644 --- a/qiskit_experiments/library/calibration/rough_drag_cal.py +++ b/qiskit_experiments/library/calibration/rough_drag_cal.py @@ -48,7 +48,7 @@ class RoughDragCal(BaseCalibrationExperiment, RoughDrag): from qiskit.circuit import Parameter from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library import RoughDragCal library = FixedFrequencyTransmon(default_values={"duration": 320, "amp": 0.03}) From 3740deedc05913d957936dde3d3022aa59490df2 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:37:15 +0900 Subject: [PATCH 047/113] update calibration/rough_frequency.py --- qiskit_experiments/library/calibration/rough_frequency.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/rough_frequency.py b/qiskit_experiments/library/calibration/rough_frequency.py index 535d289ef8..a3d88c0b5d 100644 --- a/qiskit_experiments/library/calibration/rough_frequency.py +++ b/qiskit_experiments/library/calibration/rough_frequency.py @@ -43,7 +43,7 @@ class RoughFrequencyCal(BaseCalibrationExperiment, QubitSpectroscopy): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library.calibration.rough_frequency import RoughFrequencyCal qubit=0 From c8d60a3b5af5ab832ab7b23d83d0bc8c2f842906 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:53:24 +0900 Subject: [PATCH 048/113] update calibration/half_angle_cal.py --- qiskit_experiments/library/calibration/half_angle_cal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/half_angle_cal.py b/qiskit_experiments/library/calibration/half_angle_cal.py index 696e0057f5..ff6dbd0652 100644 --- a/qiskit_experiments/library/calibration/half_angle_cal.py +++ b/qiskit_experiments/library/calibration/half_angle_cal.py @@ -42,7 +42,8 @@ class HalfAngleCal(BaseCalibrationExperiment, HalfAngle): from qiskit import pulse from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library + import FixedFrequencyTransmon from qiskit_experiments.library.calibration.half_angle_cal import HalfAngleCal library = FixedFrequencyTransmon(default_values={"duration": 640}) From 98a67a9ab4ccb0874888da30f812a52019241959 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:01:48 +0900 Subject: [PATCH 049/113] update calibration/half_angle_cal.py --- qiskit_experiments/library/calibration/half_angle_cal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/half_angle_cal.py b/qiskit_experiments/library/calibration/half_angle_cal.py index ff6dbd0652..610043dab6 100644 --- a/qiskit_experiments/library/calibration/half_angle_cal.py +++ b/qiskit_experiments/library/calibration/half_angle_cal.py @@ -43,7 +43,7 @@ class HalfAngleCal(BaseCalibrationExperiment, HalfAngle): from qiskit import pulse from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + import FixedFrequencyTransmon from qiskit_experiments.library.calibration.half_angle_cal import HalfAngleCal library = FixedFrequencyTransmon(default_values={"duration": 640}) From f70ceb1b6d2d5dd6a1dc90153c6e2b60469f3331 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:19:39 +0900 Subject: [PATCH 050/113] update driven_freq_tuning/ramsey_amp_scan.py --- .../driven_freq_tuning/ramsey_amp_scan.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/qiskit_experiments/library/driven_freq_tuning/ramsey_amp_scan.py b/qiskit_experiments/library/driven_freq_tuning/ramsey_amp_scan.py index e82d5d7910..cf3daf3eb4 100644 --- a/qiskit_experiments/library/driven_freq_tuning/ramsey_amp_scan.py +++ b/qiskit_experiments/library/driven_freq_tuning/ramsey_amp_scan.py @@ -93,6 +93,42 @@ class StarkRamseyXYAmpScan(BaseExperiment): # section: manual :doc:`/manuals/characterization/stark_experiment` + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=198) + + .. jupyter-execute:: + + import numpy as np + from qiskit import pulse + from qiskit.pulse.channels import PulseChannel, DriveChannel + from qiskit_experiments.library.driven_freq_tuning.p1_spect import StarkP1Spectroscopy + from qiskit_experiments.library.driven_freq_tuning import StarkRamseyXYAmpScan + + qubit = 0 + + exp = StarkRamseyXYAmpScan((qubit,), backend=backend) + exp.set_experiment_options( + stark_channel=pulse.ControlChannel(qubit), + stark_freq_offset=80e6, + stark_sigma=15e-9, + stark_risefall=2, + stark_length=50e-9, + min_stark_amp=-1.0, + max_stark_amp=1.0, + num_stark_amps=51, + stark_amps=None, + ) + + exp.set_run_options(shots=10000) + exp_data = exp.run().block_for_results() + result = exp_data.analysis_results() + print(result) + display(exp_data.figure(0)) """ @deprecate_func( From b541b8b6d6979c2e2e557ffb888cbf091c462cfe Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:46:39 +0900 Subject: [PATCH 051/113] update driven_freq_tuning/p1_spect.py --- .../library/driven_freq_tuning/p1_spect.py | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/qiskit_experiments/library/driven_freq_tuning/p1_spect.py b/qiskit_experiments/library/driven_freq_tuning/p1_spect.py index 7c81611419..d44c40d6f7 100644 --- a/qiskit_experiments/library/driven_freq_tuning/p1_spect.py +++ b/qiskit_experiments/library/driven_freq_tuning/p1_spect.py @@ -72,6 +72,80 @@ class StarkP1Spectroscopy(BaseExperiment): # section: manual :doc:`/manuals/characterization/stark_experiment` + # section: example + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=198) + + .. jupyter-execute:: + + import numpy as np + from qiskit import pulse + from qiskit.pulse.channels import PulseChannel, DriveChannel + from qiskit_experiments.library.driven_freq_tuning.p1_spect import StarkP1Spectroscopy + from qiskit_experiments.library.driven_freq_tuning import StarkRamseyXYAmpScan + + qubit = 0 + + exp = StarkRamseyXYAmpScan((qubit,), backend=backend) + exp.set_experiment_options( + stark_channel=pulse.ControlChannel(qubit), + stark_freq_offset=80e6, + stark_sigma=15e-9, + stark_risefall=2, + stark_length=50e-9, + min_stark_amp=-1.0, + max_stark_amp=1.0, + num_stark_amps=51, + stark_amps=None, + ) + + exp.set_run_options(shots=10000) + exp_data = exp.run().block_for_results() + result = exp_data.analysis_results() + print(result) + display(exp_data.figure(0)) + + ret_coeffs = exp_data.analysis_results("stark_coefficients").value + + # encode and decode the stark_coefficients + import json + from qiskit_experiments.framework import ExperimentEncoder + + with open("coefficients.json", "w") as fp: + json.dump(ret_coeffs, fp, cls=ExperimentEncoder) + + from qiskit_experiments.framework import ExperimentDecoder + + with open("coefficients.json", "r") as fp: + coefficients = json.load(fp, cls=ExperimentDecoder) + + # StarkP1Spectroscopy + exp = StarkP1Spectroscopy(physical_qubits=(qubit,), + backend=backend, + stark_channel=pulse.DriveChannel(qubit), + ) + exp.set_experiment_options( + t1_delay=20e-6, + min_xval=-20e6, + max_xval=20e6, + xval_type="frequency", + spacing="linear", + stark_coefficients=coefficients, + ) + + exp.set_run_options(shots=100) + display(exp.circuits()[0].draw("mpl")) + + exp_data = exp.run().block_for_results() + result=exp_data.analysis_results() + for _ in result: + print(_) + + display(exp_data.figure(0)) """ @deprecate_func( From 03b541b009eada68959e3c6f91b806206d43fcee Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:55:17 +0900 Subject: [PATCH 052/113] update driven_freq_tuning/p1_spect.py --- .../library/driven_freq_tuning/p1_spect.py | 146 +++++++++--------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/qiskit_experiments/library/driven_freq_tuning/p1_spect.py b/qiskit_experiments/library/driven_freq_tuning/p1_spect.py index d44c40d6f7..a456626b30 100644 --- a/qiskit_experiments/library/driven_freq_tuning/p1_spect.py +++ b/qiskit_experiments/library/driven_freq_tuning/p1_spect.py @@ -73,79 +73,79 @@ class StarkP1Spectroscopy(BaseExperiment): :doc:`/manuals/characterization/stark_experiment` # section: example - .. jupyter-execute:: - :hide-code: - - # backend - from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend - backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=198) - - .. jupyter-execute:: - - import numpy as np - from qiskit import pulse - from qiskit.pulse.channels import PulseChannel, DriveChannel - from qiskit_experiments.library.driven_freq_tuning.p1_spect import StarkP1Spectroscopy - from qiskit_experiments.library.driven_freq_tuning import StarkRamseyXYAmpScan - - qubit = 0 - - exp = StarkRamseyXYAmpScan((qubit,), backend=backend) - exp.set_experiment_options( - stark_channel=pulse.ControlChannel(qubit), - stark_freq_offset=80e6, - stark_sigma=15e-9, - stark_risefall=2, - stark_length=50e-9, - min_stark_amp=-1.0, - max_stark_amp=1.0, - num_stark_amps=51, - stark_amps=None, - ) - - exp.set_run_options(shots=10000) - exp_data = exp.run().block_for_results() - result = exp_data.analysis_results() - print(result) - display(exp_data.figure(0)) - - ret_coeffs = exp_data.analysis_results("stark_coefficients").value - - # encode and decode the stark_coefficients - import json - from qiskit_experiments.framework import ExperimentEncoder - - with open("coefficients.json", "w") as fp: - json.dump(ret_coeffs, fp, cls=ExperimentEncoder) - - from qiskit_experiments.framework import ExperimentDecoder - - with open("coefficients.json", "r") as fp: - coefficients = json.load(fp, cls=ExperimentDecoder) - - # StarkP1Spectroscopy - exp = StarkP1Spectroscopy(physical_qubits=(qubit,), - backend=backend, - stark_channel=pulse.DriveChannel(qubit), - ) - exp.set_experiment_options( - t1_delay=20e-6, - min_xval=-20e6, - max_xval=20e6, - xval_type="frequency", - spacing="linear", - stark_coefficients=coefficients, - ) - - exp.set_run_options(shots=100) - display(exp.circuits()[0].draw("mpl")) - - exp_data = exp.run().block_for_results() - result=exp_data.analysis_results() - for _ in result: - print(_) - - display(exp_data.figure(0)) + .. jupyter-execute:: + :hide-code: + + # backend + from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend + backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=198) + + .. jupyter-execute:: + + import numpy as np + from qiskit import pulse + from qiskit.pulse.channels import PulseChannel, DriveChannel + from qiskit_experiments.library.driven_freq_tuning.p1_spect import StarkP1Spectroscopy + from qiskit_experiments.library.driven_freq_tuning import StarkRamseyXYAmpScan + + qubit = 0 + + exp = StarkRamseyXYAmpScan((qubit,), backend=backend) + exp.set_experiment_options( + stark_channel=pulse.ControlChannel(qubit), + stark_freq_offset=80e6, + stark_sigma=15e-9, + stark_risefall=2, + stark_length=50e-9, + min_stark_amp=-1.0, + max_stark_amp=1.0, + num_stark_amps=51, + stark_amps=None, + ) + + exp.set_run_options(shots=10000) + exp_data = exp.run().block_for_results() + result = exp_data.analysis_results() + print(result) + display(exp_data.figure(0)) + + ret_coeffs = exp_data.analysis_results("stark_coefficients").value + + # encode and decode the stark_coefficients + import json + from qiskit_experiments.framework import ExperimentEncoder + + with open("coefficients.json", "w") as fp: + json.dump(ret_coeffs, fp, cls=ExperimentEncoder) + + from qiskit_experiments.framework import ExperimentDecoder + + with open("coefficients.json", "r") as fp: + coefficients = json.load(fp, cls=ExperimentDecoder) + + # StarkP1Spectroscopy + exp = StarkP1Spectroscopy(physical_qubits=(qubit,), + backend=backend, + stark_channel=pulse.DriveChannel(qubit), + ) + exp.set_experiment_options( + t1_delay=20e-6, + min_xval=-20e6, + max_xval=20e6, + xval_type="frequency", + spacing="linear", + stark_coefficients=coefficients, + ) + + exp.set_run_options(shots=100) + display(exp.circuits()[0].draw("mpl")) + + exp_data = exp.run().block_for_results() + result=exp_data.analysis_results() + for _ in result: + print(_) + + display(exp_data.figure(0)) """ @deprecate_func( From 36d010de789f540a16407dfc2fa70cff4dbe15ff Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:18:05 +0900 Subject: [PATCH 053/113] update calibration/rough_drag_cal.py --- qiskit_experiments/library/calibration/rough_drag_cal.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qiskit_experiments/library/calibration/rough_drag_cal.py b/qiskit_experiments/library/calibration/rough_drag_cal.py index cb7ec7bb1d..02b3a52a6a 100644 --- a/qiskit_experiments/library/calibration/rough_drag_cal.py +++ b/qiskit_experiments/library/calibration/rough_drag_cal.py @@ -29,9 +29,6 @@ class RoughDragCal(BaseCalibrationExperiment, RoughDrag): """A calibration version of the :class:`.RoughDrag` experiment. - # section: manual - :ref:`DRAG Calibration` - # section: example .. jupyter-execute:: :hide-code: @@ -59,6 +56,9 @@ class RoughDragCal(BaseCalibrationExperiment, RoughDrag): cal_data = exp_cal.run().block_for_results() display(cal_data.figure(0)) cal_data.analysis_results(dataframe=True) + + # section: manual + :ref:`DRAG Calibration` """ def __init__( From 43ad4170c2b334e270ee270b95b7d4ef3529f1ec Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:15:47 +0900 Subject: [PATCH 054/113] update releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml --- ...es-to-experiments-api-docs-31f3e3c3369a6f3d.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml diff --git a/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml b/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml new file mode 100644 index 0000000000..ee2cfdacbb --- /dev/null +++ b/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml @@ -0,0 +1,13 @@ +--- +other: + - | + Added minimal working code examples to experiments in API pages except + the following experiments which need two qubits gate operations with + a forth coming pulse test simulator, + CrossResonanceHamiltonian, EchoedCrossResonanceHamiltonian, FineZXAmplitude. + By default, the backend used in the code examples, are simulators such as + SingleTransmonTestBackend(), AerSimulator(FakePerth()). It is noted that, + because of the deprecation policy of the Qiskit Pulse in Qiskit 2.0, some + experiments which need pulse level programs are deprecated for the real + devices in the IBM Quantum platform. See also the Deprecation Notes in + the Release Notes 0.8.0. From c81f6a45e0e11cdf14728a17dbae6e57906d89cf Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sun, 3 Nov 2024 08:37:41 +0900 Subject: [PATCH 055/113] improved calibrations/fine_amplitude.py --- qiskit_experiments/library/calibration/fine_amplitude.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_amplitude.py b/qiskit_experiments/library/calibration/fine_amplitude.py index c38846ab48..9a85a5adff 100644 --- a/qiskit_experiments/library/calibration/fine_amplitude.py +++ b/qiskit_experiments/library/calibration/fine_amplitude.py @@ -67,8 +67,6 @@ class FineAmplitudeCal(BaseCalibrationExperiment, FineAmplitude): exp_cal.analysis.set_options(fixed_parameters={"angle_per_gate" : np.pi, "phase_offset" : np.pi/2}) - print(exp_cal.circuits()[5]) - cal_data = exp_cal.run().block_for_results() display(cal_data.figure(0)) cal_data.analysis_results(dataframe=True) @@ -283,10 +281,6 @@ class FineSXAmplitudeCal(FineAmplitudeCal): .. jupyter-execute:: - import numpy as np - import qiskit.pulse as pulse - from qiskit import schedule - from qiskit.circuit import Parameter from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon From 03777b6f05b3828c91ef0202adf01c1b3f95dd46 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sun, 3 Nov 2024 08:58:53 +0900 Subject: [PATCH 056/113] improved calibration/fine_drag_cal.py --- .../library/calibration/fine_drag_cal.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_drag_cal.py b/qiskit_experiments/library/calibration/fine_drag_cal.py index bf9fc04646..e5d36afa7a 100644 --- a/qiskit_experiments/library/calibration/fine_drag_cal.py +++ b/qiskit_experiments/library/calibration/fine_drag_cal.py @@ -42,7 +42,6 @@ class FineDragCal(BaseCalibrationExperiment, FineDrag): .. jupyter-execute:: - import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon @@ -190,8 +189,6 @@ class FineXDragCal(FineDragCal): .. jupyter-execute:: - import numpy as np - import pandas as pd from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon @@ -207,12 +204,6 @@ class FineXDragCal(FineDragCal): auto_update=True, ) - cal_data = exp_cal.run().block_for_results() - display(cal_data.figure(0)) - display(cal_data.analysis_results(dataframe=True)) - - pd.DataFrame(**cals.parameters_table(qubit_list=[0])) - cal_data = exp_cal.run().block_for_results() display(cal_data.figure(0)) cal_data.analysis_results(dataframe=True) @@ -260,7 +251,6 @@ class FineSXDragCal(FineDragCal): .. jupyter-execute:: - import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon From 2d1b414488bd3bc121276deccb77a69d035a506e Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sun, 3 Nov 2024 09:27:14 +0900 Subject: [PATCH 057/113] improved EFRoughXSXAmplitudeCal --- .../library/calibration/rough_amplitude_cal.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/qiskit_experiments/library/calibration/rough_amplitude_cal.py b/qiskit_experiments/library/calibration/rough_amplitude_cal.py index 4cba5c7537..ab0c841b25 100644 --- a/qiskit_experiments/library/calibration/rough_amplitude_cal.py +++ b/qiskit_experiments/library/calibration/rough_amplitude_cal.py @@ -295,7 +295,6 @@ class EFRoughXSXAmplitudeCal(RoughAmplitudeCal): .. jupyter-execute:: import numpy as np - import pandas as pd import qiskit.pulse as pulse from qiskit.compiler import schedule from qiskit.circuit import Parameter @@ -340,19 +339,12 @@ class EFRoughXSXAmplitudeCal(RoughAmplitudeCal): for sched in ["sx", "sx12"]: cals.add_parameter_value(0.25, "amp", (0,), schedule=sched) - columns_to_show = ["parameter", "qubits", "schedule", "value", "date_time"] - pd.DataFrame(**cals.parameters_table(qubit_list=[0, ()]))[columns_to_show] - exp_cal = EFRoughXSXAmplitudeCal(physical_qubits=(0,), calibrations=cals, amplitudes=np.linspace(-0.1, 0.1, 51), backend=backend, ef_pulse_label="12",) - print(exp_cal.calibrations) - print(exp_cal.circuits()[0]) - print(exp_cal.circuits()[0].calibrations) - cal_data = exp_cal.run().block_for_results() display(cal_data.figure(0)) cal_data.analysis_results(dataframe=True) From 92b7005011a370cc4589376c3b7dc848a2393a29 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:24:37 +0900 Subject: [PATCH 058/113] imploved rough_amplitude_cal.py --- qiskit_experiments/library/calibration/rough_amplitude_cal.py | 1 - 1 file changed, 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/rough_amplitude_cal.py b/qiskit_experiments/library/calibration/rough_amplitude_cal.py index ab0c841b25..1239b59287 100644 --- a/qiskit_experiments/library/calibration/rough_amplitude_cal.py +++ b/qiskit_experiments/library/calibration/rough_amplitude_cal.py @@ -296,7 +296,6 @@ class EFRoughXSXAmplitudeCal(RoughAmplitudeCal): import numpy as np import qiskit.pulse as pulse - from qiskit.compiler import schedule from qiskit.circuit import Parameter from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library From cd19f34611012d004c83864f6b9103ab06a03c65 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:40:15 +0900 Subject: [PATCH 059/113] improved RoughDragCal --- qiskit_experiments/library/calibration/rough_drag_cal.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/qiskit_experiments/library/calibration/rough_drag_cal.py b/qiskit_experiments/library/calibration/rough_drag_cal.py index 02b3a52a6a..6d83082e88 100644 --- a/qiskit_experiments/library/calibration/rough_drag_cal.py +++ b/qiskit_experiments/library/calibration/rough_drag_cal.py @@ -40,9 +40,6 @@ class RoughDragCal(BaseCalibrationExperiment, RoughDrag): .. jupyter-execute:: import numpy as np - import qiskit.pulse as pulse - from qiskit import schedule - from qiskit.circuit import Parameter from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon From 1e3180a3240090ce3f37d98f68f2c6186cbdbdbb Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:54:25 +0900 Subject: [PATCH 060/113] improved StarkRamseyXYAmpScan --- .../library/driven_freq_tuning/ramsey_amp_scan.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/qiskit_experiments/library/driven_freq_tuning/ramsey_amp_scan.py b/qiskit_experiments/library/driven_freq_tuning/ramsey_amp_scan.py index cf3daf3eb4..c2c6ec9164 100644 --- a/qiskit_experiments/library/driven_freq_tuning/ramsey_amp_scan.py +++ b/qiskit_experiments/library/driven_freq_tuning/ramsey_amp_scan.py @@ -103,10 +103,7 @@ class StarkRamseyXYAmpScan(BaseExperiment): .. jupyter-execute:: - import numpy as np from qiskit import pulse - from qiskit.pulse.channels import PulseChannel, DriveChannel - from qiskit_experiments.library.driven_freq_tuning.p1_spect import StarkP1Spectroscopy from qiskit_experiments.library.driven_freq_tuning import StarkRamseyXYAmpScan qubit = 0 @@ -127,7 +124,6 @@ class StarkRamseyXYAmpScan(BaseExperiment): exp.set_run_options(shots=10000) exp_data = exp.run().block_for_results() result = exp_data.analysis_results() - print(result) display(exp_data.figure(0)) """ From f78a31d2473eef8d8870a38cb2892338e976666a Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 5 Nov 2024 16:30:33 +0900 Subject: [PATCH 061/113] improved QuantumVolume --- qiskit_experiments/library/quantum_volume/qv_experiment.py | 1 - 1 file changed, 1 deletion(-) diff --git a/qiskit_experiments/library/quantum_volume/qv_experiment.py b/qiskit_experiments/library/quantum_volume/qv_experiment.py index 694ad2fe03..f616d0d924 100644 --- a/qiskit_experiments/library/quantum_volume/qv_experiment.py +++ b/qiskit_experiments/library/quantum_volume/qv_experiment.py @@ -86,7 +86,6 @@ class QuantumVolume(BaseExperiment): qv_exp.set_run_options(shots=1000) expdata = qv_exp.run(backend).block_for_results() - display(expdata.figure(0)) for result in expdata.analysis_results(): From c43c83585e4e9ce4d44845fd489e85166a8d9e54 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 7 Nov 2024 06:06:13 +0900 Subject: [PATCH 062/113] improved RoughEFFrequencyCal --- qiskit_experiments/library/calibration/rough_frequency.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/qiskit_experiments/library/calibration/rough_frequency.py b/qiskit_experiments/library/calibration/rough_frequency.py index a3d88c0b5d..dcfd6b2fd2 100644 --- a/qiskit_experiments/library/calibration/rough_frequency.py +++ b/qiskit_experiments/library/calibration/rough_frequency.py @@ -109,10 +109,6 @@ class RoughEFFrequencyCal(BaseCalibrationExperiment, EFSpectroscopy): r"""A calibration experiment that runs :class:`.QubitSpectroscopy` for the :math:`|1\rangle` <-> :math:`|2\rangle` transition. - - - - """ __updater__ = Frequency From fa360addd7e39f755d87d61ba2b1c916b3fcc393 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 7 Nov 2024 06:07:35 +0900 Subject: [PATCH 063/113] improved LayerFidelity --- .../library/randomized_benchmarking/layer_fidelity.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py b/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py index e2da4b56e9..0cd2e6a1b1 100644 --- a/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py +++ b/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py @@ -86,8 +86,6 @@ class LayerFidelity(BaseExperiment, RestlessMixin): from qiskit_ibm_runtime.fake_provider import FakePerth backend = AerSimulator.from_backend(FakePerth()) - print(backend.coupling_map) - .. jupyter-execute:: import numpy as np From 54e024afbc063b4e4d0f85c8532a155d4cacf25f Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 7 Nov 2024 06:08:42 +0900 Subject: [PATCH 064/113] improved StandardRB --- .../library/randomized_benchmarking/standard_rb.py | 1 - 1 file changed, 1 deletion(-) diff --git a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py index 6a6855bafe..ed217b0e19 100644 --- a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py +++ b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py @@ -94,7 +94,6 @@ class StandardRB(BaseExperiment, RestlessMixin): from qiskit_ibm_runtime.fake_provider import FakePerth backend = AerSimulator.from_backend(FakePerth()) - print(backend.coupling_map) .. jupyter-execute:: From aa141fdbbdfaee1d7211671f61a2ac7d4150d36b Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 7 Nov 2024 09:38:43 +0900 Subject: [PATCH 065/113] updated releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml --- ...experiments-api-docs-31f3e3c3369a6f3d.yaml | 39 ++++++++++++++----- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml b/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml index ee2cfdacbb..912f262473 100644 --- a/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml +++ b/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml @@ -1,13 +1,32 @@ --- other: - | - Added minimal working code examples to experiments in API pages except - the following experiments which need two qubits gate operations with - a forth coming pulse test simulator, - CrossResonanceHamiltonian, EchoedCrossResonanceHamiltonian, FineZXAmplitude. - By default, the backend used in the code examples, are simulators such as - SingleTransmonTestBackend(), AerSimulator(FakePerth()). It is noted that, - because of the deprecation policy of the Qiskit Pulse in Qiskit 2.0, some - experiments which need pulse level programs are deprecated for the real - devices in the IBM Quantum platform. See also the Deprecation Notes in - the Release Notes 0.8.0. + Added minimal working code examples to the API pages for Experiments, + EFSpectroscopy, + EFRabi, + StarkRamseyXYAmpScan, + FineAmplitudeCal, + FineXAmplitudeCal, + FineSXAmplitudeCal, + FineDragCal, + FineXDragCal, + FineSXDragCal, + FineFrequencyCal, + FrequencyCal, + HalfAngleCal, + RoughAmplitudeCal, + RoughXSXAmplitudeCal, + EFRoughXSXAmplitudeCal, + RoughDragCal, + RoughFrequencyCal, + QuantumVolume, + InterleavedRB, + LayerFidelity, + StandardRB, + MitigatedProcessTomography, + MitigatedStateTomography, + ProcessTomography and + StateTomography. + By default, the backend used in the code examples, are simulators + such as, SingleTransmonTestBackend() and + AerSimulator(FakePerth()). From 6b5f64b208658d4c0b0878d5a32d0fac6db2c6dd Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 7 Nov 2024 10:55:57 +0900 Subject: [PATCH 066/113] improved StarkP1Spectroscopy --- .../library/driven_freq_tuning/p1_spect.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/qiskit_experiments/library/driven_freq_tuning/p1_spect.py b/qiskit_experiments/library/driven_freq_tuning/p1_spect.py index a456626b30..3d49571097 100644 --- a/qiskit_experiments/library/driven_freq_tuning/p1_spect.py +++ b/qiskit_experiments/library/driven_freq_tuning/p1_spect.py @@ -82,14 +82,11 @@ class StarkP1Spectroscopy(BaseExperiment): .. jupyter-execute:: - import numpy as np from qiskit import pulse - from qiskit.pulse.channels import PulseChannel, DriveChannel from qiskit_experiments.library.driven_freq_tuning.p1_spect import StarkP1Spectroscopy from qiskit_experiments.library.driven_freq_tuning import StarkRamseyXYAmpScan qubit = 0 - exp = StarkRamseyXYAmpScan((qubit,), backend=backend) exp.set_experiment_options( stark_channel=pulse.ControlChannel(qubit), @@ -105,10 +102,6 @@ class StarkP1Spectroscopy(BaseExperiment): exp.set_run_options(shots=10000) exp_data = exp.run().block_for_results() - result = exp_data.analysis_results() - print(result) - display(exp_data.figure(0)) - ret_coeffs = exp_data.analysis_results("stark_coefficients").value # encode and decode the stark_coefficients @@ -136,15 +129,9 @@ class StarkP1Spectroscopy(BaseExperiment): spacing="linear", stark_coefficients=coefficients, ) - exp.set_run_options(shots=100) - display(exp.circuits()[0].draw("mpl")) exp_data = exp.run().block_for_results() - result=exp_data.analysis_results() - for _ in result: - print(_) - display(exp_data.figure(0)) """ From 95e8d3f2cb096cf973009069f290b79945b71586 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 7 Nov 2024 10:59:20 +0900 Subject: [PATCH 067/113] releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml --- .../add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml b/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml index 912f262473..bccb5a26a2 100644 --- a/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml +++ b/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml @@ -5,6 +5,7 @@ other: EFSpectroscopy, EFRabi, StarkRamseyXYAmpScan, + StarkP1Spectroscopy, FineAmplitudeCal, FineXAmplitudeCal, FineSXAmplitudeCal, From b7ffa899b512feb215e13f4cb1193cbf751f4cc0 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:59:57 +0900 Subject: [PATCH 068/113] update calibration/fine_amplitude.py --- qiskit_experiments/library/calibration/fine_amplitude.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_amplitude.py b/qiskit_experiments/library/calibration/fine_amplitude.py index 9a85a5adff..596336dfae 100644 --- a/qiskit_experiments/library/calibration/fine_amplitude.py +++ b/qiskit_experiments/library/calibration/fine_amplitude.py @@ -49,7 +49,7 @@ class FineAmplitudeCal(BaseCalibrationExperiment, FineAmplitude): import numpy as np from qiskit.circuit.library import XGate from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library + from qiskit_experiments.calibration_management.basis_gate_library \ import FixedFrequencyTransmon from qiskit_experiments.library import FineAmplitudeCal @@ -203,7 +203,7 @@ class FineXAmplitudeCal(FineAmplitudeCal): .. jupyter-execute:: from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library + from qiskit_experiments.calibration_management.basis_gate_library \ import FixedFrequencyTransmon from qiskit_experiments.library import FineXAmplitudeCal @@ -282,7 +282,7 @@ class FineSXAmplitudeCal(FineAmplitudeCal): .. jupyter-execute:: from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library + from qiskit_experiments.calibration_management.basis_gate_library \ import FixedFrequencyTransmon from qiskit_experiments.library import FineSXAmplitudeCal From 08757882aead742455f3978369f8b5eb951015a5 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:00:55 +0900 Subject: [PATCH 069/113] update calibration/fine_drag_cal.py --- qiskit_experiments/library/calibration/fine_drag_cal.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_drag_cal.py b/qiskit_experiments/library/calibration/fine_drag_cal.py index e5d36afa7a..40910522b0 100644 --- a/qiskit_experiments/library/calibration/fine_drag_cal.py +++ b/qiskit_experiments/library/calibration/fine_drag_cal.py @@ -43,7 +43,7 @@ class FineDragCal(BaseCalibrationExperiment, FineDrag): .. jupyter-execute:: from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library + from qiskit_experiments.calibration_management.basis_gate_library \ import FixedFrequencyTransmon from qiskit_experiments.library import FineDragCal @@ -190,7 +190,7 @@ class FineXDragCal(FineDragCal): .. jupyter-execute:: from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library + from qiskit_experiments.calibration_management.basis_gate_library \ import FixedFrequencyTransmon from qiskit_experiments.library import FineXDragCal @@ -252,7 +252,7 @@ class FineSXDragCal(FineDragCal): .. jupyter-execute:: from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library + from qiskit_experiments.calibration_management.basis_gate_library \ import FixedFrequencyTransmon from qiskit_experiments.library import FineSXDragCal From 1c4f1b3c6758a1987efc611cdf17160a017eb566 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:01:52 +0900 Subject: [PATCH 070/113] update calibration/fine_frequency_cal.py --- qiskit_experiments/library/calibration/fine_frequency_cal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/fine_frequency_cal.py b/qiskit_experiments/library/calibration/fine_frequency_cal.py index 1d7fa79189..40d60ffba1 100644 --- a/qiskit_experiments/library/calibration/fine_frequency_cal.py +++ b/qiskit_experiments/library/calibration/fine_frequency_cal.py @@ -43,7 +43,7 @@ class FineFrequencyCal(BaseCalibrationExperiment, FineFrequency): .. jupyter-execute:: from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library + from qiskit_experiments.calibration_management.basis_gate_library \ import FixedFrequencyTransmon from qiskit_experiments.library.calibration.fine_frequency_cal import FineFrequencyCal From b71d5213ec6268fc74e25d0274f26cdd1583cb77 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:02:44 +0900 Subject: [PATCH 071/113] update calibration/frequency_cal.py --- qiskit_experiments/library/calibration/frequency_cal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/frequency_cal.py b/qiskit_experiments/library/calibration/frequency_cal.py index 30e11cede2..ef4d6e6c87 100644 --- a/qiskit_experiments/library/calibration/frequency_cal.py +++ b/qiskit_experiments/library/calibration/frequency_cal.py @@ -42,7 +42,7 @@ class FrequencyCal(BaseCalibrationExperiment, RamseyXY): .. jupyter-execute:: from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library + from qiskit_experiments.calibration_management.basis_gate_library \ import FixedFrequencyTransmon from qiskit_experiments.library.calibration.frequency_cal import FrequencyCal From 261c89cc1d9a9467c94b2248cba6adf723451491 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:03:30 +0900 Subject: [PATCH 072/113] update calibration/half_angle_cal.py --- qiskit_experiments/library/calibration/half_angle_cal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/half_angle_cal.py b/qiskit_experiments/library/calibration/half_angle_cal.py index 610043dab6..26075994c4 100644 --- a/qiskit_experiments/library/calibration/half_angle_cal.py +++ b/qiskit_experiments/library/calibration/half_angle_cal.py @@ -42,7 +42,7 @@ class HalfAngleCal(BaseCalibrationExperiment, HalfAngle): from qiskit import pulse from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library + from qiskit_experiments.calibration_management.basis_gate_library \ import FixedFrequencyTransmon from qiskit_experiments.library.calibration.half_angle_cal import HalfAngleCal From 1ef6637a7925ad0379749c959bf0140ed2219a6d Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:04:19 +0900 Subject: [PATCH 073/113] update calibration/rough_amplitude_cal.py --- .../library/calibration/rough_amplitude_cal.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qiskit_experiments/library/calibration/rough_amplitude_cal.py b/qiskit_experiments/library/calibration/rough_amplitude_cal.py index 1239b59287..43083666f4 100644 --- a/qiskit_experiments/library/calibration/rough_amplitude_cal.py +++ b/qiskit_experiments/library/calibration/rough_amplitude_cal.py @@ -45,7 +45,7 @@ class RoughAmplitudeCal(BaseCalibrationExperiment, Rabi): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library + from qiskit_experiments.calibration_management.basis_gate_library \ import FixedFrequencyTransmon from qiskit_experiments.library.calibration import RoughAmplitudeCal @@ -237,7 +237,7 @@ class RoughXSXAmplitudeCal(RoughAmplitudeCal): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library + from qiskit_experiments.calibration_management.basis_gate_library \ import FixedFrequencyTransmon from qiskit_experiments.library.calibration import RoughXSXAmplitudeCal @@ -298,8 +298,8 @@ class EFRoughXSXAmplitudeCal(RoughAmplitudeCal): import qiskit.pulse as pulse from qiskit.circuit import Parameter from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library - import FixedFrequencyTransmon + from qiskit_experiments.calibration_management.basis_gate_library \ + import FixedFrequencyTransmon from qiskit_experiments.library.calibration import EFRoughXSXAmplitudeCal library = FixedFrequencyTransmon() From dd820ae7b5818a4785b428957b5f46121988ccee Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:05:05 +0900 Subject: [PATCH 074/113] update calibration/rough_drag_cal.py --- qiskit_experiments/library/calibration/rough_drag_cal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/rough_drag_cal.py b/qiskit_experiments/library/calibration/rough_drag_cal.py index 6d83082e88..623e521ee8 100644 --- a/qiskit_experiments/library/calibration/rough_drag_cal.py +++ b/qiskit_experiments/library/calibration/rough_drag_cal.py @@ -41,7 +41,7 @@ class RoughDragCal(BaseCalibrationExperiment, RoughDrag): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library + from qiskit_experiments.calibration_management.basis_gate_library \ import FixedFrequencyTransmon from qiskit_experiments.library import RoughDragCal From 8b8f9a09239789991a61fbc51f7c83f233658bbc Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:05:57 +0900 Subject: [PATCH 075/113] update calibration/rough_frequency.py --- qiskit_experiments/library/calibration/rough_frequency.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/rough_frequency.py b/qiskit_experiments/library/calibration/rough_frequency.py index dcfd6b2fd2..efb95f8da1 100644 --- a/qiskit_experiments/library/calibration/rough_frequency.py +++ b/qiskit_experiments/library/calibration/rough_frequency.py @@ -42,7 +42,7 @@ class RoughFrequencyCal(BaseCalibrationExperiment, QubitSpectroscopy): import numpy as np from qiskit_experiments.calibration_management.calibrations import Calibrations - from qiskit_experiments.calibration_management.basis_gate_library + from qiskit_experiments.calibration_management.basis_gate_library \ import FixedFrequencyTransmon from qiskit_experiments.library.calibration.rough_frequency import RoughFrequencyCal From e0673aabaa2fec4cfa68dbad744ab60e8f44f580 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:12:23 +0900 Subject: [PATCH 076/113] removed: a code exapmle for StarkP1Spectroscopy --- .../library/driven_freq_tuning/p1_spect.py | 62 ------------------- 1 file changed, 62 deletions(-) diff --git a/qiskit_experiments/library/driven_freq_tuning/p1_spect.py b/qiskit_experiments/library/driven_freq_tuning/p1_spect.py index 3d49571097..5a2e867e54 100644 --- a/qiskit_experiments/library/driven_freq_tuning/p1_spect.py +++ b/qiskit_experiments/library/driven_freq_tuning/p1_spect.py @@ -71,68 +71,6 @@ class StarkP1Spectroscopy(BaseExperiment): # section: manual :doc:`/manuals/characterization/stark_experiment` - - # section: example - .. jupyter-execute:: - :hide-code: - - # backend - from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend - backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=198) - - .. jupyter-execute:: - - from qiskit import pulse - from qiskit_experiments.library.driven_freq_tuning.p1_spect import StarkP1Spectroscopy - from qiskit_experiments.library.driven_freq_tuning import StarkRamseyXYAmpScan - - qubit = 0 - exp = StarkRamseyXYAmpScan((qubit,), backend=backend) - exp.set_experiment_options( - stark_channel=pulse.ControlChannel(qubit), - stark_freq_offset=80e6, - stark_sigma=15e-9, - stark_risefall=2, - stark_length=50e-9, - min_stark_amp=-1.0, - max_stark_amp=1.0, - num_stark_amps=51, - stark_amps=None, - ) - - exp.set_run_options(shots=10000) - exp_data = exp.run().block_for_results() - ret_coeffs = exp_data.analysis_results("stark_coefficients").value - - # encode and decode the stark_coefficients - import json - from qiskit_experiments.framework import ExperimentEncoder - - with open("coefficients.json", "w") as fp: - json.dump(ret_coeffs, fp, cls=ExperimentEncoder) - - from qiskit_experiments.framework import ExperimentDecoder - - with open("coefficients.json", "r") as fp: - coefficients = json.load(fp, cls=ExperimentDecoder) - - # StarkP1Spectroscopy - exp = StarkP1Spectroscopy(physical_qubits=(qubit,), - backend=backend, - stark_channel=pulse.DriveChannel(qubit), - ) - exp.set_experiment_options( - t1_delay=20e-6, - min_xval=-20e6, - max_xval=20e6, - xval_type="frequency", - spacing="linear", - stark_coefficients=coefficients, - ) - exp.set_run_options(shots=100) - - exp_data = exp.run().block_for_results() - display(exp_data.figure(0)) """ @deprecate_func( From 75ae3c25f99667af1c007a8bfd240ba3b0649434 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:16:31 +0900 Subject: [PATCH 077/113] update EFRabi --- qiskit_experiments/library/characterization/rabi.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/qiskit_experiments/library/characterization/rabi.py b/qiskit_experiments/library/characterization/rabi.py index 0f427047de..2c547ba7fa 100644 --- a/qiskit_experiments/library/characterization/rabi.py +++ b/qiskit_experiments/library/characterization/rabi.py @@ -286,8 +286,6 @@ class EFRabi(Rabi): amplitudes=np.linspace(-0.1, 0.1, 21), backend=backend,) - display(exp.circuits()[1].draw()) - exp_data = exp.run().block_for_results() display(exp_data.figure(0)) exp_data.analysis_results(dataframe=True) From f754951e07a02dfa98047e6aefbeff77d70bc0d8 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:21:53 +0900 Subject: [PATCH 078/113] update releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml --- ...d-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml b/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml index bccb5a26a2..9bb50de162 100644 --- a/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml +++ b/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml @@ -5,7 +5,6 @@ other: EFSpectroscopy, EFRabi, StarkRamseyXYAmpScan, - StarkP1Spectroscopy, FineAmplitudeCal, FineXAmplitudeCal, FineSXAmplitudeCal, @@ -26,8 +25,9 @@ other: StandardRB, MitigatedProcessTomography, MitigatedStateTomography, - ProcessTomography and - StateTomography. + ProcessTomography, + StateTomography and + TomographyExperiment. By default, the backend used in the code examples, are simulators such as, SingleTransmonTestBackend() and AerSimulator(FakePerth()). From 3f24c15ebaefc5929fe9a69543376a92d1ee9770 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 21 Nov 2024 09:01:59 +0900 Subject: [PATCH 079/113] removed: an example of StarkRamseyXYAmpScan in private-v3.2 (PR draft #1494) --- .../driven_freq_tuning/ramsey_amp_scan.py | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/qiskit_experiments/library/driven_freq_tuning/ramsey_amp_scan.py b/qiskit_experiments/library/driven_freq_tuning/ramsey_amp_scan.py index c2c6ec9164..494718e08d 100644 --- a/qiskit_experiments/library/driven_freq_tuning/ramsey_amp_scan.py +++ b/qiskit_experiments/library/driven_freq_tuning/ramsey_amp_scan.py @@ -92,39 +92,6 @@ class StarkRamseyXYAmpScan(BaseExperiment): # section: manual :doc:`/manuals/characterization/stark_experiment` - - # section: example - .. jupyter-execute:: - :hide-code: - - # backend - from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend - backend = SingleTransmonTestBackend(5.2e9,-.25e9, 1e9, 0.8e9, 1e4, noise=False, seed=198) - - .. jupyter-execute:: - - from qiskit import pulse - from qiskit_experiments.library.driven_freq_tuning import StarkRamseyXYAmpScan - - qubit = 0 - - exp = StarkRamseyXYAmpScan((qubit,), backend=backend) - exp.set_experiment_options( - stark_channel=pulse.ControlChannel(qubit), - stark_freq_offset=80e6, - stark_sigma=15e-9, - stark_risefall=2, - stark_length=50e-9, - min_stark_amp=-1.0, - max_stark_amp=1.0, - num_stark_amps=51, - stark_amps=None, - ) - - exp.set_run_options(shots=10000) - exp_data = exp.run().block_for_results() - result = exp_data.analysis_results() - display(exp_data.figure(0)) """ @deprecate_func( From 4361bf91efd55bdcbbbb40181dbff6c936018fc3 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 21 Nov 2024 09:47:24 +0900 Subject: [PATCH 080/113] update releasenotes: removed StarkRamseyXYAmpScan --- .../add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml b/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml index 9bb50de162..627967e5f6 100644 --- a/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml +++ b/releasenotes/notes/add-examples-to-experiments-api-docs-31f3e3c3369a6f3d.yaml @@ -4,7 +4,6 @@ other: Added minimal working code examples to the API pages for Experiments, EFSpectroscopy, EFRabi, - StarkRamseyXYAmpScan, FineAmplitudeCal, FineXAmplitudeCal, FineSXAmplitudeCal, From bc28a49c89a79d8eb204f1d827202cd921698f7f Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:16:04 +0900 Subject: [PATCH 081/113] update FineAmplitude-type experiment --- qiskit_experiments/library/calibration/fine_amplitude.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_amplitude.py b/qiskit_experiments/library/calibration/fine_amplitude.py index 596336dfae..80a148f460 100644 --- a/qiskit_experiments/library/calibration/fine_amplitude.py +++ b/qiskit_experiments/library/calibration/fine_amplitude.py @@ -190,7 +190,7 @@ def update_calibrations(self, experiment_data: ExperimentData): class FineXAmplitudeCal(FineAmplitudeCal): - r"""A calibration experiment to calibrate the amplitude of the X schedule. + """A calibration experiment to calibrate the amplitude of the X schedule. # section: example .. jupyter-execute:: @@ -269,7 +269,7 @@ def _pre_circuit(self, num_clbits: int) -> QuantumCircuit: class FineSXAmplitudeCal(FineAmplitudeCal): - r"""A calibration experiment to calibrate the amplitude of the SX schedule. + """A calibration experiment to calibrate the amplitude of the SX schedule. # section: example .. jupyter-execute:: From 049006974a6435693c03caf4e89dcf270a9376f4 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:17:30 +0900 Subject: [PATCH 082/113] update FineDrag-type experiments --- qiskit_experiments/library/calibration/fine_drag_cal.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qiskit_experiments/library/calibration/fine_drag_cal.py b/qiskit_experiments/library/calibration/fine_drag_cal.py index 40910522b0..b2aaffacb4 100644 --- a/qiskit_experiments/library/calibration/fine_drag_cal.py +++ b/qiskit_experiments/library/calibration/fine_drag_cal.py @@ -30,7 +30,7 @@ class FineDragCal(BaseCalibrationExperiment, FineDrag): - r"""A calibration version of the fine DRAG experiment. + """A calibration version of the fine DRAG experiment. # section: example .. jupyter-execute:: @@ -177,7 +177,7 @@ def update_calibrations(self, experiment_data: ExperimentData): class FineXDragCal(FineDragCal): - r"""Fine DRAG calibration of X gate. + """Fine DRAG calibration of X gate. # section: example .. jupyter-execute:: @@ -239,7 +239,7 @@ def __init__( class FineSXDragCal(FineDragCal): - r"""Fine DRAG calibration of X gate. + """Fine DRAG calibration of X gate. # section: example .. jupyter-execute:: From db09f36cc44262307a86acebb752d045a799ff5c Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:19:18 +0900 Subject: [PATCH 083/113] update FineFrequencyCal-type experiments --- qiskit_experiments/library/calibration/fine_frequency_cal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/fine_frequency_cal.py b/qiskit_experiments/library/calibration/fine_frequency_cal.py index 40d60ffba1..e5f456d765 100644 --- a/qiskit_experiments/library/calibration/fine_frequency_cal.py +++ b/qiskit_experiments/library/calibration/fine_frequency_cal.py @@ -28,7 +28,7 @@ class FineFrequencyCal(BaseCalibrationExperiment, FineFrequency): - r"""A calibration version of the fine frequency experiment. + """A calibration version of the fine frequency experiment. # section: example .. jupyter-execute:: From e86a4eecc80e35f6c07e1484a8e7e9109a6bb1ae Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:20:46 +0900 Subject: [PATCH 084/113] update FrequencyCal-type experiments --- qiskit_experiments/library/calibration/frequency_cal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/frequency_cal.py b/qiskit_experiments/library/calibration/frequency_cal.py index ef4d6e6c87..c52122d555 100644 --- a/qiskit_experiments/library/calibration/frequency_cal.py +++ b/qiskit_experiments/library/calibration/frequency_cal.py @@ -27,7 +27,7 @@ class FrequencyCal(BaseCalibrationExperiment, RamseyXY): - r"""A qubit frequency calibration experiment based on the Ramsey XY experiment. + """A qubit frequency calibration experiment based on the Ramsey XY experiment. # section: example .. jupyter-execute:: From 4bc9f8285cbb4bf979324221e0386ab54f1db840 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:21:58 +0900 Subject: [PATCH 085/113] update HalfAngleCal experiment --- qiskit_experiments/library/calibration/half_angle_cal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/half_angle_cal.py b/qiskit_experiments/library/calibration/half_angle_cal.py index 26075994c4..fb31958d75 100644 --- a/qiskit_experiments/library/calibration/half_angle_cal.py +++ b/qiskit_experiments/library/calibration/half_angle_cal.py @@ -28,7 +28,7 @@ class HalfAngleCal(BaseCalibrationExperiment, HalfAngle): - r"""Calibration version of the :class:`.HalfAngle` experiment. + """Calibration version of the :class:`.HalfAngle` experiment. # section: example .. jupyter-execute:: From 8750882d80d386e2ea962ade1743c27d1099d417 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:23:20 +0900 Subject: [PATCH 086/113] update RoughAmplitudeCal-type experiments --- qiskit_experiments/library/calibration/rough_amplitude_cal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qiskit_experiments/library/calibration/rough_amplitude_cal.py b/qiskit_experiments/library/calibration/rough_amplitude_cal.py index 43083666f4..0db0a71bc6 100644 --- a/qiskit_experiments/library/calibration/rough_amplitude_cal.py +++ b/qiskit_experiments/library/calibration/rough_amplitude_cal.py @@ -31,7 +31,7 @@ class RoughAmplitudeCal(BaseCalibrationExperiment, Rabi): - r"""A calibration version of the Rabi experiment. + """A calibration version of the Rabi experiment. # section: example .. jupyter-execute:: @@ -223,7 +223,7 @@ def update_calibrations(self, experiment_data: ExperimentData): class RoughXSXAmplitudeCal(RoughAmplitudeCal): - r"""A rough amplitude calibration of x and sx gates. + """A rough amplitude calibration of x and sx gates. # section: example .. jupyter-execute:: From 5846e516570242d3a2c57c1495abba364cae51bd Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:24:32 +0900 Subject: [PATCH 087/113] update RoughFrequencyCal experiment --- qiskit_experiments/library/calibration/rough_frequency.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/rough_frequency.py b/qiskit_experiments/library/calibration/rough_frequency.py index efb95f8da1..04b84b698a 100644 --- a/qiskit_experiments/library/calibration/rough_frequency.py +++ b/qiskit_experiments/library/calibration/rough_frequency.py @@ -27,7 +27,7 @@ class RoughFrequencyCal(BaseCalibrationExperiment, QubitSpectroscopy): - r"""A calibration experiment that runs :class:`.QubitSpectroscopy` to calibrate the qubit + """A calibration experiment that runs :class:`.QubitSpectroscopy` to calibrate the qubit transition frequency. # section: example From b30b14f64cd575c279d12f6eb845e826e4f2578e Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:26:00 +0900 Subject: [PATCH 088/113] update EFSpectroscopy --- qiskit_experiments/library/characterization/ef_spectroscopy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/characterization/ef_spectroscopy.py b/qiskit_experiments/library/characterization/ef_spectroscopy.py index 51107e47cb..400927a0d5 100644 --- a/qiskit_experiments/library/characterization/ef_spectroscopy.py +++ b/qiskit_experiments/library/characterization/ef_spectroscopy.py @@ -22,7 +22,7 @@ class EFSpectroscopy(QubitSpectroscopy): - r"""A spectroscopy experiment to obtain a frequency sweep of the qubit's e-f transition. + """A spectroscopy experiment to obtain a frequency sweep of the qubit's e-f transition. # section: overview The circuits produced by spectroscopy, i.e. From b310d0b5cc7fdd7a199ba8ce539f323ce442deb1 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:27:08 +0900 Subject: [PATCH 089/113] update QuantumVolume --- qiskit_experiments/library/quantum_volume/qv_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/quantum_volume/qv_experiment.py b/qiskit_experiments/library/quantum_volume/qv_experiment.py index f616d0d924..614db16510 100644 --- a/qiskit_experiments/library/quantum_volume/qv_experiment.py +++ b/qiskit_experiments/library/quantum_volume/qv_experiment.py @@ -28,7 +28,7 @@ class QuantumVolume(BaseExperiment): - r"""An experiment to measure the largest random square circuit that can be run on a processor. + """An experiment to measure the largest random square circuit that can be run on a processor. # section: overview Quantum Volume (QV) is a single-number metric that can be measured using a concrete protocol From 83423f78e0cb0c923492928ba7638b531acbec98 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:28:10 +0900 Subject: [PATCH 090/113] update InterleavedRB --- .../randomized_benchmarking/interleaved_rb_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/randomized_benchmarking/interleaved_rb_experiment.py b/qiskit_experiments/library/randomized_benchmarking/interleaved_rb_experiment.py index 9d77725a4f..afd5f57159 100644 --- a/qiskit_experiments/library/randomized_benchmarking/interleaved_rb_experiment.py +++ b/qiskit_experiments/library/randomized_benchmarking/interleaved_rb_experiment.py @@ -32,7 +32,7 @@ class InterleavedRB(StandardRB): - r"""An experiment to characterize the error rate of a specific gate on a device. + """An experiment to characterize the error rate of a specific gate on a device. # section: overview Interleaved Randomized Benchmarking (RB) is a method From 86c465d05e9c352f92e834cbaf7e0a783ffb6558 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:29:01 +0900 Subject: [PATCH 091/113] update StandardRB --- .../library/randomized_benchmarking/standard_rb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py index ed217b0e19..8d3c6c0950 100644 --- a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py +++ b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py @@ -54,7 +54,7 @@ class StandardRB(BaseExperiment, RestlessMixin): - r"""An experiment to characterize the error rate of a gate set on a device. + """An experiment to characterize the error rate of a gate set on a device. # section: overview From fd372eb76cae796a0515e0e6a547c4a90c0dafb0 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:30:19 +0900 Subject: [PATCH 092/113] update MitigatedProcessTomography --- qiskit_experiments/library/tomography/mit_qpt_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/mit_qpt_experiment.py b/qiskit_experiments/library/tomography/mit_qpt_experiment.py index f0342d3f5b..87173b6bd2 100644 --- a/qiskit_experiments/library/tomography/mit_qpt_experiment.py +++ b/qiskit_experiments/library/tomography/mit_qpt_experiment.py @@ -25,7 +25,7 @@ class MitigatedProcessTomography(BatchExperiment): - r"""A batched experiment to characterize readout error then perform process tomography + """A batched experiment to characterize readout error then perform process tomography for doing readout error mitigated process tomography. # section: overview From e29a20f87875c51e1f4e58b78a75848d1ebe8859 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:31:15 +0900 Subject: [PATCH 093/113] update MitigatedStateTomography --- qiskit_experiments/library/tomography/mit_qst_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/mit_qst_experiment.py b/qiskit_experiments/library/tomography/mit_qst_experiment.py index 84ea5200e8..21d40806f8 100644 --- a/qiskit_experiments/library/tomography/mit_qst_experiment.py +++ b/qiskit_experiments/library/tomography/mit_qst_experiment.py @@ -25,7 +25,7 @@ class MitigatedStateTomography(BatchExperiment): - r"""A batched experiment to characterize readout error then perform state tomography + """A batched experiment to characterize readout error then perform state tomography for doing readout error mitigated state tomography. # section: overview From bc8cb84a9c04013a7b6d229ba7e456f91c4612f6 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:32:11 +0900 Subject: [PATCH 094/113] update ProcessTomography --- qiskit_experiments/library/tomography/qpt_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/qpt_experiment.py b/qiskit_experiments/library/tomography/qpt_experiment.py index 237d10d1a6..48ec599a8d 100644 --- a/qiskit_experiments/library/tomography/qpt_experiment.py +++ b/qiskit_experiments/library/tomography/qpt_experiment.py @@ -27,7 +27,7 @@ class ProcessTomography(TomographyExperiment): - r"""An experiment to reconstruct the quantum channel from measurement data. + """An experiment to reconstruct the quantum channel from measurement data. # section: overview Quantum process tomography (QPT) is a method for experimentally From 33444a0c54c4f42aaf7e9edeae6189f02ded2714 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:33:06 +0900 Subject: [PATCH 095/113] update StateTomography --- qiskit_experiments/library/tomography/qst_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/qst_experiment.py b/qiskit_experiments/library/tomography/qst_experiment.py index c294519082..564f727b0b 100644 --- a/qiskit_experiments/library/tomography/qst_experiment.py +++ b/qiskit_experiments/library/tomography/qst_experiment.py @@ -26,7 +26,7 @@ class StateTomography(TomographyExperiment): - r"""An experiment to reconstruct the quantum state from measurement data. + """An experiment to reconstruct the quantum state from measurement data. # section: overview Quantum state tomography (QST) is a method for experimentally From 62d19e90c25031253fb839924ca3358a6242182f Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:34:06 +0900 Subject: [PATCH 096/113] update TomographyExperiment --- qiskit_experiments/library/tomography/tomography_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/tomography_experiment.py b/qiskit_experiments/library/tomography/tomography_experiment.py index 6c07631390..b2b22b56fd 100644 --- a/qiskit_experiments/library/tomography/tomography_experiment.py +++ b/qiskit_experiments/library/tomography/tomography_experiment.py @@ -27,7 +27,7 @@ class TomographyExperiment(BaseExperiment): - r"""Base experiment for quantum state and process tomography. + """Base experiment for quantum state and process tomography. # section: analysis_ref :class:`TomographyAnalysis` From b92cdbe99babcc06d95525e6a22765987d2bea02 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 01:46:45 +0900 Subject: [PATCH 097/113] update FineFrequency --- qiskit_experiments/library/calibration/fine_frequency_cal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/fine_frequency_cal.py b/qiskit_experiments/library/calibration/fine_frequency_cal.py index e5f456d765..d3549f4d57 100644 --- a/qiskit_experiments/library/calibration/fine_frequency_cal.py +++ b/qiskit_experiments/library/calibration/fine_frequency_cal.py @@ -50,7 +50,7 @@ class FineFrequencyCal(BaseCalibrationExperiment, FineFrequency): cals = Calibrations.from_backend(backend=backend, libraries=[FixedFrequencyTransmon()]) exp_cal = FineFrequencyCal((0,), cals, backend=backend, auto_update=True, gate_name="sx") - cal_data=exp_cal.run().block_for_results() + cal_data=exp_cal.run(backend_run=True).block_for_results() display(cal_data.figure(0)) cal_data.analysis_results(dataframe=True) """ From 36191e70aeb402f262ae4d93617d101b257cac31 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 01:47:49 +0900 Subject: [PATCH 098/113] update FrequencyCal --- qiskit_experiments/library/calibration/frequency_cal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/calibration/frequency_cal.py b/qiskit_experiments/library/calibration/frequency_cal.py index c52122d555..cbbf829926 100644 --- a/qiskit_experiments/library/calibration/frequency_cal.py +++ b/qiskit_experiments/library/calibration/frequency_cal.py @@ -49,7 +49,7 @@ class FrequencyCal(BaseCalibrationExperiment, RamseyXY): cals = Calibrations.from_backend(backend=backend, libraries=[FixedFrequencyTransmon()]) exp_cal = FrequencyCal((0,), cals, backend=backend, auto_update=True) - cal_data=exp_cal.run().block_for_results() + cal_data=exp_cal.run(backend_run=True).block_for_results() display(cal_data.figure(0)) cal_data.analysis_results(dataframe=True) """ From 3e922f1aa303c6761b88cda06b0d7ee79d53dc0e Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 01:49:35 +0900 Subject: [PATCH 099/113] update FineFrequency --- qiskit_experiments/library/characterization/fine_frequency.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/characterization/fine_frequency.py b/qiskit_experiments/library/characterization/fine_frequency.py index c01b17d5c7..26bedbda9e 100644 --- a/qiskit_experiments/library/characterization/fine_frequency.py +++ b/qiskit_experiments/library/characterization/fine_frequency.py @@ -74,7 +74,7 @@ class FineFrequency(BaseExperiment): repetitions=repetitions) exp.set_transpile_options(optimization_level=0, basis_gates=['sx', 'rz', 'delay']) - exp_data = exp.run().block_for_results() + exp_data = exp.run(backend_run=True).block_for_results() display(exp_data.figure(0)) exp_data.analysis_results(dataframe=True) """ From bd856bd168d3202d0edfe73a090b6507f060f297 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 05:55:45 +0900 Subject: [PATCH 100/113] update QuantumVolume --- qiskit_experiments/library/quantum_volume/qv_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/quantum_volume/qv_experiment.py b/qiskit_experiments/library/quantum_volume/qv_experiment.py index 614db16510..8cedba80a7 100644 --- a/qiskit_experiments/library/quantum_volume/qv_experiment.py +++ b/qiskit_experiments/library/quantum_volume/qv_experiment.py @@ -85,7 +85,7 @@ class QuantumVolume(BaseExperiment): qv_exp.set_transpile_options(optimization_level=3) qv_exp.set_run_options(shots=1000) - expdata = qv_exp.run(backend).block_for_results() + expdata = qv_exp.run(backend=backend, backend_run=True).block_for_results() display(expdata.figure(0)) for result in expdata.analysis_results(): From 02194c037ef8f3d4bd75a6324b7fd44be9e8a3d5 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 05:56:52 +0900 Subject: [PATCH 101/113] update InterleavedRB --- .../randomized_benchmarking/interleaved_rb_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/randomized_benchmarking/interleaved_rb_experiment.py b/qiskit_experiments/library/randomized_benchmarking/interleaved_rb_experiment.py index afd5f57159..2d63efa1cc 100644 --- a/qiskit_experiments/library/randomized_benchmarking/interleaved_rb_experiment.py +++ b/qiskit_experiments/library/randomized_benchmarking/interleaved_rb_experiment.py @@ -78,7 +78,7 @@ class InterleavedRB(StandardRB): int_exp2 = InterleavedRB( circuits.CXGate(), qubits, lengths, num_samples=num_samples, seed=seed) - int_expdata2 = int_exp2.run(backend).block_for_results() + int_expdata2 = int_exp2.run(backend=backend, backend_run=True).block_for_results() int_results2 = int_expdata2.analysis_results() display(int_expdata2.figure(0)) From d1c49a759af882ac6b325db630ccbe62305c1c76 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 05:57:58 +0900 Subject: [PATCH 102/113] update LayerFidelity --- .../library/randomized_benchmarking/layer_fidelity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py b/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py index 0cd2e6a1b1..a192478da9 100644 --- a/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py +++ b/qiskit_experiments/library/randomized_benchmarking/layer_fidelity.py @@ -115,7 +115,7 @@ class LayerFidelity(BaseExperiment, RestlessMixin): ) exp.set_run_options(shots=5000) - expdata = exp.run().block_for_results() + expdata = exp.run(backend_run=True).block_for_results() results = expdata.analysis_results() for i in range(4): From 9d566b5f44181b1bc22c9f5577d6da5baf31097b Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 05:59:11 +0900 Subject: [PATCH 103/113] update StandardRB --- .../library/randomized_benchmarking/standard_rb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py index 8d3c6c0950..03d2d4bcfc 100644 --- a/qiskit_experiments/library/randomized_benchmarking/standard_rb.py +++ b/qiskit_experiments/library/randomized_benchmarking/standard_rb.py @@ -115,14 +115,14 @@ class StandardRB(BaseExperiment, RestlessMixin): for qubit in qubits ] ) - expdata_1q = single_exps.run(backend).block_for_results() + expdata_1q = single_exps.run(backend=backend, backend_run=True).block_for_results() exp_2q = StandardRB(qubits, lengths_2_qubit, num_samples=num_samples, seed=seed) # Use the EPG data of the 1-qubit runs to ensure correct 2-qubit EPG computation exp_2q.analysis.set_options(epg_1_qubit=expdata_1q.analysis_results()) - expdata_2q = exp_2q.run(backend).block_for_results() + expdata_2q = exp_2q.run(backend=backend, backend_run=True).block_for_results() print("Gate error ratio: %s" % expdata_2q.experiment.analysis.options.gate_error_ratio) display(expdata_2q.figure(0)) From 0e7d3ffac69f897a2f5870dabd30760aa6c68e73 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 06:00:33 +0900 Subject: [PATCH 104/113] update MitigatedQPT --- qiskit_experiments/library/tomography/mit_qpt_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/mit_qpt_experiment.py b/qiskit_experiments/library/tomography/mit_qpt_experiment.py index 87173b6bd2..bb33998144 100644 --- a/qiskit_experiments/library/tomography/mit_qpt_experiment.py +++ b/qiskit_experiments/library/tomography/mit_qpt_experiment.py @@ -76,7 +76,7 @@ class MitigatedProcessTomography(BatchExperiment): mitqptexp = MitigatedProcessTomography(qc_ghz) mitqptexp.set_run_options(shots=1000) - mitqptdata = mitqptexp.run(backend=backend, seed_simulator=100).block_for_results() + mitqptdata = mitqptexp.run(backend=backend, seed_simulator=100, backend_run=True).block_for_results() mitigated_choi_out = mitqptdata.analysis_results("state").value # extracting a densitymatrix from mitigated_choi_out From 8f2a196c405b9a4296699727c8fe5a5a686f37a5 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 06:01:35 +0900 Subject: [PATCH 105/113] update MitigatedQST --- qiskit_experiments/library/tomography/mit_qst_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/mit_qst_experiment.py b/qiskit_experiments/library/tomography/mit_qst_experiment.py index 21d40806f8..7b7a9b0da1 100644 --- a/qiskit_experiments/library/tomography/mit_qst_experiment.py +++ b/qiskit_experiments/library/tomography/mit_qst_experiment.py @@ -83,7 +83,7 @@ class MitigatedStateTomography(BatchExperiment): mitqstexp = MitigatedStateTomography(qc_ghz) mitqstexp.set_run_options(shots=1000) - mitqstdata = mitqstexp.run(backend=backend, seed_simulator=100).block_for_results() + mitqstdata = mitqstexp.run(backend=backend, seed_simulator=100, backend_run=True).block_for_results() state_result = mitqstdata.analysis_results("state") plot_state_city(state_result.value, title="mitigated Density Matrix") """ From f5f5a7d02f446cca485ca4201a0f1f6e38584461 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 06:03:03 +0900 Subject: [PATCH 106/113] update ProcessTomography --- qiskit_experiments/library/tomography/qpt_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/qpt_experiment.py b/qiskit_experiments/library/tomography/qpt_experiment.py index 48ec599a8d..5d7ed67eb8 100644 --- a/qiskit_experiments/library/tomography/qpt_experiment.py +++ b/qiskit_experiments/library/tomography/qpt_experiment.py @@ -71,7 +71,7 @@ class ProcessTomography(TomographyExperiment): qc_ghz.cx(0, i) qptexp = ProcessTomography(qc_ghz) - qptdata = qptexp.run(backend=backend, shots=1000, seed_simulator=100).block_for_results() + qptdata = qptexp.run(backend=backend, shots=1000, seed_simulator=100, backend_run=True).block_for_results() choi_out = qptdata.analysis_results("state").value # extracting a densitymatrix from choi_out From 7ea967d5f219387ce2bd35195ca53ac96f398970 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 06:03:56 +0900 Subject: [PATCH 107/113] update StateTomography --- qiskit_experiments/library/tomography/qst_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/qst_experiment.py b/qiskit_experiments/library/tomography/qst_experiment.py index 564f727b0b..8385e37e08 100644 --- a/qiskit_experiments/library/tomography/qst_experiment.py +++ b/qiskit_experiments/library/tomography/qst_experiment.py @@ -72,7 +72,7 @@ class StateTomography(TomographyExperiment): qc_ghz.cx(0, i) qstexp = StateTomography(qc_ghz) - qstdata = qstexp.run(backend=backend, shots=1000, seed_simulator=100).block_for_results() + qstdata = qstexp.run(backend=backend, shots=1000, seed_simulator=100, backend_run=True).block_for_results() state_result = qstdata.analysis_results("state") plot_state_city(state_result.value, title="Density Matrix") """ From 84bc8d5cdb507ffaf7f481d0554e4c55ddc36b69 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 06:05:23 +0900 Subject: [PATCH 108/113] update TomographyExperiment --- qiskit_experiments/library/tomography/tomography_experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/tomography_experiment.py b/qiskit_experiments/library/tomography/tomography_experiment.py index b2b22b56fd..ee407b4a08 100644 --- a/qiskit_experiments/library/tomography/tomography_experiment.py +++ b/qiskit_experiments/library/tomography/tomography_experiment.py @@ -64,7 +64,7 @@ class TomographyExperiment(BaseExperiment): measurement_basis=PauliMeasurementBasis(), ) - qstdata = qstexp.run(backend=backend, shots=1000, seed_simulator=100).block_for_results() + qstdata = qstexp.run(backend=backend, shots=1000, seed_simulator=100, backend_run=True).block_for_results() state_result = qstdata.analysis_results("state") plot_state_city(state_result.value, title="Density Matrix") """ From 5ec0c2ba78766a784747b49fe2d020a8b9003e53 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 07:23:10 +0900 Subject: [PATCH 109/113] update MitigatedQST --- qiskit_experiments/library/tomography/mit_qst_experiment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/mit_qst_experiment.py b/qiskit_experiments/library/tomography/mit_qst_experiment.py index 7b7a9b0da1..e2f44c80ef 100644 --- a/qiskit_experiments/library/tomography/mit_qst_experiment.py +++ b/qiskit_experiments/library/tomography/mit_qst_experiment.py @@ -83,7 +83,8 @@ class MitigatedStateTomography(BatchExperiment): mitqstexp = MitigatedStateTomography(qc_ghz) mitqstexp.set_run_options(shots=1000) - mitqstdata = mitqstexp.run(backend=backend, seed_simulator=100, backend_run=True).block_for_results() + mitqstdata = mitqstexp.run(backend=backend, seed_simulator=100,\ + backend_run=True).block_for_results() state_result = mitqstdata.analysis_results("state") plot_state_city(state_result.value, title="mitigated Density Matrix") """ From 1538797a997d34c509b8db12191eabdcf529d567 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 07:44:58 +0900 Subject: [PATCH 110/113] update MitigatedQPT --- qiskit_experiments/library/tomography/mit_qpt_experiment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/mit_qpt_experiment.py b/qiskit_experiments/library/tomography/mit_qpt_experiment.py index bb33998144..29b1dae8a0 100644 --- a/qiskit_experiments/library/tomography/mit_qpt_experiment.py +++ b/qiskit_experiments/library/tomography/mit_qpt_experiment.py @@ -76,7 +76,8 @@ class MitigatedProcessTomography(BatchExperiment): mitqptexp = MitigatedProcessTomography(qc_ghz) mitqptexp.set_run_options(shots=1000) - mitqptdata = mitqptexp.run(backend=backend, seed_simulator=100, backend_run=True).block_for_results() + mitqptdata = mitqptexp.run(backend=backend, seed_simulator=100,\ + backend_run=True).block_for_results() mitigated_choi_out = mitqptdata.analysis_results("state").value # extracting a densitymatrix from mitigated_choi_out From 58f78814c39889bb8b1a09854ba7e9907fc103f7 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 07:46:13 +0900 Subject: [PATCH 111/113] update StateTomography --- qiskit_experiments/library/tomography/qpt_experiment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/qpt_experiment.py b/qiskit_experiments/library/tomography/qpt_experiment.py index 5d7ed67eb8..a972bcbdcb 100644 --- a/qiskit_experiments/library/tomography/qpt_experiment.py +++ b/qiskit_experiments/library/tomography/qpt_experiment.py @@ -71,7 +71,8 @@ class ProcessTomography(TomographyExperiment): qc_ghz.cx(0, i) qptexp = ProcessTomography(qc_ghz) - qptdata = qptexp.run(backend=backend, shots=1000, seed_simulator=100, backend_run=True).block_for_results() + qptdata = qptexp.run(backend=backend, shots=1000, seed_simulator=100,\ + backend_run=True).block_for_results() choi_out = qptdata.analysis_results("state").value # extracting a densitymatrix from choi_out From c9c8135dc1fdbc50b90d8d0233b8d127de2eb78e Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 07:48:33 +0900 Subject: [PATCH 112/113] update StateTomograpy --- qiskit_experiments/library/tomography/qst_experiment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/qst_experiment.py b/qiskit_experiments/library/tomography/qst_experiment.py index 8385e37e08..c66a170ae3 100644 --- a/qiskit_experiments/library/tomography/qst_experiment.py +++ b/qiskit_experiments/library/tomography/qst_experiment.py @@ -72,7 +72,8 @@ class StateTomography(TomographyExperiment): qc_ghz.cx(0, i) qstexp = StateTomography(qc_ghz) - qstdata = qstexp.run(backend=backend, shots=1000, seed_simulator=100, backend_run=True).block_for_results() + qstdata = qstexp.run(backend=backend, shots=1000, seed_simulator=100,\ + backend_run=True).block_for_results() state_result = qstdata.analysis_results("state") plot_state_city(state_result.value, title="Density Matrix") """ From 2f59a2705a967e9c48b5f63c69a3e7065c399484 Mon Sep 17 00:00:00 2001 From: Naohito Nakazawa <117684192+Naohnakazawa@users.noreply.github.com> Date: Thu, 28 Nov 2024 07:50:15 +0900 Subject: [PATCH 113/113] update TomographyExperiment --- qiskit_experiments/library/tomography/tomography_experiment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit_experiments/library/tomography/tomography_experiment.py b/qiskit_experiments/library/tomography/tomography_experiment.py index ee407b4a08..5c551464dd 100644 --- a/qiskit_experiments/library/tomography/tomography_experiment.py +++ b/qiskit_experiments/library/tomography/tomography_experiment.py @@ -64,7 +64,8 @@ class TomographyExperiment(BaseExperiment): measurement_basis=PauliMeasurementBasis(), ) - qstdata = qstexp.run(backend=backend, shots=1000, seed_simulator=100, backend_run=True).block_for_results() + qstdata = qstexp.run(backend=backend, shots=1000, seed_simulator=100,\ + backend_run=True).block_for_results() state_result = qstdata.analysis_results("state") plot_state_city(state_result.value, title="Density Matrix") """