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.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], platform: Platform, qubit: Union[str, int])[source]#

Update drive frequency value in platform for specific qubit.

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

Update drive frequency value in platform for specific qubit.

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

Update drive duration value in platform for specific qubit.

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], 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.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.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.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.

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

Construct the map from the chosen id to the corresponding list of physical qubits available on the platform.