Source code for bragi_quantum.experiments.nodes.coupler.cz_parametrization.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
#   Joel Sandås, joel.sandas@chalmers.se
#   Matteo Robbiati, robbiati@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 CZParametrizationFixDurationParameters(BaseParameters): """ Parameters for CZ parametrization with a fixed pulse duration. Tests a candidate CZ working-point current by sweeping the coupler's flux pulse frequency and amplitude (duration held fixed) to find whether a usable |11>-|20> (or |11>-|02>) avoided crossing exists there. Ported from tergite-autocalibration (CZParametrizationFixDurationNode). """ repetitions: int = acquisition_field( default=1024, description="Repetitions (averages) per point." ) # Frequency sweep (Hz), centered on each coupler's CZ transition frequency # (computed from the qubits' calibrated 01/12 clock frequencies). frequency_sweep: float = acquisition_field( default=15e6, description="Half-width (Hz) of the CZ pulse frequency sweep." ) frequency_bins: int = acquisition_field( default=20, description="Number of frequency points." ) # Amplitude sweep (fullscale) of the CZ flux pulse. amplitude_min: float = acquisition_field( default=0.0, ge=-1, le=1, description="Start of the amplitude sweep (fullscale).", ) amplitude_max: float = acquisition_field( default=0.5, ge=-1, le=1, description="End of the amplitude sweep (fullscale); capped at 0.70 to stay " "under the AWG gain limit.", ) amplitude_bins: int = acquisition_field( default=15, description="Number of amplitude points." ) # CZ pulse duration, fixed for this parametrization scan. cz_pulse_duration: float = acquisition_field( default=100e-9, description="Duration of the CZ flux pulse (s)." ) # Which avoided crossing the CZ pulse targets: "20" drives the first # qubit of the coupler (by name order) towards |2>, the second towards # |0>; "02" is the reverse. cz_transition: str = acquisition_field( default="20", description="Targeted transition: '20' or '02'." ) cz_half_frequency_wp: bool = acquisition_field( default=False, description="Center the frequency sweep at half the computed CZ " "transition frequency, for couplers operated at a half-frequency " "working point.", ) # Informational only: the DC current the coupler is currently parked at # when this scan runs (set by a previous cz_currents_from_spectroscopies # run). Not applied to hardware by this node. parking_current: float = Field( default=0.0, description="Coupler DC parking current (A), for plot labels only." ) # Flux-line IF/LO scheme: the CZ pulse clock is programmed at # -frequency + downconvert_frequency. Hardware-wiring specific; override # per coupler via custom_parameters for lines with a different LO setup. downconvert_frequency: float = Field( default=4.4e9, description="Flux-line downconversion offset (Hz)." ) # SPI-rack safety limit — do not change casually. max_transition_frequency: float = Field( default=1e9, description="Couplers whose computed transition frequency exceeds " "this (Hz) are skipped entirely.", )
[docs] class CZParametrizationFixDurationQOI(BaseQoi): """ Quantities of Interest for CZ parametrization on one coupler: the (frequency, amplitude) working point found, and a quality score for ranking candidate parking currents against each other. """ cz_pulse_frequency: float = 0.0 cz_pulse_frequency_error: float = 0.0 cz_pulse_amplitude: float = 0.0 cz_pulse_amplitude_error: float = 0.0 cz_parametrization_transition_quality: float = 0.0
[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: return { "cz.cz_freq": self.cz_pulse_frequency, "cz.square_amp": self.cz_pulse_amplitude, "cz_parametrization_transition_quality": self.cz_parametrization_transition_quality, }
[docs] def to_redis_dict(self) -> dict[str, dict]: # "cz:cz_freq" / "cz:square_amp" follow the device 'submodule:field' # convention so BaseNode._apply_qoi_to_device writes them straight # onto the coupler edge's ParametricCZSubmodule. return { "cz:cz_freq": { "value": self.cz_pulse_frequency, "error": self.cz_pulse_frequency_error, }, "cz:square_amp": { "value": self.cz_pulse_amplitude, "error": self.cz_pulse_amplitude_error, }, "cz_parametrization_transition_quality": { "value": self.cz_parametrization_transition_quality, "error": 0.0, }, }