qibocal.auto package#
Autocalibration runner.
Submodules#
qibocal.auto.execute module#
Tasks execution.
- class qibocal.auto.execute.Executor(actions: list[qibocal.auto.runcard.Action], history: History, output: Path, targets: Union[list[Union[str, int]], list[Tuple[Union[str, int], Union[str, int]]], list[tuple[Union[str, int], ...]]], platform: Platform, max_iterations: int, update: bool = True)[source]#
Bases:
object
Execute a tasks’ graph and tracks its history.
- actions: list[qibocal.auto.runcard.Action]#
List of actions.
- targets: Union[list[Union[str, int]], list[Tuple[Union[str, int], Union[str, int]]], list[tuple[Union[str, int], ...]]]#
Qubits/Qubit Pairs to be calibrated.
- platform: Platform#
Qubits’ platform.
- classmethod load(card: Runcard, output: Path, platform: Optional[Platform] = None, targets: Optional[Union[list[Union[str, int]], list[Tuple[Union[str, int], Union[str, int]]], list[tuple[Union[str, int], ...]]]] = None, update: bool = True)[source]#
Load execution graph and associated executor from a runcard.
qibocal.auto.history module#
Track execution history.
qibocal.auto.mode module#
qibocal.auto.operation module#
- qibocal.auto.operation.ParameterValue#
Valid value for a routine and runcard parameter.
- qibocal.auto.operation.Qubits#
Convenient way of passing qubit pairs in the routines.
- qibocal.auto.operation.DATAFILE = 'data'#
Name of the file where data are dumped.
- qibocal.auto.operation.RESULTSFILE = 'results'#
Name of the file where results are dumped.
- qibocal.auto.operation.DEFAULT_PARENT_PARAMETERS = {'nshots': None, 'relaxation_time': None}#
Default values of the parameters of Parameters
- class qibocal.auto.operation.Parameters[source]#
Bases:
object
Generic action parameters.
Implement parameters as Algebraic Data Types (similar to), by subclassing this marker in actual parameters specification for each calibration routine.
The actual parameters structure is only used inside the routines themselves.
- class qibocal.auto.operation.AbstractData(data: dtype[+_ScalarType_co]]]] = None)[source]#
Bases:
object
Abstract data class.
- class qibocal.auto.operation.Data(data: dtype[+_ScalarType_co]]]] = None)[source]#
Bases:
AbstractData
Data resulting from acquisition routine.
- property qubits#
Access qubits from data structure.
- property pairs#
Access qubit pairs ordered alphanumerically from data structure.
- class qibocal.auto.operation.Results[source]#
Bases:
AbstractData
Generic runcard update.
- class qibocal.auto.operation.Routine(acquisition: Callable[[_ParametersT], _DataT], fit: Optional[Callable[[_DataT], _ResultsT]] = None, report: Optional[Callable[[_DataT, _ResultsT], None]] = None, update: Optional[Callable[[_ResultsT, Platform], None]] = None, two_qubit_gates: Optional[bool] = False)[source]#
Bases:
Generic
[_ParametersT
,_DataT
,_ResultsT
]A wrapped calibration routine.
- two_qubit_gates: Optional[bool] = False#
Flag to determine whether to allocate list of Qubits or Pairs.
- property parameters_type#
Input parameters type.
- property data_type#
“Data object type return by data acquisition.
- property results_type#
Results object type returned by data acquisition.
- property platform_dependent#
Check if acquisition involves platform.
- property targets_dependent#
Check if acquisition involves qubits.
- class qibocal.auto.operation.DummyPars[source]#
Bases:
Parameters
Dummy parameters.
- qibocal.auto.operation.dummy_operation = Routine(acquisition=<function _dummy_acquisition>, fit=<function show_logs.<locals>.wrapper>, report=None, update=<function _dummy_update>, two_qubit_gates=False)#
Example of a dummy operation.
qibocal.auto.runcard module#
Specify runcard layout, handles (de)serialization.
- qibocal.auto.runcard.Targets#
Elements to be calibrated by a single protocol.
alias of
Union
[list
[Union
[str
,int
]],list
[Tuple
[Union
[str
,int
],Union
[str
,int
]]],list
[tuple
[Union
[str
,int
], …]]]
- qibocal.auto.runcard.MAX_ITERATIONS = 5#
Default max iterations.
- class qibocal.auto.runcard.Action(id: Id, operation: Optional[OperationId] = None, targets: Optional[Union[list[Union[str, int]], list[Tuple[Union[str, int], Union[str, int]]], list[tuple[Union[str, int], ...]]]] = None, update: bool = True, parameters: Optional[dict[str, Any]] = None)[source]#
Bases:
object
Action specification in the runcard.
- id: Id#
Action unique identifier.
- class qibocal.auto.runcard.Runcard(actions: list[qibocal.auto.runcard.Action], targets: Optional[Union[list[Union[str, int]], list[Tuple[Union[str, int], Union[str, int]]], list[tuple[Union[str, int], ...]]]] = None, backend: str = 'qibolab', platform: str = 'dummy', max_iterations: int = 5)[source]#
Bases:
object
Structure of an execution runcard.
- actions: list[qibocal.auto.runcard.Action]#
List of action to be executed.
- targets: Optional[Union[list[Union[str, int]], list[Tuple[Union[str, int], Union[str, int]]], list[tuple[Union[str, int], ...]]]] = None#
Qubits to be calibrated. If None the protocols will be executed on all qubits available in the platform.
- property backend_obj: Backend#
Allocate backend.
- property platform_obj: Platform#
Allocate platform.
qibocal.auto.serialize module#
qibocal.auto.status module#
Describe the status of a completed task.
Simple and general statuses are defined here, but more of them can be defined by individual calibrations routines, and user code as well:
class PinkFirst(Status):
'''Follow the pink arrow as the next one.'''
@dataclass
class ParametrizedException(Status):
'''Trigger exceptional workflow, passing down a further parameter.
Useful if the handler function is using some kind of threshold, or can
make somehow use of the parameter to decide, but in a way that is not
completely established, so it should not be hardcoded in the status
type.
'''
myvalue: int
@dataclass
class ExceptionWithInput(Status):
'''Pass to next routine as input.'''
routine_x_input: float
In general, statuses can encode a predetermined decision about what to do next, so the decision has been handled by the fitting function, or an open decision, that is left up to the handler function.
qibocal.auto.task module#
Action execution tracker.
- qibocal.auto.task.MAX_PRIORITY = 1000000000#
A number bigger than whatever will be manually typed. But not so insanely big not to fit in a native integer.
- qibocal.auto.task.DEFAULT_NSHOTS = 100#
Default number on shots when the platform is not provided.
- qibocal.auto.task.TaskId#
Unique identifier for executed tasks.
- qibocal.auto.task.PLATFORM_DIR = 'platform'#
Folder where platform will be dumped.
- class qibocal.auto.task.Task(action: qibocal.auto.runcard.Action, iteration: int = 0)[source]#
Bases:
object
- property targets: Union[list[Union[str, int]], list[Tuple[Union[str, int], Union[str, int]]], list[tuple[Union[str, int], ...]]]#
Protocol targets.
- property id: Id#
Task Id.
- property operation#
Routine object from Operation Enum.
- property parameters#
Inputs parameters for self.operation.
- property update#
Local update parameter.
- run(max_iterations: int, platform: ~typing.Optional[~qibolab.platform.Platform] = None, targets: ~typing.Union[list[typing.Union[str, int]], list[typing.Tuple[typing.Union[str, int], typing.Union[str, int]]], list[tuple[typing.Union[str, int], ...]]] = <class 'list'>, mode: ~typing.Optional[~qibocal.auto.mode.ExecutionMode] = None, folder: ~typing.Optional[~pathlib.Path] = None)[source]#
- class qibocal.auto.task.Completed(task: Task, folder: Path, _data: Optional[Data] = None, _results: Optional[Results] = None, data_time: float = 0, results_time: float = 0)[source]#
Bases:
object
A completed task.
- property datapath#
Path contaning data and results file for task.
- property results#
Access task’s results.
- property data#
Access task’s data.