# ══════════════════════════════════════════════════════════════════════════
# ___ ___ ___ _ _ ___
# / _ \ / __|_ ) | | /_\ | _ )
# | (_) | (__ / / | |__ / _ \| _ \
# \__\_\\___/___| |____/_/ \_\___/
#
# 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
# ══════════════════════════════════════════════════════════════════════════
from typing import override
from pydantic import Field
from bragi_quantum.experiments.abstract.parameter_fields import acquisition_field
from bragi_quantum.experiments.abstract.parameters import (
BaseParameters,
BaseQoi,
)
[docs]
class ROFrequencyOptimizationParameters(BaseParameters):
"""Parameters for readout-frequency optimization nodes."""
# All data acquisition — sweep sizing / averaging.
samples: int | None = acquisition_field(
default=100, description="Number of readout-frequency samples."
)
half_width: float | None = acquisition_field(
default=1.0e6, description="Half-width of the frequency sweep window in Hz."
)
repetitions: int = acquisition_field(
default=1024, description="Number of repetitions (averages) per point."
)
[docs]
class ROTwoStateFrequencyOptimizationQOI(BaseQoi):
"""Quantities of Interest for the readout 2-state frequency optimization."""
frequency: float = Field(default=0.0)
[docs]
@override
def to_dict(self) -> dict[str, float]:
return {"extended_clock_freqs.readout_2state_opt": self.frequency}
[docs]
def to_redis_dict(self) -> dict[str, dict[str, float]]:
return {
"extended_clock_freqs:readout_2state_opt": {
"value": self.frequency,
"error": 0.0,
}
}
[docs]
class ROThreeStateFrequencyOptimizationQOI(BaseQoi):
"""Quantities of Interest for the readout 3-state frequency optimization."""
frequency: float = Field(default=0.0)
[docs]
@override
def to_dict(self) -> dict[str, float]:
return {"extended_clock_freqs.readout_3state_opt": self.frequency}
[docs]
def to_redis_dict(self) -> dict[str, dict[str, float]]:
return {
"extended_clock_freqs:readout_3state_opt": {
"value": self.frequency,
"error": 0.0,
}
}