Source code for bragi_quantum.experiments.nodes.characterization.t2_echo.analysis

# ══════════════════════════════════════════════════════════════════════════
#     ___   ___ ___   _      _   ___
#    / _ \ / __|_  ) | |    /_\ | _ )
#   | (_) | (__ / /  | |__ / _ \| _ \
#    \__\_\\___/___| |____/_/ \_\___/
#
#   QC2 @ CHALMERS CALIBRATION TOOLKIT
#   (c) 2026 Chalmers University of Technology and Project Contributors
# ──────────────────────────────────────────────────────────────────────────
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       https://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
# ──────────────────────────────────────────────────────────────────────────
#   CONTRIBUTORS list:
#
#   Axel Andersson, axean@chalmers.se
#   Matteo Robbiati, robbiati@chalmers.se
# ══════════════════════════════════════════════════════════════════════════


"""
Module containing classes that fit and plot data from a T2 Echo experiment.
"""

from typing import override

from bragi_quantum.experiments.nodes.characterization.coherence_analysis import (
    ExponentialDecayAnalysis,
)
from bragi_quantum.experiments.nodes.characterization.t2_echo.parameters import (
    T2EchoParameters,
    T2EchoQOI,
)


[docs] class T2EchoAnalysis(ExponentialDecayAnalysis): """ Analysis that fits T2 echo decay of a single qubit, repeated independently ``t2_echo_repetitions`` times. Every delay point is a single hardware-averaged value (``repetitions`` hardware-averaged shots collapse into it — that averaging is not a coordinate this analysis has access to). Each of the ``t2_echo_repetitions`` independent sweeps is projected onto the |0>-|1> calibration axis using *its own* calibration points (``project`` broadcasts per slice of the outer ``t2_echo_repetitions`` dimension, never averaging calibration points across repeats) and fitted separately to an exponential decay. The reported T2 echo is the mean of the per-repeat fits and its error is the plain standard deviation across those repeats. The recorded ``delays`` coordinate is the half-delay (tau/2) the measurement schedule swept — see ``T2EchoMeasurement`` — so it is doubled back to the total echo delay before fitting. """ label = "T2 echo" repetitions_key = "t2_echo_repetitions" # The schedule swept the half-delay (tau/2 per side of the echo). delay_scale = 2.0 parameters: T2EchoParameters @override def _build_qoi(self) -> T2EchoQOI: return self.qoi_cls( is_successful=True, t2_echo=self.time, t2_echo_error=self.time_error, offset=self.offset, offset_error=self.offset_error, amplitude=self.amplitude, amplitude_error=self.amplitude_error, )