From 97ee90f74a1300568c44df5338664223eea13567 Mon Sep 17 00:00:00 2001 From: Sergi Date: Mon, 28 Oct 2024 15:15:35 +0400 Subject: [PATCH 1/3] remove virtual phase from routine to find virtual phase --- .../protocols/two_qubit_interaction/virtual_z_phases.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases.py b/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases.py index e526198cd..cd45b4fd8 100644 --- a/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases.py +++ b/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases.py @@ -143,12 +143,12 @@ def create_sequence( theta_pulse = platform.create_RX90_pulse( target_qubit, start=flux_sequence.finish + dt, - relative_phase=virtual_z_phase[target_qubit], + relative_phase=0, ) RX_pulse_end = platform.create_RX_pulse( control_qubit, start=flux_sequence.finish + dt, - relative_phase=virtual_z_phase[control_qubit], + relative_phase=0, ) measure_target = platform.create_qubit_readout_pulse( target_qubit, start=theta_pulse.finish From 3c5a42d04abee23c15e37d64e7de48b2c6ef5e9c Mon Sep 17 00:00:00 2001 From: Edoardo-Pedicillo Date: Wed, 30 Oct 2024 19:19:59 +0400 Subject: [PATCH 2/3] fix: remove data.vphase in two qubits optimize --- src/qibocal/protocols/two_qubit_interaction/optimize.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/qibocal/protocols/two_qubit_interaction/optimize.py b/src/qibocal/protocols/two_qubit_interaction/optimize.py index 020eecb66..363f6e402 100644 --- a/src/qibocal/protocols/two_qubit_interaction/optimize.py +++ b/src/qibocal/protocols/two_qubit_interaction/optimize.py @@ -112,8 +112,6 @@ class OptimizeTwoQubitGateData(Data): """Angles swept.""" native: str = "CZ" """Native two qubit gate.""" - vphases: dict[QubitPairId, dict[QubitId, float]] = field(default_factory=dict) - """Virtual phases for each qubit.""" amplitudes: dict[tuple[QubitId, QubitId], float] = field(default_factory=dict) """"Amplitudes swept.""" durations: dict[tuple[QubitId, QubitId], float] = field(default_factory=dict) @@ -181,7 +179,6 @@ def _acquisition( params.parking, params.flux_pulse_amplitude_min, ) - data.vphases[ord_pair] = dict(virtual_z_phase) theta = np.arange( params.theta_start, params.theta_end, @@ -208,7 +205,7 @@ def _acquisition( sweeper_theta = Sweeper( Parameter.relative_phase, - theta - data.vphases[ord_pair][target_q], + theta, pulses=[theta_pulse], type=SweeperType.ABSOLUTE, ) @@ -246,7 +243,7 @@ def _acquisition( target_q, control_q, setup, - theta - data.vphases[ord_pair][target_q], + theta, data.amplitudes[ord_pair], data.durations[ord_pair], result_control, @@ -293,7 +290,7 @@ def _fit( try: popt, _ = curve_fit( fit_function, - np.array(data.thetas) - data.vphases[ord_pair][target], + np.array(data.thetas), target_data, p0=pguess, bounds=( From 535f5e6efaf775a4b06291a7e5647990f5413103 Mon Sep 17 00:00:00 2001 From: Edoardo-Pedicillo Date: Wed, 30 Oct 2024 20:21:37 +0400 Subject: [PATCH 3/3] refactor: remove virtual_z_phase and data.vphases --- .../protocols/two_qubit_interaction/optimize.py | 1 - .../two_qubit_interaction/virtual_z_phases.py | 10 +--------- .../two_qubit_interaction/virtual_z_phases_signal.py | 2 -- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/qibocal/protocols/two_qubit_interaction/optimize.py b/src/qibocal/protocols/two_qubit_interaction/optimize.py index 363f6e402..cf2ce3216 100644 --- a/src/qibocal/protocols/two_qubit_interaction/optimize.py +++ b/src/qibocal/protocols/two_qubit_interaction/optimize.py @@ -164,7 +164,6 @@ def _acquisition( for setup in ("I", "X"): ( sequence, - virtual_z_phase, theta_pulse, amplitude, data.durations[ord_pair], diff --git a/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases.py b/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases.py index cd45b4fd8..c4659b660 100644 --- a/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases.py +++ b/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases.py @@ -88,7 +88,6 @@ class VirtualZPhasesData(Data): data: dict[tuple, npt.NDArray[VirtualZPhasesType]] = field(default_factory=dict) native: str = "CZ" thetas: list = field(default_factory=list) - vphases: dict[QubitPairId, dict[QubitId, float]] = field(default_factory=dict) amplitudes: dict[tuple[QubitId, QubitId], float] = field(default_factory=dict) durations: dict[tuple[QubitId, QubitId], float] = field(default_factory=dict) @@ -127,9 +126,7 @@ def create_sequence( ) RX_pulse_start = platform.create_RX_pulse(control_qubit, start=0, relative_phase=0) - flux_sequence, virtual_z_phase = getattr( - platform, f"create_{native}_pulse_sequence" - )( + flux_sequence, _ = getattr(platform, f"create_{native}_pulse_sequence")( (ordered_pair[1], ordered_pair[0]), start=max(Y90_pulse.finish, RX_pulse_start.finish), ) @@ -139,7 +136,6 @@ def create_sequence( if duration is not None: flux_sequence.get_qubit_pulses(ordered_pair[1])[0].duration = duration - theta_pulse = platform.create_RX90_pulse( target_qubit, start=flux_sequence.finish + dt, @@ -177,10 +173,8 @@ def create_sequence( if pulse.qubit not in ordered_pair: pulse.duration = theta_pulse.finish sequence.add(pulse) - return ( sequence, - virtual_z_phase, theta_pulse, flux_sequence.get_qubit_pulses(ordered_pair[1])[0].amplitude, flux_sequence.get_qubit_pulses(ordered_pair[1])[0].duration, @@ -222,7 +216,6 @@ def _acquisition( for setup in ("I", "X"): ( sequence, - virtual_z_phase, theta_pulse, data.amplitudes[ord_pair], data.durations[ord_pair], @@ -237,7 +230,6 @@ def _acquisition( params.parking, params.flux_pulse_amplitude, ) - data.vphases[ord_pair] = dict(virtual_z_phase) theta = np.arange( params.theta_start, params.theta_end, diff --git a/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases_signal.py b/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases_signal.py index 64bd0a7ab..d4f54ec46 100644 --- a/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases_signal.py +++ b/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases_signal.py @@ -75,7 +75,6 @@ def _acquisition( for setup in ("I", "X"): ( sequence, - virtual_z_phase, theta_pulse, data.amplitudes[ord_pair], data.durations[ord_pair], @@ -90,7 +89,6 @@ def _acquisition( params.parking, params.flux_pulse_amplitude, ) - data.vphases[ord_pair] = dict(virtual_z_phase) theta = np.arange( params.theta_start, params.theta_end,