Source code for bragi_quantum.datalayer.models.coupler

# ══════════════════════════════════════════════════════════════════════════
#     ___   ___ ___   _      _   ___
#    / _ \ / __|_  ) | |    /_\ | _ )
#   | (_) | (__ / /  | |__ / _ \| _ \
#    \__\_\\___/___| |____/_/ \_\___/
#
#   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
#   Joel Sandås, joel.sandas@chalmers.se
# ══════════════════════════════════════════════════════════════════════════


# This code is part of Tergite
#
# (C) Copyright Eleftherios Moschandreou 2023, 2024
# (C) Copyright Liangyu Chen 2023, 2024
#
# 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/utils/dto/extended_coupler_edge.py


from typing import Literal, override

from qblox_scheduler.backends.graph_compilation import OperationCompilationConfig
from qblox_scheduler.device_under_test.edge import Edge
from qblox_scheduler.structure.model import Numbers, Parameter, SchedulerSubmodule

from bragi_quantum.datalayer.models.pulses import parametric_cz_soft_square_pulse


[docs] class ParametricCZSubmodule(SchedulerSubmodule): """Submodule containing parameters for performing a CZ operation.""" square_amp: float = Parameter( docstring=r"""Amplitude of the square envelope.""", unit="fullscale", initial_value=0.5, vals=Numbers(min_value=0, max_value=1e12, allow_nan=True), ) square_duration: float = Parameter( docstring=r"""The square pulse duration in seconds.""", unit="s", initial_value=2e-8, vals=Numbers(min_value=0, max_value=1e12, allow_nan=True), ) cz_freq: float = Parameter( docstring=r"""Frequency of the CZ pulse.""", unit="Hz", initial_value=float("nan"), vals=Numbers(min_value=0.0, max_value=1e9, allow_nan=True), ) control_phase_correction: float = Parameter( docstring=r"""The phase correction for the control qubit after the square pulse operation has been performed.""", unit="degrees", initial_value=0.0, vals=Numbers(min_value=-1e12, max_value=1e12, allow_nan=True), ) target_phase_correction: float = Parameter( docstring=r"""The phase correction for the target qubit after the square pulse operation has been performed.""", unit="degrees", initial_value=0.0, vals=Numbers(min_value=-1e12, max_value=1e12, allow_nan=True), )
[docs] class ExtendedCompositeSquareEdge(Edge): edge_type: Literal["ExtendedCompositeSquareEdge"] = "ExtendedCompositeSquareEdge" cz: ParametricCZSubmodule
[docs] @override def generate_edge_config(self) -> dict[str, dict[str, OperationCompilationConfig]]: edge_op_config = { self.name: { "parametric_cz": OperationCompilationConfig( factory_func=parametric_cz_soft_square_pulse, factory_kwargs={ "square_port": self.name + ":fl", "square_clock": self.name + ".cz", "square_amp": self.cz.square_amp, "square_duration": self.cz.square_duration, "cz_pulse_frequency": self.cz.cz_freq, "virt_z_control_qubit_phase": self.cz.control_phase_correction, "virt_z_control_qubit_clock": f"{self.parent_element_name}.01", "virt_z_target_qubit_phase": self.cz.target_phase_correction, "virt_z_target_qubit_clock": f"{self.child_element_name}.01", }, ), } } return edge_op_config