From fa7cb84cbfda351eee55b38f0fb17f7a2ae6f000 Mon Sep 17 00:00:00 2001 From: Andrea Date: Wed, 15 Jan 2025 22:42:33 +0400 Subject: [PATCH] fix: Correct non-zero amplitude case --- .../protocols/flux_amplitude_frequency.py | 20 +++++++++++-------- tests/runcards/protocols.yml | 9 +++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/qibocal/protocols/flux_amplitude_frequency.py b/src/qibocal/protocols/flux_amplitude_frequency.py index 0106bca14..8b0f2720d 100644 --- a/src/qibocal/protocols/flux_amplitude_frequency.py +++ b/src/qibocal/protocols/flux_amplitude_frequency.py @@ -173,16 +173,19 @@ def _acquisition( targets: list[QubitId], ) -> FluxAmplitudeFrequencyData: - detuning = { - qubit: ( - 0 - if params.crosstalk_qubit is None - else platform.calibration.single_qubits[qubit].qubit.detuning( + detuning = {} + for qubit in targets: + if params.crosstalk_qubit is None and params.amplitude_min == 0: + detuning[qubit] = 0 + elif params.crosstalk_qubit is not None: + detuning[qubit] = platform.calibration.single_qubits[qubit].qubit.detuning( params.flux_pulse_amplitude ) - ) - for qubit in targets - } + else: + detuning[qubit] = platform.calibration.single_qubits[qubit].qubit.detuning( + params.amplitude_min + ) + qubit_frequency = { qubit: platform.calibration.single_qubits[qubit].qubit.frequency_01 * HZ_TO_GHZ for qubit in targets @@ -272,6 +275,7 @@ def _fit(data: FluxAmplitudeFrequencyData) -> FluxAmplitudeFrequencyResults: other_det = data.detuning[qubit] f = data.qubit_frequency[qubit] det = phase / data.flux_pulse_duration / 2 / np.pi + other_det + det[np.abs(det) < 1e-3] = 0 derived_flux = 1 / np.pi * np.arccos(((f + det) / f) ** 2) flux[qubit] = derived_flux.tolist() fitted_parameters_detuning[qubit] = np.polyfit(amplitudes, det, 2).tolist() diff --git a/tests/runcards/protocols.yml b/tests/runcards/protocols.yml index e5147409a..e98c007b6 100644 --- a/tests/runcards/protocols.yml +++ b/tests/runcards/protocols.yml @@ -870,6 +870,15 @@ actions: duration: 50 relaxation_time: 50_000 + - id: flux_amplitude_dep 0 amp + operation: flux_amplitude_frequency + parameters: + amplitude_min: 0 + amplitude_max: 1 + amplitude_step: 0.1 + duration: 50 + relaxation_time: 50_000 + - id: flux_amplitude_dep_crosstalk operation: flux_amplitude_frequency targets: [0]