From ca7755cc00d975777bda1eb9ed44d2205d458eb2 Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:33:33 +0400 Subject: [PATCH 01/30] Deepcopying globally-defined variable --- src/qibocal/auto/operation.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qibocal/auto/operation.py b/src/qibocal/auto/operation.py index 81945f14a..97522f6d4 100644 --- a/src/qibocal/auto/operation.py +++ b/src/qibocal/auto/operation.py @@ -1,3 +1,4 @@ +from copy import deepcopy import inspect import json import time @@ -87,10 +88,11 @@ def load(cls, parameters): the linked outputs """ - for parameter, value in DEFAULT_PARENT_PARAMETERS.items(): - DEFAULT_PARENT_PARAMETERS[parameter] = parameters.pop(parameter, value) + default_parent_parameters = deepcopy(DEFAULT_PARENT_PARAMETERS) + for parameter, value in default_parent_parameters.items(): + default_parent_parameters[parameter] = parameters.pop(parameter, value) instantiated_class = cls(**parameters) - for parameter, value in DEFAULT_PARENT_PARAMETERS.items(): + for parameter, value in default_parent_parameters.items(): setattr(instantiated_class, parameter, value) return instantiated_class From da7564764c80745a0c5597904490799e708c45ff Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:37:51 +0400 Subject: [PATCH 02/30] Reading unspecified platform parameters from qibolab runcard --- src/qibocal/auto/task.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index ce82fad36..80f3b0a48 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -21,6 +21,7 @@ DummyPars, Qubits, QubitsPairs, + Parameters, Results, Routine, dummy_operation, @@ -133,6 +134,16 @@ def run( ): completed = Completed(self, Normal(), folder) task_qubits = self._allocate_local_qubits(qubits, platform) + + # get parent and child class data_members + parameters_keys = set(self.operation.parameters_type.__dict__["__annotations__"].keys()) | set(Parameters.__dict__["__annotations__"].keys()) + # read all settings defined in platform-specific qibolab runcard + for setting, value in platform.settings.__dict__.items(): + # save values non defined in qibocal runcard, + # but that are used by the class + if setting not in self.action.parameters: + if setting in parameters_keys: + self.action.parameters[setting] = value try: operation: Routine = self.operation From 33ac61f7e95c06842c0377abcd6f43633f898e97 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:26:02 +0000 Subject: [PATCH 03/30] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/qibocal/auto/operation.py | 2 +- src/qibocal/auto/task.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/qibocal/auto/operation.py b/src/qibocal/auto/operation.py index 97522f6d4..8e58923b4 100644 --- a/src/qibocal/auto/operation.py +++ b/src/qibocal/auto/operation.py @@ -1,7 +1,7 @@ -from copy import deepcopy import inspect import json import time +from copy import deepcopy from dataclasses import asdict, dataclass from functools import wraps from typing import Callable, Generic, NewType, Optional, TypeVar, Union diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index 80f3b0a48..772dfd5a6 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -19,9 +19,9 @@ RESULTSFILE, Data, DummyPars, + Parameters, Qubits, QubitsPairs, - Parameters, Results, Routine, dummy_operation, @@ -134,12 +134,14 @@ def run( ): completed = Completed(self, Normal(), folder) task_qubits = self._allocate_local_qubits(qubits, platform) - + # get parent and child class data_members - parameters_keys = set(self.operation.parameters_type.__dict__["__annotations__"].keys()) | set(Parameters.__dict__["__annotations__"].keys()) + parameters_keys = set( + self.operation.parameters_type.__dict__["__annotations__"].keys() + ) | set(Parameters.__dict__["__annotations__"].keys()) # read all settings defined in platform-specific qibolab runcard for setting, value in platform.settings.__dict__.items(): - # save values non defined in qibocal runcard, + # save values non defined in qibocal runcard, # but that are used by the class if setting not in self.action.parameters: if setting in parameters_keys: From e05c3831ebf4cf88e9b92c309cbd8b44ae58ea61 Mon Sep 17 00:00:00 2001 From: Gabriele Palazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:33:51 +0100 Subject: [PATCH 04/30] Update src/qibocal/auto/task.py Co-authored-by: Andrea Pasquale --- src/qibocal/auto/task.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index 772dfd5a6..3ea8c8efd 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -135,17 +135,11 @@ def run( completed = Completed(self, Normal(), folder) task_qubits = self._allocate_local_qubits(qubits, platform) - # get parent and child class data_members - parameters_keys = set( - self.operation.parameters_type.__dict__["__annotations__"].keys() - ) | set(Parameters.__dict__["__annotations__"].keys()) - # read all settings defined in platform-specific qibolab runcard - for setting, value in platform.settings.__dict__.items(): - # save values non defined in qibocal runcard, - # but that are used by the class - if setting not in self.action.parameters: - if setting in parameters_keys: - self.action.parameters[setting] = value + if self.parameters.nshots is None: + self.parameters.nshots = platform.settings.nshots + + if self.parameters.relaxation_time is None: + self.parameters.relaxation_time = platform.settings.relaxation_time try: operation: Routine = self.operation From c3f4436fea34a9b268b83f274521673e5a2c2d8c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:34:27 +0000 Subject: [PATCH 05/30] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/qibocal/auto/task.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index 3ea8c8efd..d1c7212cb 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -19,7 +19,6 @@ RESULTSFILE, Data, DummyPars, - Parameters, Qubits, QubitsPairs, Results, From 9ad00059627c161b0b5c05f9c5892d379ce0aaf7 Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Wed, 1 Nov 2023 16:41:49 +0400 Subject: [PATCH 06/30] Added rabi amplitude without nshots --- tests/runcards/protocols.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/runcards/protocols.yml b/tests/runcards/protocols.yml index f0efa80f0..b9f35b902 100644 --- a/tests/runcards/protocols.yml +++ b/tests/runcards/protocols.yml @@ -186,6 +186,15 @@ actions: pulse_length: 30 nshots: 1024 + - id: rabi without nshots + priority: 0 + operation: rabi_amplitude + parameters: + min_amp_factor: 0.0 + max_amp_factor: 4.0 + step_amp_factor: 0.1 + pulse_length: 30 + - id: rabi msr priority: 0 operation: rabi_amplitude_msr From 52c50b228d6aa65f69a93c0a41dbc347fb33cf51 Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Wed, 1 Nov 2023 17:41:41 +0400 Subject: [PATCH 07/30] deepcopying Parameters.load inputs --- src/qibocal/auto/operation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qibocal/auto/operation.py b/src/qibocal/auto/operation.py index 8e58923b4..00ef0529f 100644 --- a/src/qibocal/auto/operation.py +++ b/src/qibocal/auto/operation.py @@ -74,7 +74,7 @@ class Parameters: """Wait time for the qubit to decohere back to the `gnd` state""" @classmethod - def load(cls, parameters): + def load(cls, input_parameters): """Load parameters from runcard. Possibly looking into previous steps outputs. @@ -89,6 +89,7 @@ def load(cls, parameters): """ default_parent_parameters = deepcopy(DEFAULT_PARENT_PARAMETERS) + parameters = deepcopy(input_parameters) for parameter, value in default_parent_parameters.items(): default_parent_parameters[parameter] = parameters.pop(parameter, value) instantiated_class = cls(**parameters) From 38b630976e613f63a2794f41535e2edb6c15f4e5 Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Wed, 1 Nov 2023 17:42:24 +0400 Subject: [PATCH 08/30] Edoardo's solution --- src/qibocal/auto/task.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index d1c7212cb..e0323f698 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -19,6 +19,7 @@ RESULTSFILE, Data, DummyPars, + Parameters, Qubits, QubitsPairs, Results, @@ -134,12 +135,20 @@ def run( completed = Completed(self, Normal(), folder) task_qubits = self._allocate_local_qubits(qubits, platform) - if self.parameters.nshots is None: - self.parameters.nshots = platform.settings.nshots - - if self.parameters.relaxation_time is None: - self.parameters.relaxation_time = platform.settings.relaxation_time - + # if self.parameters.nshots is None: + # self.parameters.nshots = platform.settings.nshots + # if self.parameters.relaxation_time is None: + # self.parameters.relaxation_time = platform.settings.relaxation_time + + parameters_keys = set( + self.operation.parameters_type.__dict__["__annotations__"].keys() + ) | set(Parameters.__dict__["__annotations__"].keys()) + # read all settings defined in platform-specific qibolab runcard + for setting in parameters_keys: + if setting not in self.action.parameters: + if hasattr(platform.settings, setting): + self.action.parameters[setting]=getattr(platform.settings, setting) + try: operation: Routine = self.operation parameters = self.parameters From c0d86de028dc47633e3ad0ff48d96d1ecfe6de85 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:43:15 +0000 Subject: [PATCH 09/30] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/qibocal/auto/task.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index e0323f698..456503d65 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -139,7 +139,7 @@ def run( # self.parameters.nshots = platform.settings.nshots # if self.parameters.relaxation_time is None: # self.parameters.relaxation_time = platform.settings.relaxation_time - + parameters_keys = set( self.operation.parameters_type.__dict__["__annotations__"].keys() ) | set(Parameters.__dict__["__annotations__"].keys()) @@ -147,8 +147,10 @@ def run( for setting in parameters_keys: if setting not in self.action.parameters: if hasattr(platform.settings, setting): - self.action.parameters[setting]=getattr(platform.settings, setting) - + self.action.parameters[setting] = getattr( + platform.settings, setting + ) + try: operation: Routine = self.operation parameters = self.parameters From 4146508817556452db788ea12b0ba26efa0ffb33 Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Wed, 1 Nov 2023 17:52:52 +0400 Subject: [PATCH 10/30] Revert to Andrea's solution --- src/qibocal/auto/task.py | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index 456503d65..4ce7e01d0 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -135,22 +135,11 @@ def run( completed = Completed(self, Normal(), folder) task_qubits = self._allocate_local_qubits(qubits, platform) - # if self.parameters.nshots is None: - # self.parameters.nshots = platform.settings.nshots - # if self.parameters.relaxation_time is None: - # self.parameters.relaxation_time = platform.settings.relaxation_time - - parameters_keys = set( - self.operation.parameters_type.__dict__["__annotations__"].keys() - ) | set(Parameters.__dict__["__annotations__"].keys()) - # read all settings defined in platform-specific qibolab runcard - for setting in parameters_keys: - if setting not in self.action.parameters: - if hasattr(platform.settings, setting): - self.action.parameters[setting] = getattr( - platform.settings, setting - ) - + if self.parameters.nshots is None: + self.parameters.nshots = platform.settings.nshots + if self.parameters.relaxation_time is None: + self.parameters.relaxation_time = platform.settings.relaxation_time + try: operation: Routine = self.operation parameters = self.parameters From e968e746150461a33fc0e82ee36a871ed6147d95 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:54:59 +0000 Subject: [PATCH 11/30] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/qibocal/auto/task.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index 4ce7e01d0..d4e9e8369 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -19,7 +19,6 @@ RESULTSFILE, Data, DummyPars, - Parameters, Qubits, QubitsPairs, Results, @@ -139,7 +138,7 @@ def run( self.parameters.nshots = platform.settings.nshots if self.parameters.relaxation_time is None: self.parameters.relaxation_time = platform.settings.relaxation_time - + try: operation: Routine = self.operation parameters = self.parameters From 322a4dc43f8415de652f40428dc922c1b49c1d14 Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Wed, 1 Nov 2023 18:31:30 +0400 Subject: [PATCH 12/30] Not directly calling self.parameters in assignments --- src/qibocal/auto/task.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index d4e9e8369..aa3a1d90a 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -135,9 +135,9 @@ def run( task_qubits = self._allocate_local_qubits(qubits, platform) if self.parameters.nshots is None: - self.parameters.nshots = platform.settings.nshots + self.action.parameters["nshots"] = platform.settings.nshots if self.parameters.relaxation_time is None: - self.parameters.relaxation_time = platform.settings.relaxation_time + self.action.parameters["relaxation_time"] = platform.settings.relaxation_time try: operation: Routine = self.operation From b4063b7bfa40690aa9c1d149c3b00f7da32d0b99 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:31:54 +0000 Subject: [PATCH 13/30] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/qibocal/auto/task.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index aa3a1d90a..a1e644286 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -137,7 +137,9 @@ def run( if self.parameters.nshots is None: self.action.parameters["nshots"] = platform.settings.nshots if self.parameters.relaxation_time is None: - self.action.parameters["relaxation_time"] = platform.settings.relaxation_time + self.action.parameters[ + "relaxation_time" + ] = platform.settings.relaxation_time try: operation: Routine = self.operation From ee5d2ec6e3a1ccd6e786acb99957a8a7b45c33db Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Fri, 3 Nov 2023 12:03:22 +0400 Subject: [PATCH 14/30] Moved default params acquisition into the try block --- src/qibocal/auto/task.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index a1e644286..0fe717845 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -134,14 +134,14 @@ def run( completed = Completed(self, Normal(), folder) task_qubits = self._allocate_local_qubits(qubits, platform) - if self.parameters.nshots is None: - self.action.parameters["nshots"] = platform.settings.nshots - if self.parameters.relaxation_time is None: - self.action.parameters[ - "relaxation_time" - ] = platform.settings.relaxation_time - try: + if self.parameters.nshots is None: + print(self.action) + self.action.parameters["nshots"] = platform.settings.nshots + if self.parameters.relaxation_time is None: + self.action.parameters[ + "relaxation_time" + ] = platform.settings.relaxation_time operation: Routine = self.operation parameters = self.parameters except RuntimeError: From 80d6a5fc97f733e8845ae4f6ab0af30c49d8159a Mon Sep 17 00:00:00 2001 From: Gabriele Palazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Fri, 3 Nov 2023 16:45:05 +0100 Subject: [PATCH 15/30] Update src/qibocal/auto/task.py Co-authored-by: Edoardo Pedicillo --- src/qibocal/auto/task.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index 0fe717845..c4a700182 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -136,7 +136,6 @@ def run( try: if self.parameters.nshots is None: - print(self.action) self.action.parameters["nshots"] = platform.settings.nshots if self.parameters.relaxation_time is None: self.action.parameters[ From 1a71b7c2294f0f61be1d5404f0f3fdd5d25b4b42 Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:33:33 +0400 Subject: [PATCH 16/30] Deepcopying globally-defined variable --- src/qibocal/auto/operation.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qibocal/auto/operation.py b/src/qibocal/auto/operation.py index 81945f14a..97522f6d4 100644 --- a/src/qibocal/auto/operation.py +++ b/src/qibocal/auto/operation.py @@ -1,3 +1,4 @@ +from copy import deepcopy import inspect import json import time @@ -87,10 +88,11 @@ def load(cls, parameters): the linked outputs """ - for parameter, value in DEFAULT_PARENT_PARAMETERS.items(): - DEFAULT_PARENT_PARAMETERS[parameter] = parameters.pop(parameter, value) + default_parent_parameters = deepcopy(DEFAULT_PARENT_PARAMETERS) + for parameter, value in default_parent_parameters.items(): + default_parent_parameters[parameter] = parameters.pop(parameter, value) instantiated_class = cls(**parameters) - for parameter, value in DEFAULT_PARENT_PARAMETERS.items(): + for parameter, value in default_parent_parameters.items(): setattr(instantiated_class, parameter, value) return instantiated_class From bf2ecb2e490a958086c0e4f609b2221d4295a2e5 Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:37:51 +0400 Subject: [PATCH 17/30] Reading unspecified platform parameters from qibolab runcard --- src/qibocal/auto/task.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index ce82fad36..80f3b0a48 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -21,6 +21,7 @@ DummyPars, Qubits, QubitsPairs, + Parameters, Results, Routine, dummy_operation, @@ -133,6 +134,16 @@ def run( ): completed = Completed(self, Normal(), folder) task_qubits = self._allocate_local_qubits(qubits, platform) + + # get parent and child class data_members + parameters_keys = set(self.operation.parameters_type.__dict__["__annotations__"].keys()) | set(Parameters.__dict__["__annotations__"].keys()) + # read all settings defined in platform-specific qibolab runcard + for setting, value in platform.settings.__dict__.items(): + # save values non defined in qibocal runcard, + # but that are used by the class + if setting not in self.action.parameters: + if setting in parameters_keys: + self.action.parameters[setting] = value try: operation: Routine = self.operation From 8d7167ae3e4a5989530a029d0d2744f9abe811de Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:26:02 +0000 Subject: [PATCH 18/30] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/qibocal/auto/operation.py | 2 +- src/qibocal/auto/task.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/qibocal/auto/operation.py b/src/qibocal/auto/operation.py index 97522f6d4..8e58923b4 100644 --- a/src/qibocal/auto/operation.py +++ b/src/qibocal/auto/operation.py @@ -1,7 +1,7 @@ -from copy import deepcopy import inspect import json import time +from copy import deepcopy from dataclasses import asdict, dataclass from functools import wraps from typing import Callable, Generic, NewType, Optional, TypeVar, Union diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index 80f3b0a48..772dfd5a6 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -19,9 +19,9 @@ RESULTSFILE, Data, DummyPars, + Parameters, Qubits, QubitsPairs, - Parameters, Results, Routine, dummy_operation, @@ -134,12 +134,14 @@ def run( ): completed = Completed(self, Normal(), folder) task_qubits = self._allocate_local_qubits(qubits, platform) - + # get parent and child class data_members - parameters_keys = set(self.operation.parameters_type.__dict__["__annotations__"].keys()) | set(Parameters.__dict__["__annotations__"].keys()) + parameters_keys = set( + self.operation.parameters_type.__dict__["__annotations__"].keys() + ) | set(Parameters.__dict__["__annotations__"].keys()) # read all settings defined in platform-specific qibolab runcard for setting, value in platform.settings.__dict__.items(): - # save values non defined in qibocal runcard, + # save values non defined in qibocal runcard, # but that are used by the class if setting not in self.action.parameters: if setting in parameters_keys: From 8704ecaafe6eb20668a12f511fd28fa30d1630a9 Mon Sep 17 00:00:00 2001 From: Gabriele Palazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:33:51 +0100 Subject: [PATCH 19/30] Update src/qibocal/auto/task.py Co-authored-by: Andrea Pasquale --- src/qibocal/auto/task.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index 772dfd5a6..3ea8c8efd 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -135,17 +135,11 @@ def run( completed = Completed(self, Normal(), folder) task_qubits = self._allocate_local_qubits(qubits, platform) - # get parent and child class data_members - parameters_keys = set( - self.operation.parameters_type.__dict__["__annotations__"].keys() - ) | set(Parameters.__dict__["__annotations__"].keys()) - # read all settings defined in platform-specific qibolab runcard - for setting, value in platform.settings.__dict__.items(): - # save values non defined in qibocal runcard, - # but that are used by the class - if setting not in self.action.parameters: - if setting in parameters_keys: - self.action.parameters[setting] = value + if self.parameters.nshots is None: + self.parameters.nshots = platform.settings.nshots + + if self.parameters.relaxation_time is None: + self.parameters.relaxation_time = platform.settings.relaxation_time try: operation: Routine = self.operation From 6f059ac4fd252ed3e90a90177cfb42ac4c8ac70e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:34:27 +0000 Subject: [PATCH 20/30] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/qibocal/auto/task.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index 3ea8c8efd..d1c7212cb 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -19,7 +19,6 @@ RESULTSFILE, Data, DummyPars, - Parameters, Qubits, QubitsPairs, Results, From a3dc5bb7ffa19f292f43dae18fd358e6e1ca276f Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Wed, 1 Nov 2023 16:41:49 +0400 Subject: [PATCH 21/30] Added rabi amplitude without nshots --- tests/runcards/protocols.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/runcards/protocols.yml b/tests/runcards/protocols.yml index f100f6c4a..891518cac 100644 --- a/tests/runcards/protocols.yml +++ b/tests/runcards/protocols.yml @@ -214,6 +214,15 @@ actions: pulse_length: 30 nshots: 1024 + - id: rabi without nshots + priority: 0 + operation: rabi_amplitude + parameters: + min_amp_factor: 0.0 + max_amp_factor: 4.0 + step_amp_factor: 0.1 + pulse_length: 30 + - id: rabi msr priority: 0 operation: rabi_amplitude_msr From c7b68f9edabb15b8eacbf75562edc707eaa87871 Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Wed, 1 Nov 2023 17:41:41 +0400 Subject: [PATCH 22/30] deepcopying Parameters.load inputs --- src/qibocal/auto/operation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qibocal/auto/operation.py b/src/qibocal/auto/operation.py index 8e58923b4..00ef0529f 100644 --- a/src/qibocal/auto/operation.py +++ b/src/qibocal/auto/operation.py @@ -74,7 +74,7 @@ class Parameters: """Wait time for the qubit to decohere back to the `gnd` state""" @classmethod - def load(cls, parameters): + def load(cls, input_parameters): """Load parameters from runcard. Possibly looking into previous steps outputs. @@ -89,6 +89,7 @@ def load(cls, parameters): """ default_parent_parameters = deepcopy(DEFAULT_PARENT_PARAMETERS) + parameters = deepcopy(input_parameters) for parameter, value in default_parent_parameters.items(): default_parent_parameters[parameter] = parameters.pop(parameter, value) instantiated_class = cls(**parameters) From 3caada7bea15341e0638f9a9c9db74ef59d8f8aa Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Wed, 1 Nov 2023 17:42:24 +0400 Subject: [PATCH 23/30] Edoardo's solution --- src/qibocal/auto/task.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index d1c7212cb..e0323f698 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -19,6 +19,7 @@ RESULTSFILE, Data, DummyPars, + Parameters, Qubits, QubitsPairs, Results, @@ -134,12 +135,20 @@ def run( completed = Completed(self, Normal(), folder) task_qubits = self._allocate_local_qubits(qubits, platform) - if self.parameters.nshots is None: - self.parameters.nshots = platform.settings.nshots - - if self.parameters.relaxation_time is None: - self.parameters.relaxation_time = platform.settings.relaxation_time - + # if self.parameters.nshots is None: + # self.parameters.nshots = platform.settings.nshots + # if self.parameters.relaxation_time is None: + # self.parameters.relaxation_time = platform.settings.relaxation_time + + parameters_keys = set( + self.operation.parameters_type.__dict__["__annotations__"].keys() + ) | set(Parameters.__dict__["__annotations__"].keys()) + # read all settings defined in platform-specific qibolab runcard + for setting in parameters_keys: + if setting not in self.action.parameters: + if hasattr(platform.settings, setting): + self.action.parameters[setting]=getattr(platform.settings, setting) + try: operation: Routine = self.operation parameters = self.parameters From 3bbd4f7955a0ff80eeccd32b626afc8bb4f879f8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:43:15 +0000 Subject: [PATCH 24/30] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/qibocal/auto/task.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index e0323f698..456503d65 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -139,7 +139,7 @@ def run( # self.parameters.nshots = platform.settings.nshots # if self.parameters.relaxation_time is None: # self.parameters.relaxation_time = platform.settings.relaxation_time - + parameters_keys = set( self.operation.parameters_type.__dict__["__annotations__"].keys() ) | set(Parameters.__dict__["__annotations__"].keys()) @@ -147,8 +147,10 @@ def run( for setting in parameters_keys: if setting not in self.action.parameters: if hasattr(platform.settings, setting): - self.action.parameters[setting]=getattr(platform.settings, setting) - + self.action.parameters[setting] = getattr( + platform.settings, setting + ) + try: operation: Routine = self.operation parameters = self.parameters From 861c385d55a612e7128ca63a95f270730211d076 Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Wed, 1 Nov 2023 17:52:52 +0400 Subject: [PATCH 25/30] Revert to Andrea's solution --- src/qibocal/auto/task.py | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index 456503d65..4ce7e01d0 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -135,22 +135,11 @@ def run( completed = Completed(self, Normal(), folder) task_qubits = self._allocate_local_qubits(qubits, platform) - # if self.parameters.nshots is None: - # self.parameters.nshots = platform.settings.nshots - # if self.parameters.relaxation_time is None: - # self.parameters.relaxation_time = platform.settings.relaxation_time - - parameters_keys = set( - self.operation.parameters_type.__dict__["__annotations__"].keys() - ) | set(Parameters.__dict__["__annotations__"].keys()) - # read all settings defined in platform-specific qibolab runcard - for setting in parameters_keys: - if setting not in self.action.parameters: - if hasattr(platform.settings, setting): - self.action.parameters[setting] = getattr( - platform.settings, setting - ) - + if self.parameters.nshots is None: + self.parameters.nshots = platform.settings.nshots + if self.parameters.relaxation_time is None: + self.parameters.relaxation_time = platform.settings.relaxation_time + try: operation: Routine = self.operation parameters = self.parameters From 13c3307ff80b697cdacc67ad0cc93570fbcc9551 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:54:59 +0000 Subject: [PATCH 26/30] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/qibocal/auto/task.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index 4ce7e01d0..d4e9e8369 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -19,7 +19,6 @@ RESULTSFILE, Data, DummyPars, - Parameters, Qubits, QubitsPairs, Results, @@ -139,7 +138,7 @@ def run( self.parameters.nshots = platform.settings.nshots if self.parameters.relaxation_time is None: self.parameters.relaxation_time = platform.settings.relaxation_time - + try: operation: Routine = self.operation parameters = self.parameters From 5d95f7bb65cd08fdf1a64c4cbc5a94e4ca0978eb Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Wed, 1 Nov 2023 18:31:30 +0400 Subject: [PATCH 27/30] Not directly calling self.parameters in assignments --- src/qibocal/auto/task.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index d4e9e8369..aa3a1d90a 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -135,9 +135,9 @@ def run( task_qubits = self._allocate_local_qubits(qubits, platform) if self.parameters.nshots is None: - self.parameters.nshots = platform.settings.nshots + self.action.parameters["nshots"] = platform.settings.nshots if self.parameters.relaxation_time is None: - self.parameters.relaxation_time = platform.settings.relaxation_time + self.action.parameters["relaxation_time"] = platform.settings.relaxation_time try: operation: Routine = self.operation From 41f47522365481f172d06b41fb4e20f5eb099ff8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:31:54 +0000 Subject: [PATCH 28/30] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/qibocal/auto/task.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index aa3a1d90a..a1e644286 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -137,7 +137,9 @@ def run( if self.parameters.nshots is None: self.action.parameters["nshots"] = platform.settings.nshots if self.parameters.relaxation_time is None: - self.action.parameters["relaxation_time"] = platform.settings.relaxation_time + self.action.parameters[ + "relaxation_time" + ] = platform.settings.relaxation_time try: operation: Routine = self.operation From 9564ebfa8b887e0a8c7b90d3dcf520d2e5f0a001 Mon Sep 17 00:00:00 2001 From: GabrielePalazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Fri, 3 Nov 2023 12:03:22 +0400 Subject: [PATCH 29/30] Moved default params acquisition into the try block --- src/qibocal/auto/task.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index a1e644286..0fe717845 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -134,14 +134,14 @@ def run( completed = Completed(self, Normal(), folder) task_qubits = self._allocate_local_qubits(qubits, platform) - if self.parameters.nshots is None: - self.action.parameters["nshots"] = platform.settings.nshots - if self.parameters.relaxation_time is None: - self.action.parameters[ - "relaxation_time" - ] = platform.settings.relaxation_time - try: + if self.parameters.nshots is None: + print(self.action) + self.action.parameters["nshots"] = platform.settings.nshots + if self.parameters.relaxation_time is None: + self.action.parameters[ + "relaxation_time" + ] = platform.settings.relaxation_time operation: Routine = self.operation parameters = self.parameters except RuntimeError: From b1b873803a4d19d86785db1e0b64ba95074814a3 Mon Sep 17 00:00:00 2001 From: Gabriele Palazzo <73099233+GabrielePalazzo@users.noreply.github.com> Date: Fri, 3 Nov 2023 16:45:05 +0100 Subject: [PATCH 30/30] Update src/qibocal/auto/task.py Co-authored-by: Edoardo Pedicillo --- src/qibocal/auto/task.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index 0fe717845..c4a700182 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -136,7 +136,6 @@ def run( try: if self.parameters.nshots is None: - print(self.action) self.action.parameters["nshots"] = platform.settings.nshots if self.parameters.relaxation_time is None: self.action.parameters[