From 4902a183cbb582c8e73abb7d56882e530865b21f Mon Sep 17 00:00:00 2001 From: Andrea Date: Tue, 24 Sep 2024 16:57:56 +0400 Subject: [PATCH] feat: Add detuning attribute --- src/qibocal/protocols/ramsey/ramsey.py | 1 + src/qibocal/protocols/ramsey/ramsey_signal.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/qibocal/protocols/ramsey/ramsey.py b/src/qibocal/protocols/ramsey/ramsey.py index e6d1da2c2..dab69ecfe 100644 --- a/src/qibocal/protocols/ramsey/ramsey.py +++ b/src/qibocal/protocols/ramsey/ramsey.py @@ -210,6 +210,7 @@ def _fit(data: RamseyData) -> RamseyResults: except Exception as e: log.warning(f"Ramsey fitting failed for qubit {qubit} due to {e}.") return RamseyResults( + detuning=data.detuning, frequency=freq_measure, t2=t2_measure, delta_phys=delta_phys_measure, diff --git a/src/qibocal/protocols/ramsey/ramsey_signal.py b/src/qibocal/protocols/ramsey/ramsey_signal.py index a2a2e2cca..07bb695c4 100644 --- a/src/qibocal/protocols/ramsey/ramsey_signal.py +++ b/src/qibocal/protocols/ramsey/ramsey_signal.py @@ -40,6 +40,8 @@ class RamseySignalParameters(Parameters): class RamseySignalResults(Results): """Ramsey outputs.""" + detuning: float + """Qubit frequency detuning.""" frequency: dict[QubitId, Union[float, list[float]]] """Drive frequency [GHz] for each qubit.""" t2: dict[QubitId, Union[float, list[float]]] @@ -52,9 +54,6 @@ class RamseySignalResults(Results): fitted_parameters: dict[QubitId, list[float]] """Raw fitting output.""" - def is_detuned(self, qubit: QubitId): - return int(self.delta_phys[qubit][0]) != int(self.delta_fitting[qubit][0]) - RamseySignalType = np.dtype([("wait", np.float64), ("signal", np.float64)]) """Custom dtype for coherence routines.""" @@ -208,6 +207,7 @@ def _fit(data: RamseySignalData) -> RamseySignalResults: log.warning(f"Ramsey fitting failed for qubit {qubit} due to {e}.") return RamseySignalResults( + detuning=data.detuning, frequency=freq_measure, t2=t2_measure, delta_phys=delta_phys_measure, @@ -286,7 +286,7 @@ def _plot(data: RamseySignalData, target: QubitId, fit: RamseySignalResults = No def _update(results: RamseySignalResults, platform: Platform, target: QubitId): - if results.is_detuned(target): + if results.detuning is not None: update.drive_frequency(results.frequency[target][0], platform, target) else: update.t2(results.t2[target][0], platform, target)