From 1aac948dd736985b6d8a77b88ed41c776c97e7fc Mon Sep 17 00:00:00 2001 From: Edoardo-Pedicillo Date: Wed, 2 Oct 2024 17:34:41 +0400 Subject: [PATCH 1/3] fix: coupling units --- .../protocols/flux_dependence/resonator_flux_dependence.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qibocal/protocols/flux_dependence/resonator_flux_dependence.py b/src/qibocal/protocols/flux_dependence/resonator_flux_dependence.py index 415a15238..ab7883b1f 100644 --- a/src/qibocal/protocols/flux_dependence/resonator_flux_dependence.py +++ b/src/qibocal/protocols/flux_dependence/resonator_flux_dependence.py @@ -230,7 +230,7 @@ def fit_function(x, g, resonator_freq): return ResonatorFluxResults( resonator_freq=resonator_freq, bare_resonator_freq=bare_resonator_freq, - coupling=coupling, + coupling=coupling * GHZ_TO_HZ, fitted_parameters=fitted_parameters, ) From 89db80b57d7e0483a0892e727ab67c047573751d Mon Sep 17 00:00:00 2001 From: Edoardo-Pedicillo Date: Wed, 2 Oct 2024 23:40:37 +0400 Subject: [PATCH 2/3] fix: move change of units --- .../protocols/flux_dependence/resonator_flux_dependence.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qibocal/protocols/flux_dependence/resonator_flux_dependence.py b/src/qibocal/protocols/flux_dependence/resonator_flux_dependence.py index ab7883b1f..e8ad497a8 100644 --- a/src/qibocal/protocols/flux_dependence/resonator_flux_dependence.py +++ b/src/qibocal/protocols/flux_dependence/resonator_flux_dependence.py @@ -204,6 +204,7 @@ def fit_function(x, g, resonator_freq): ), maxfev=100000, ) + fitted_parameters[qubit] = { "w_max": data.qubit_frequency[qubit] * HZ_TO_GHZ, "xj": 0, @@ -217,7 +218,7 @@ def fit_function(x, g, resonator_freq): } sweetspot = -data.offset[qubit] / data.matrix_element[qubit] resonator_freq[qubit] = fit_function(sweetspot, *popt) * GHZ_TO_HZ - coupling[qubit] = popt[0] + coupling[qubit] = popt[0] * GHZ_TO_HZ bare_resonator_freq[qubit] = popt[1] * GHZ_TO_HZ except ValueError as e: log.error( @@ -226,11 +227,10 @@ def fit_function(x, g, resonator_freq): "Lowering the value of `threshold` in `extract_*_feature`" "should fix the problem." ) - return ResonatorFluxResults( resonator_freq=resonator_freq, bare_resonator_freq=bare_resonator_freq, - coupling=coupling * GHZ_TO_HZ, + coupling=coupling, fitted_parameters=fitted_parameters, ) @@ -268,7 +268,6 @@ def _plot(data: ResonatorFluxData, fit: ResonatorFluxResults, target: QubitId): def _update(results: ResonatorFluxResults, platform: Platform, qubit: QubitId): - pass update.bare_resonator_frequency(results.bare_resonator_freq[qubit], platform, qubit) update.readout_frequency(results.resonator_freq[qubit], platform, qubit) update.coupling(results.coupling[qubit], platform, qubit) From 8911e6049e7789c23d610e1246b66f39499dbc71 Mon Sep 17 00:00:00 2001 From: Edoardo-Pedicillo Date: Fri, 4 Oct 2024 16:37:23 +0400 Subject: [PATCH 3/3] test: add Runtime Error in resonator+crosstalk --- src/qibocal/protocols/flux_dependence/resonator_crosstalk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qibocal/protocols/flux_dependence/resonator_crosstalk.py b/src/qibocal/protocols/flux_dependence/resonator_crosstalk.py index 8933f796b..44046c8b1 100644 --- a/src/qibocal/protocols/flux_dependence/resonator_crosstalk.py +++ b/src/qibocal/protocols/flux_dependence/resonator_crosstalk.py @@ -311,7 +311,7 @@ def fit_function(x, crosstalk_element, offset): crosstalk_matrix[target_qubit][flux_qubit] = ( popt[0] * data.matrix_element[target_qubit] ) - except ValueError as e: + except (ValueError, RuntimeError) as e: log.error( f"Off-diagonal flux fit failed for qubit {flux_qubit} due to {e}." )