Skip to content

Commit

Permalink
Merge pull request #596 from qiboteam/platform_default_params
Browse files Browse the repository at this point in the history
Platform default parameters read from qibolab platforms
  • Loading branch information
andrea-pasquale authored Nov 6, 2023
2 parents d0a9701 + d1dc9b5 commit 2bb8b21
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/qibocal/auto/operation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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
Expand Down Expand Up @@ -73,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.
Expand All @@ -87,10 +88,12 @@ 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)
parameters = deepcopy(input_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

Expand Down
6 changes: 6 additions & 0 deletions src/qibocal/auto/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ def run(
task_qubits = self._allocate_local_qubits(qubits, platform)

try:
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
operation: Routine = self.operation
parameters = self.parameters
except RuntimeError:
Expand Down
9 changes: 9 additions & 0 deletions tests/runcards/protocols.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2bb8b21

Please sign in to comment.