# ══════════════════════════════════════════════════════════════════════════
# ___ ___ ___ _ _ ___
# / _ \ / __|_ ) | | /_\ | _ )
# | (_) | (__ / / | |__ / _ \| _ \
# \__\_\\___/___| |____/_/ \_\___/
#
# 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 Rabi and N-Rabi oscillation calibration.
"""
import numpy as np
from bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.analysis import (
NRabiAnalysis,
RabiAnalysis,
)
from bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.measurement import (
NRabiOscillationsMeasurement,
RabiOscillationsMeasurement,
)
from bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.parameters import (
NRabi01QOI,
NRabiBaseQOI,
NRabiParameters,
Rabi01QOI,
RabiBaseQOI,
RabiParameters,
)
from bragi_quantum.experiments.nodes.schedule_node import ScheduleQubitNode
[docs]
class RabiOscillations(ScheduleQubitNode):
"""
Execution node for performing Rabi oscillations.
A single node class handles both the 0->1 and 1->2 transitions; the
transition is selected by the ``transition`` field in ``RabiParameters``.
"""
measurement_cls = RabiOscillationsMeasurement
analysis_cls = RabiAnalysis
parameters: RabiParameters
def __init__(
self,
parameters: RabiParameters,
qoi_cls: type[RabiBaseQOI] = Rabi01QOI,
):
"""
Initializes the Rabi oscillations 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_amplitudes": {
qubit: np.linspace(
self.parameters_by_qubit[qubit].min_amplitude,
self.parameters_by_qubit[qubit].max_amplitude,
self.parameters_by_qubit[qubit].amplitude_bins,
)
for qubit in self.all_qubits
}
}
[docs]
class NRabiOscillations(ScheduleQubitNode):
"""
Execution node for performing N-Rabi (amplitude-correction) oscillations.
Sweeps a small correction to the current amp180 over several X-pulse
repetition counts to amplify the amplitude error. The transition is
selected by the ``transition`` field in ``NRabiParameters``.
"""
measurement_cls = NRabiOscillationsMeasurement
analysis_cls = NRabiAnalysis
parameters: NRabiParameters
def __init__(
self,
parameters: NRabiParameters,
qoi_cls: type[NRabiBaseQOI] = NRabi01QOI,
):
"""
Initializes the N-Rabi oscillations 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_amplitudes_sweep": {
qubit: np.linspace(
self.parameters_by_qubit[qubit].min_amplitude,
self.parameters_by_qubit[qubit].max_amplitude,
self.parameters_by_qubit[qubit].amplitude_bins,
)
for qubit in self.all_qubits
},
"X_repetitions": {
qubit: np.array(self.parameters_by_qubit[qubit].x_repetitions)
for qubit in self.all_qubits
},
}