qibocal package#

qibocal: Quantum Calibration Verification and Validation using Qibo.

Subpackages#

Submodules#

qibocal.bootstrap module#

qibocal.bootstrap.data_uncertainties(data, method=None, data_median=None, homogeneous=True)[source]#

Compute the uncertainties of the median (or specified) values.

Parameters
  • data (list or np.ndarray) – 2d array with rows containing data points from which the median value is extracted.

  • method (str or int or float, optional) – method of computing the method. If "std", computes the standard deviation. If number between 0 and 100, computes the corresponding confidence interval using np.percentile. Otherwise, returns None. Defaults to None.

  • data_median (list or np.ndarray, optional) – 1d array for computing the errors from the confidence interval. If None, the median values are computed from data.

  • homogeneous (bool) – if True, assumes that all rows in data are of the same size and returns np.ndarray. Default is True.

Returns

uncertainties of the data.

Return type

np.ndarray

qibocal.bootstrap.bootstrap(data: Union[ndarray, list], n_bootstrap: int, homogeneous: bool = True, sample_size: Optional[int] = None, seed: Optional[int] = None)[source]#

Non-parametric bootstrap resampling.

Parameters
  • data (list or np.ndarray) – 2d array with rows containing samples.

  • n_bootstrap (int) – number of bootstrap iterations.

  • homogeneous (bool) – if True, assumes that all rows in data are of the same size and returns np.ndarray. If False, returns a list of lists. Default is True.

  • sample_size (int, optional) – number of samples per row in data. If None, defaults to len(row) from data.

  • seed (int, optional) – A fixed seed to initialize np.random.Generator. If None, initializes a generator with a random seed. Defaults is None.

Returns

resampled data of shape (len(data), sample_size, n_bootstrap)

Return type

list or np.ndarray

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.

qibocal.utils module#

qibocal.utils.allocate_single_qubits(platform: Optional[Platform], qubit_ids: list[Union[str, int]]) dict[Union[str, int], qibolab.qubits.Qubit][source]#

Construct the map from the chosen ids to the corresponding physical qubits available on the platform.

qibocal.utils.allocate_qubits_pairs(platform: Optional[Platform], qubit_pairs_ids: list[tuple[Union[str, int], Union[str, int]]]) dict[tuple[Union[str, int], Union[str, int]], qibolab.qubits.QubitPair][source]#

Construct the map from the chosen id pairs to the corresponding physical qubit pairs available on the platform.