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

# ══════════════════════════════════════════════════════════════════════════
#     ___   ___ ___   _      _   ___
#    / _ \ / __|_  ) | |    /_\ | _ )
#   | (_) | (__ / /  | |__ / _ \| _ \
#    \__\_\\___/___| |____/_/ \_\___/
#
#   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
#   Michele Faucci Giannelli, faucci@chalmers.se
# ══════════════════════════════════════════════════════════════════════════


"""
Node implementation for T2 Echo (Hahn echo) characterization.
"""

import numpy as np

from bragi_quantum.experiments.nodes.characterization.t2_echo.analysis import (
    T2EchoAnalysis,
)
from bragi_quantum.experiments.nodes.characterization.t2_echo.measurement import (
    T2EchoMeasurement,
)
from bragi_quantum.experiments.nodes.characterization.t2_echo.parameters import (
    T2EchoParameters,
    T2EchoQOI,
)
from bragi_quantum.experiments.nodes.external_parameter_node import (
    ExternalParameterFixedScheduleQubitNode,
)


[docs] class T2Echo(ExternalParameterFixedScheduleQubitNode): """ Execution node for T2 Echo (Hahn echo) characterization. The delay sweep (with its per-point hardware averaging expressed as a loop register, plus the automatic calibration-points block appended by ``BaseNode.precompile``) is compiled once and then executed independently ``t2_echo_repetitions`` times: ``ExternalParameterFixedScheduleNode`` tags each execution's data — sweep AND calibration points alike — with its own ``t2_echo_repetitions`` coordinate. ``T2EchoAnalysis`` fits each repeat separately against its own calibration axis and reports the T2 echo error as the spread across those independent fits. """ measurement_cls = T2EchoMeasurement analysis_cls = T2EchoAnalysis append_calibration_points = True parameters: T2EchoParameters def __init__( self, parameters: T2EchoParameters, qoi_cls: type[T2EchoQOI] = T2EchoQOI, ): """ Initializes the T2 Echo node. Args: parameters: Validated experimental parameters. qoi_cls: The QOI class used to store results. """ super().__init__( parameters=parameters, qoi_cls=qoi_cls, ) self.schedule_keywords = { "repetitions": self.parameters.repetitions, } self.schedule_samplespace = { "delays": { qubit: np.array(self.parameters.delays) for qubit in self.all_qubits } } self.external_samplespace = { "t2_echo_repetitions": { qubit: range(self.parameters.t2_echo_repetitions) for qubit in self.all_qubits } }