# ══════════════════════════════════════════════════════════════════════════
# ___ ___ ___ _ _ ___
# / _ \ / __|_ ) | | /_\ | _ )
# | (_) | (__ / / | |__ / _ \| _ \
# \__\_\\___/___| |____/_/ \_\___/
#
# 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 Resonator Spectroscopy.
"""
# Local Node Imports
from bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.analysis import (
ResonatorSpectroscopyAnalysis,
)
from bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.measurement import (
ResonatorSpectroscopyMeasurement,
)
from bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.parameters import (
ResonatorSpectroscopyBaseQOI,
ResonatorSpectroscopyParameters,
)
from bragi_quantum.experiments.nodes.schedule_node import ScheduleQubitNode
from bragi_quantum.experiments.utils.samplespace import resonator_samples
# bragi_quantum.experiments Abstract and Utility Imports
[docs]
class ResonatorSpectroscopy(ScheduleQubitNode):
"""
Execution node for performing Resonator Spectroscopy.
Inherits from ScheduleNode to automatically leverage ActiveSession for
hardware and datastore state, injecting keywords and sample spaces
into the measurement schedule.
"""
measurement_cls = ResonatorSpectroscopyMeasurement
analysis_cls = ResonatorSpectroscopyAnalysis
# Type hinting for strict Pydantic parameter enforcement
parameters: ResonatorSpectroscopyParameters
def __init__(
self,
parameters: ResonatorSpectroscopyParameters,
# Allow this to be optional or have a default if you instantiate it directly in the execution script
qoi_cls: type[
ResonatorSpectroscopyBaseQOI
] = ResonatorSpectroscopyBaseQOI, # TODO: this we may want to remove (the default)
):
"""
Initializes the resonator spectroscopy node.
Args:
parameters: Validated experimental parameters.
qoi_cls: The QOI class used to store results.
"""
super().__init__(
parameters=parameters,
qoi_cls=qoi_cls,
)
# Define static keywords to be passed to the schedule function
self.schedule_keywords = {
"readout_state": self.parameters.readout_state,
"repetitions": self.parameters.repetitions,
}
self.schedule_samplespace = {
"ro_frequencies": {
qubit: resonator_samples(
qubit,
state=self.parameters_by_qubit[qubit].readout_state,
samples=self.parameters_by_qubit[qubit].samples,
half_width=self.parameters_by_qubit[qubit].half_width,
)
for qubit in self.all_qubits
}
}