# ══════════════════════════════════════════════════════════════════════════
# ___ ___ ___ _ _ ___
# / _ \ / __|_ ) | | /_\ | _ )
# | (_) | (__ / / | |__ / _ \| _ \
# \__\_\\___/___| |____/_/ \_\___/
#
# 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:
#
# Matteo Robbiati, robbiati@chalmers.se
# Axel Andersson, axean@chalmers.se
# Michele Faucci Giannelli, faucci@chalmers.se
# ══════════════════════════════════════════════════════════════════════════
"""
Node implementation for Motzoi (DRAG beta) calibration.
"""
import numpy as np
from bragi_quantum.experiments.nodes.qubit_control.motzoi_parameter.analysis import (
MotzoiAnalysis,
)
from bragi_quantum.experiments.nodes.qubit_control.motzoi_parameter.measurement import (
MotzoiMeasurement,
)
from bragi_quantum.experiments.nodes.qubit_control.motzoi_parameter.parameters import (
Motzoi01QOI,
MotzoiBaseQOI,
MotzoiParameters,
)
from bragi_quantum.experiments.nodes.schedule_node import ScheduleQubitNode
[docs]
class MotzoiParameter(ScheduleQubitNode):
"""
Execution node for performing Motzoi (DRAG beta) calibration.
A single node class handles both the 0->1 and 1->2 transitions; the
transition is selected by the ``transition`` field in ``MotzoiParameters``.
"""
measurement_cls = MotzoiMeasurement
analysis_cls = MotzoiAnalysis
parameters: MotzoiParameters
def __init__(
self,
parameters: MotzoiParameters,
qoi_cls: type[MotzoiBaseQOI] = Motzoi01QOI,
):
"""
Initializes the Motzoi 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 = {
"mw_motzois": {
qubit: np.linspace(
self.parameters_by_qubit[qubit].min_motzoi,
self.parameters_by_qubit[qubit].max_motzoi,
self.parameters_by_qubit[qubit].motzoi_bins,
)
for qubit in self.all_qubits
},
# Two complementary circuits are measured per motzoi value
# (circ_idx 0 = X.Y90, circ_idx 1 = Y.X90). circ_idx must be a
# samplespace dimension so configure_dataset builds a 2-D
# acquisition index (one acquisition per motzoi *and* per circuit);
# otherwise the two acquisitions per point collide on a 1-D index.
"circ_idx": {
qubit: np.array([0, 1], dtype=np.int8) for qubit in self.all_qubits
},
}