Source code for bragi_quantum.experiments.utils.measurement_utils

# ══════════════════════════════════════════════════════════════════════════
#     ___   ___ ___   _      _   ___
#    / _ \ / __|_  ) | |    /_\ | _ )
#   | (_) | (__ / /  | |__ / _ \| _ \
#    \__\_\\___/___| |____/_/ \_\___/
#
#   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
# ══════════════════════════════════════════════════════════════════════════


# This code is part of Tergite
#
# (C) Copyright Eleftherios Moschandreou 2023
# (C) Copyright Stefan Hill 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/measurement_utils.py


[docs] def reduce_samplespace(iteration: int, samplespace: dict) -> dict: reduced_samplespace = {} element_values = {} """ example of external_samplespace: external_samplespace = { 'cw_frequencies': { 'q1': np.array(4.0e9, 4.1e9, 4.2e9), 'q2': np.array(4.5e9, 4.6e9, 4.7e9), } } """ # e.g. 'cw_frequencies': external_settable = next(iter(samplespace.keys())) # elements may refer to qubits or couplers elements = samplespace[external_settable].keys() for element in elements: qubit_specific_values = samplespace[external_settable][element] current_value = qubit_specific_values[iteration] element_values[element] = current_value """ example of reduced_external_samplespace: reduced_external_samplespace = { 'cw_frequencies': { 'q1': np.array(4.2e9), 'q2': np.array(4.7e9), } } """ reduced_samplespace[external_settable] = element_values return reduced_samplespace