# ══════════════════════════════════════════════════════════════════════════
# ___ ___ ___ _ _ ___
# / _ \ / __|_ ) | | /_\ | _ )
# | (_) | (__ / / | |__ / _ \| _ \
# \__\_\\___/___| |____/_/ \_\___/
#
# 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 T1 relaxation-time characterization.
"""
import numpy as np
from bragi_quantum.experiments.nodes.characterization.t1.analysis import T1Analysis
from bragi_quantum.experiments.nodes.characterization.t1.measurement import (
T1Measurement,
)
from bragi_quantum.experiments.nodes.characterization.t1.parameters import (
T1QOI,
T1Parameters,
)
from bragi_quantum.experiments.nodes.external_parameter_node import (
ExternalParameterFixedScheduleQubitNode,
)
[docs]
class T1(ExternalParameterFixedScheduleQubitNode):
"""
Execution node for T1 relaxation-time 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 ``t1_repetitions`` times: ``ExternalParameterFixedScheduleNode``
tags each execution's data — sweep AND calibration points alike — with
its own ``t1_repetitions`` coordinate. ``T1Analysis`` fits each repeat
separately against its own calibration axis and reports the T1 error as
the spread across those independent fits.
"""
measurement_cls = T1Measurement
analysis_cls = T1Analysis
append_calibration_points = True
parameters: T1Parameters
def __init__(
self,
parameters: T1Parameters,
qoi_cls: type[T1QOI] = T1QOI,
):
"""
Initializes the T1 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 = {
"transition": self.parameters.transition,
"repetitions": self.parameters.repetitions,
}
self.schedule_samplespace = {
"delays": {
qubit: np.array(self.parameters.delays) for qubit in self.all_qubits
}
}
self.external_samplespace = {
"t1_repetitions": {
qubit: range(self.parameters.t1_repetitions)
for qubit in self.all_qubits
}
}