Skip to content

Commit

Permalink
feat: Add detuning attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-pasquale committed Sep 24, 2024
1 parent 41baa99 commit 4902a18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/qibocal/protocols/ramsey/ramsey.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/qibocal/protocols/ramsey/ramsey_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]]
Expand All @@ -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."""
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4902a18

Please sign in to comment.