qibocal package#

qibocal: Quantum Calibration Verification and Validation using Qibo.

class qibocal.Executor(history: History, targets: Union[list[Union[str, int]], list[Tuple[Union[str, int], Union[str, int]]], list[tuple[Union[str, int], ...]]], platform: Platform, update: bool = True, name: Optional[str] = None, path: Optional[Path] = None, meta: Optional[Metadata] = None)[source]#

Bases: object

Execute a tasks’ graph and tracks its history.

history: History#

The execution history, with results and exit states.

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.

update: bool = True#

Runcard update mechanism.

name: Optional[str] = None#

Symbol for the executor.

This can be used generically to distinguish the executor, but its specific use is to register a module with this name in sys.modules. They can contain dots, ., that are interpreted as usual by the Python module system.

Note

As a special case, mainly used for internal purposes, names starting with . are also allowed, and they are interpreted relative to this package (in the top scope).

path: Optional[Path] = None#
meta: Optional[Metadata] = None#
classmethod create(name: str, platform: Optional[Union[Platform, str]] = None)[source]#

Load list of protocols.

run_protocol(protocol: ~qibocal.auto.operation.Routine, parameters: ~qibocal.auto.task.Action, mode: ~qibocal.auto.mode.ExecutionMode = ExecutionMode.None) Completed[source]#

Run single protocol in ExecutionMode mode.

_wrapped_protocol(protocol: Routine, operation: str)[source]#

Create a bound protocol.

Returns a closure, already wrapping the current Executor instance, but specific to the protocol chosen. The parameters of this wrapper function maps to protocol’s ones, in particular:

  • the keyword argument mode is used as the execution mode (defaults to AUTOCALIBRATION)

  • the keyword argument id is used as the id for the given operation (defaults to protocol identifier, the same used to import and invoke it)

then the protocol specific are resolved, with the following priority:

  • explicit keyword arguments have the highest priorities

  • items in the dictionary passed with the keyword parameters

  • positional arguments, which are associated to protocols parameters in the same order in which they are defined (and documented) in their respective parameters classes

Attention

Despite the priority being clear, it is advised to use only one of the former schemes to pass parameters, to avoid confusion due to unexpected overwritten arguments.

E.g. for:

resonator_spectroscopy(1e7, 1e5, freq_width=1e8)

the freq_width will be 1e8, and 1e7 will be silently overwritten and ignored (as opposed to a regular Python function, where a TypeError would be raised).

The priority defined above is strictly and silently respected, so just pay attention during invocations.

unload()[source]#

Unlist the executor from available modules.

init(path: PathLike, force: bool = False, platform: Optional[Union[Platform, str]] = None, update: Optional[bool] = None, targets: Optional[Union[list[Union[str, int]], list[Tuple[Union[str, int], Union[str, int]]], list[tuple[Union[str, int], ...]]]] = None)[source]#

Initialize execution.

close(path: Optional[PathLike] = None)[source]#

Close execution.

classmethod open(name: str, path: PathLike, force: bool = False, platform: Optional[Union[Platform, str]] = None, update: Optional[bool] = None, targets: Optional[Union[list[Union[str, int]], list[Tuple[Union[str, int], Union[str, int]]], list[tuple[Union[str, int], ...]]]] = None)[source]#

Enter the execution context.

Subpackages#

Submodules#

qibocal.config module#

Custom logger implemenation.

qibocal.config.raise_error(exception, message=None, args=None)[source]#

Raise exception with logging error.

Parameters:
  • exception (Exception) – python exception.

  • message (str) – the error message.

class qibocal.config.CustomHandler[source]#

Bases: StreamHandler

Custom handler for logging algorithm.

format(record)[source]#

Format the record with specific format.

_at_fork_reinit()#
acquire()#

Acquire the I/O thread lock.

addFilter(filter)#

Add the specified filter to this handler.

close()#

Tidy up any resources used by the handler.

This version removes the handler from an internal map of handlers, _handlers, which is used for handler lookup by name. Subclasses should ensure that this gets called from overridden close() methods.

createLock()#

Acquire a thread lock for serializing access to the underlying I/O.

emit(record)#

Emit a record.

If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ‘encoding’ attribute, it is used to determine how to do the output to the stream.

filter(record)#

Determine if a record is loggable by consulting all the filters.

The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero.

Changed in version 3.2: Allow filters to be just callables.

flush()#

Flushes the stream.

get_name()#
handle(record)#

Conditionally emit the specified logging record.

Emission depends on filters which may have been added to the handler. Wrap the actual emission of the record with acquisition/release of the I/O thread lock. Returns whether the filter passed the record for emission.

handleError(record)#

Handle errors which occur during an emit() call.

This method should be called from handlers when an exception is encountered during an emit() call. If raiseExceptions is false, exceptions get silently ignored. This is what is mostly wanted for a logging system - most users will not care about errors in the logging system, they are more interested in application errors. You could, however, replace this with a custom handler if you wish. The record which was being processed is passed in to this method.

property name#
release()#

Release the I/O thread lock.

removeFilter(filter)#

Remove the specified filter from this handler.

setFormatter(fmt)#

Set the formatter for this handler.

setLevel(level)#

Set the logging level of this handler. level must be an int or a str.

setStream(stream)#

Sets the StreamHandler’s stream to the specified value, if it is different.

Returns the old stream, if the stream was changed, or None if it wasn’t.

set_name(name)#
terminator = '\n'#

qibocal.update module#

Helper functions to update parameters in platform.

qibocal.update.readout_frequency(freq: float, platform: Platform, qubit: Union[str, int])[source]#

Update readout frequency value in platform for specific qubit.

qibocal.update.bare_resonator_frequency(freq: float, platform: Platform, qubit: Union[str, int])[source]#

Update rbare frequency value in platform for specific qubit.

qibocal.update.readout_amplitude(amp: float, platform: Platform, qubit: Union[str, int])[source]#

Update readout amplitude value in platform for specific qubit.

qibocal.update.readout_attenuation(att: int, platform: Platform, qubit: Union[str, int])[source]#

Update readout attenuation value in platform for specific qubit.

qibocal.update.drive_frequency(freq: Union[float, tuple, list], platform: Platform, qubit: Union[str, int])[source]#

Update drive frequency value in platform for specific qubit.

qibocal.update.drive_amplitude(amp: Union[float, tuple, list], platform: Platform, qubit: Union[str, int])[source]#

Update drive frequency value in platform for specific qubit.

qibocal.update.drive_duration(duration: Union[int, tuple, list], platform: Platform, qubit: Union[str, int])[source]#

Update drive duration value in platform for specific qubit.

qibocal.update.crosstalk_matrix(matrix_element: float, platform: Platform, qubit: Union[str, int], flux_qubit: Union[str, int])[source]#

Update crosstalk_matrix element.

qibocal.update.iq_angle(angle: float, platform: Platform, qubit: Union[str, int])[source]#

Update iq angle value in platform for specific qubit.

qibocal.update.threshold(threshold: float, platform: Platform, qubit: Union[str, int])[source]#
qibocal.update.mean_gnd_states(gnd_state: list, platform: Platform, qubit: Union[str, int])[source]#

Update mean ground state value in platform for specific qubit.

qibocal.update.mean_exc_states(exc_state: list, platform: Platform, qubit: Union[str, int])[source]#

Update mean excited state value in platform for specific qubit.

qibocal.update.readout_fidelity(fidelity: float, platform: Platform, qubit: Union[str, int])[source]#

Update fidelity of single shot classification.

qibocal.update.assignment_fidelity(fidelity: float, platform: Platform, qubit: Union[str, int])[source]#

Update fidelity of single shot classification.

qibocal.update.virtual_phases(phases: dict[Union[str, int], float], native: str, platform: Platform, pair: Tuple[Union[str, int], Union[str, int]])[source]#

Update virtual phases for given qubits in pair in results.

qibocal.update.CZ_duration(duration: int, platform: Platform, pair: Tuple[Union[str, int], Union[str, int]])[source]#

Update CZ duration for specific pair.

qibocal.update.CZ_amplitude(amp: float, platform: Platform, pair: Tuple[Union[str, int], Union[str, int]])[source]#

Update CZ amplitude for specific pair.

qibocal.update.iSWAP_duration(duration: int, platform: Platform, pair: Tuple[Union[str, int], Union[str, int]])[source]#

Update iSWAP_duration duration for specific pair.

qibocal.update.iSWAP_amplitude(amp: float, platform: Platform, pair: Tuple[Union[str, int], Union[str, int]])[source]#

Update iSWAP_duration amplitude for specific pair.

qibocal.update.t1(t1: int, platform: Platform, qubit: Union[str, int])[source]#

Update t1 value in platform for specific qubit.

qibocal.update.t2(t2: int, platform: Platform, qubit: Union[str, int])[source]#

Update t2 value in platform for specific qubit.

qibocal.update.t2_spin_echo(t2_spin_echo: float, platform: Platform, qubit: Union[str, int])[source]#

Update t2 echo value in platform for specific qubit.

qibocal.update.drag_pulse_beta(beta: float, platform: Platform, qubit: Union[str, int])[source]#

Update beta parameter value in platform for specific qubit.

qibocal.update.sweetspot(sweetspot: float, platform: Platform, qubit: Union[str, int])[source]#

Update sweetspot parameter in platform for specific qubit.

qibocal.update.frequency_12_transition(frequency: int, platform: Platform, qubit: Union[str, int])[source]#
qibocal.update.drive_12_amplitude(amplitude: float, platform: Platform, qubit: Union[str, int])[source]#
qibocal.update.drive_12_duration(duration: Union[int, tuple, list], platform: Platform, qubit: Union[str, int])[source]#

Update drive duration value in platform for specific qubit.

qibocal.update.twpa_frequency(frequency: int, platform: Platform, qubit: Union[str, int])[source]#
qibocal.update.twpa_power(power: float, platform: Platform, qubit: Union[str, int])[source]#
qibocal.update.anharmonicity(anharmonicity: float, platform: Platform, qubit: Union[str, int])[source]#
qibocal.update.asymmetry(asymmetry: float, platform: Platform, qubit: Union[str, int])[source]#
qibocal.update.coupling(g: float, platform: Platform, qubit: Union[str, int])[source]#
qibocal.update.kernel(kernel: ndarray, platform: Platform, qubit: Union[str, int])[source]#

qibocal.version module#

Package version.