Source code for bragi_quantum.experiments.nodes.coupler.resonator_spectroscopy_vs_current.parameters

# ══════════════════════════════════════════════════════════════════════════
#     ___   ___ ___   _      _   ___
#    / _ \ / __|_  ) | |    /_\ | _ )
#   | (_) | (__ / /  | |__ / _ \| _ \
#    \__\_\\___/___| |____/_/ \_\___/
#
#   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
#   Abdullah-Al Amin, alamina@chalmers.se
#   Matteo Robbiati, robbiati@chalmers.se
#   Michele Faucci Giannelli, faucci@chalmers.se
# ══════════════════════════════════════════════════════════════════════════


# This code is part of Tergite
#
# (C) Copyright Eleftherios Moschandreou 2023, 2024
# (C) Copyright Michele Faucci Giannelli 2024, 2025
# (C) Copyright Stefan Hill 2024, 2025
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
#
# Modified from tergite-autocalibration
# (https://github.com/tergite/tergite-autocalibration), file:
#   tergite_autocalibration/lib/nodes/coupler/spectroscopy/node.py


from typing import override

from pydantic import Field

from bragi_quantum.experiments.abstract.parameters import BaseQoi
from bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.parameters import (
    ResonatorSpectroscopyParameters,
)


[docs] class ResonatorSpectroscopyVsCurrentParameters(ResonatorSpectroscopyParameters): """ Parameters for Resonator Spectroscopy vs coupler DC current. Extends the plain resonator spectroscopy parameters with the external DC-current sweep applied to each coupler and the thresholds used by the crossing-current detection. Ported from tergite-autocalibration (ResonatorSpectroscopyVsCurrentNode). """ # External DC-current sweep (Amps), applied per coupler via the SPI rack. min_current: float = Field( default=-1.0e-3, description="Start of the DC-current sweep in Amps." ) max_current: float = Field( default=1.0e-3, description="End (exclusive) of the DC-current sweep in Amps." ) current_step: float = Field( default=100e-6, description="Step of the DC-current sweep in Amps." ) # Crossing detection thresholds crossing_threshold: float = Field( default=30e3, description="Minimum resonator frequency jump (Hz) between consecutive " "detected points to count as a coupler crossing.", ) spurious_threshold: float = Field( default=4e3, description="Maximum frequency difference (Hz) between the neighbours of " "a missing point for it to be filled in as a spurious gap.", ) min_crossing_interval: float = Field( default=0.5e-3, description="Minimum current span (A) a group of jumps must cover before " "it is collapsed into a single crossing current.", )
[docs] class ResonatorSpectroscopyVsCurrentQOI(BaseQoi): """ Quantities of Interest for Resonator Spectroscopy vs current on one coupler. Holds, for each of the coupler's two qubits, the list of DC currents at which the coupler crosses the readout resonator. """ crossing_currents: dict[str, list[float]] = Field( default_factory=dict, description="Mapping from qubit name to the detected resonator " "crossing currents in Amps.", )
[docs] def items(self): """ Iterate like a mapping so bragi_quantum.datalayer's ``update_redis_trusted_values`` can inspect the QOI keys when routing coupler results. """ return self.to_dict().items()
[docs] @override def to_dict(self) -> dict[str, list[float]]: return { f"resonator_crossing_points_{qubit}": crossings for qubit, crossings in self.crossing_currents.items() }
[docs] def to_redis_dict(self) -> dict[str, dict[str, str]]: # Values are stored as the string repr of the list, since Redis hash # fields cannot hold Python lists. Keys deliberately contain no ':' # so they are not interpreted as device submodule fields. return { f"resonator_crossing_points_{qubit}": { "value": str([float(c) for c in crossings]), "error": 0.0, } for qubit, crossings in self.crossing_currents.items() }