qibocal.protocols package#

Subpackages#

Submodules#

qibocal.protocols.classification module#

class qibocal.protocols.classification.SingleShotClassificationParameters(unrolling: bool = False, classifiers_list: ~typing.Optional[list[str]] = <factory>, savedir: ~typing.Optional[str] = ' ')[source]#

Bases: Parameters

SingleShotClassification runcard inputs.

unrolling: bool = False#

If True it uses sequence unrolling to deploy multiple sequences in a single instrument call. Defaults to False.

classifiers_list: Optional[list[str]]#

List of models to classify the qubit states

savedir: Optional[str] = ' '#

Dumping folder of the classification results

hardware_average: bool = False#

By default hardware average will be performed.

nshots: int#

Number of executions on hardware.

relaxation_time: float#

Wait time for the qubit to decohere back to the gnd state.

qibocal.protocols.classification.ClassificationType = dtype([('i', '<f8'), ('q', '<f8'), ('state', '<i8')])#

Custom dtype for rabi amplitude.

class qibocal.protocols.classification.SingleShotClassificationData(nshots: int, savedir: str, qubit_frequencies: dict[typing.Union[str, int], float] = <factory>, data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[+_ScalarType_co]]] = <factory>, classifiers_list: Optional[list[str]] = <factory>)[source]#

Bases: Data

nshots: int#

Number of shots.

savedir: str#

Dumping folder of the classification results

qubit_frequencies: dict[Union[str, int], float]#

Qubit frequencies.

data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[+_ScalarType_co]]]#

Raw data acquired.

classifiers_list: Optional[list[str]]#

List of models to classify the qubit states

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property pairs#

Access qubit pairs ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

property qubits#

Access qubits from data structure.

register_qubit(dtype, data_keys, data_dict)#

Store output for single qubit.

Parameters:
  • data_keys (tuple) – Keys of Data.data.

  • data_dict (dict) – The keys are the fields of dtype and

  • arrays. (the values are the related) –

save(path: Path)#

Store data to file.

class qibocal.protocols.classification.SingleShotClassificationResults(names: list, savedir: str, y_preds: dict[typing.Union[str, int], list], grid_preds: dict[typing.Union[str, int], list], threshold: dict[typing.Union[str, int], float] = <factory>, rotation_angle: dict[typing.Union[str, int], float] = <factory>, mean_gnd_states: dict[typing.Union[str, int], list[float]] = <factory>, mean_exc_states: dict[typing.Union[str, int], list[float]] = <factory>, fidelity: dict[typing.Union[str, int], float] = <factory>, assignment_fidelity: dict[typing.Union[str, int], float] = <factory>, effective_temperature: dict[typing.Union[str, int], float] = <factory>, models: dict[typing.Union[str, int], list] = <factory>, benchmark_table: ~typing.Optional[dict[typing.Union[str, int], pandas.core.frame.DataFrame]] = <factory>, classifiers_hpars: ~typing.Optional[dict[typing.Union[str, int], dict]] = <factory>, x_tests: dict[typing.Union[str, int], list] = <factory>, y_tests: dict[typing.Union[str, int], list] = <factory>)[source]#

Bases: Results

SingleShotClassification outputs.

names: list#

List of models name.

savedir: str#

Dumping folder of the classification results.

y_preds: dict[Union[str, int], list]#

Models’ predictions of the test set.

grid_preds: dict[Union[str, int], list]#

Models’ prediction of the contour grid.

threshold: dict[Union[str, int], float]#

Threshold for classification.

rotation_angle: dict[Union[str, int], float]#

Threshold for classification.

mean_gnd_states: dict[Union[str, int], list[float]]#

Centroid of the ground state blob.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property params: dict#

Convert non-arrays attributes into dict.

mean_exc_states: dict[Union[str, int], list[float]]#

Centroid of the excited state blob.

fidelity: dict[Union[str, int], float]#

Fidelity evaluated only with the qubit_fit model.

assignment_fidelity: dict[Union[str, int], float]#

Assignment fidelity evaluated only with the qubit_fit model.

effective_temperature: dict[Union[str, int], float]#

Qubit effective temperature from Boltzmann distribution.

models: dict[Union[str, int], list]#

List of trained classification models.

benchmark_table: Optional[dict[Union[str, int], pandas.core.frame.DataFrame]]#

Benchmark tables.

classifiers_hpars: Optional[dict[Union[str, int], dict]]#

Classifiers hyperparameters.

x_tests: dict[Union[str, int], list]#

Test set.

y_tests: dict[Union[str, int], list]#

Test set.

save(path)[source]#

Store results to file.

qibocal.protocols.classification._acquisition(params: SingleShotClassificationParameters, platform: Platform, targets: list[Union[str, int]]) SingleShotClassificationData[source]#
Parameters:
  • nshots (int) – number of times the pulse sequence will be repeated.

  • classifiers (list) – list of classifiers, the available ones are: - linear_svm - ada_boost - gaussian_process - naive_bayes - qubit_fit - random_forest - rbf_svm - qblox_fit.

  • ["qubit_fit"]. (The default value is) –

  • savedir (str) – Dumping folder of the classification results.

  • one. (If not given the dumping folder will be the report) –

  • relaxation_time (float) – Relaxation time.

  • Example

  • code-block: (..) – yaml:

  • id (-) – single_shot_classification_1 operation: single_shot_classification parameters: nshots: 5000 savedir: “single_shot” classifiers_list: [“qubit_fit”,”naive_bayes”, “linear_svm”]

qibocal.protocols.classification._fit(data: SingleShotClassificationData) SingleShotClassificationResults[source]#
qibocal.protocols.classification._plot(data: SingleShotClassificationData, target: Union[str, int], fit: SingleShotClassificationResults)[source]#
qibocal.protocols.classification._update(results: SingleShotClassificationResults, platform: Platform, target: Union[str, int])[source]#
qibocal.protocols.classification.single_shot_classification = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#

Qubit classification routine object.

qibocal.protocols.dispersive_shift module#

class qibocal.protocols.dispersive_shift.DispersiveShiftParameters(freq_width: int, freq_step: int)[source]#

Bases: Parameters

Dispersive shift inputs.

freq_width: int#

Width [Hz] for frequency sweep relative to the readout frequency [Hz].

freq_step: int#

Frequency step for sweep [Hz].

hardware_average: bool = False#

By default hardware average will be performed.

nshots: int#

Number of executions on hardware.

relaxation_time: float#

Wait time for the qubit to decohere back to the gnd state.

class qibocal.protocols.dispersive_shift.DispersiveShiftResults(frequency_state_zero: dict[Union[str, int], float], frequency_state_one: dict[Union[str, int], float], fitted_parameters_state_zero: dict[Union[str, int], list[float]], fitted_parameters_state_one: dict[Union[str, int], list[float]], best_freq: dict[Union[str, int], float])[source]#

Bases: Results

Dispersive shift outputs.

frequency_state_zero: dict[Union[str, int], float]#

State zero frequency.

frequency_state_one: dict[Union[str, int], float]#

State one frequency.

fitted_parameters_state_zero: dict[Union[str, int], list[float]]#

Fitted parameters state zero.

fitted_parameters_state_one: dict[Union[str, int], list[float]]#

Fitted parameters state one.

best_freq: dict[Union[str, int], float]#

Readout frequency that maximizes the distance of ground and excited states in iq-plane

property state_zero#
property state_one#
_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property params: dict#

Convert non-arrays attributes into dict.

save(path: Path)#

Store results to file.

qibocal.protocols.dispersive_shift.DispersiveShiftType = dtype([('freq', '<f8'), ('i', '<f8'), ('q', '<f8'), ('signal', '<f8'), ('phase', '<f8')])#

Custom dtype for dispersive shift.

class qibocal.protocols.dispersive_shift.DispersiveShiftData(resonator_type: str, data: dict[tuple[typing.Union[str, int], int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('freq', '<f8'), ('i', '<f8'), ('q', '<f8'), ('signal', '<f8'), ('phase', '<f8')])]]] = <factory>)[source]#

Bases: Data

Dispersive shift acquisition outputs.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property pairs#

Access qubit pairs ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

property qubits#

Access qubits from data structure.

register_qubit(dtype, data_keys, data_dict)#

Store output for single qubit.

Parameters:
  • data_keys (tuple) – Keys of Data.data.

  • data_dict (dict) – The keys are the fields of dtype and

  • arrays. (the values are the related) –

save(path: Path)#

Store data to file.

resonator_type: str#

Resonator type.

data: dict[tuple[typing.Union[str, int], int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('freq', '<f8'), ('i', '<f8'), ('q', '<f8'), ('signal', '<f8'), ('phase', '<f8')])]]]#
qibocal.protocols.dispersive_shift._acquisition(params: DispersiveShiftParameters, platform: Platform, targets: list[Union[str, int]]) DispersiveShiftData[source]#

Data acquisition for dispersive shift experiment. Perform spectroscopy on the readout resonator, with the qubit in ground and excited state, showing the resonator shift produced by the coupling between the resonator and the qubit.

Parameters:
  • params (DispersiveShiftParameters) – experiment’s parameters

  • platform (Platform) – Qibolab platform object

  • targets (list) – list of target qubits to perform the action

qibocal.protocols.dispersive_shift._fit(data: DispersiveShiftData) DispersiveShiftResults[source]#

Post-Processing for dispersive shift

qibocal.protocols.dispersive_shift._plot(data: DispersiveShiftData, target: Union[str, int], fit: DispersiveShiftResults)[source]#

Plotting function for dispersive shift.

qibocal.protocols.dispersive_shift._update(results: DispersiveShiftResults, platform: Platform, target: Union[str, int])[source]#
qibocal.protocols.dispersive_shift.dispersive_shift = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#

Dispersive shift Routine object.

qibocal.protocols.dispersive_shift_qutrit module#

class qibocal.protocols.dispersive_shift_qutrit.DispersiveShiftQutritParameters(freq_width: int, freq_step: int)[source]#

Bases: DispersiveShiftParameters

Dispersive shift inputs.

hardware_average: bool = False#

By default hardware average will be performed.

freq_width: int#

Width [Hz] for frequency sweep relative to the readout frequency [Hz].

freq_step: int#

Frequency step for sweep [Hz].

nshots: int#

Number of executions on hardware.

relaxation_time: float#

Wait time for the qubit to decohere back to the gnd state.

class qibocal.protocols.dispersive_shift_qutrit.DispersiveShiftQutritResults(frequency_state_zero: dict[Union[str, int], float], frequency_state_one: dict[Union[str, int], float], frequency_state_two: dict[Union[str, int], float], fitted_parameters_state_zero: dict[Union[str, int], list[float]], fitted_parameters_state_one: dict[Union[str, int], list[float]], fitted_parameters_state_two: dict[Union[str, int], list[float]])[source]#

Bases: Results

Dispersive shift outputs.

frequency_state_zero: dict[Union[str, int], float]#

State zero frequency.

frequency_state_one: dict[Union[str, int], float]#

State one frequency.

frequency_state_two: dict[Union[str, int], float]#

State two frequency.

fitted_parameters_state_zero: dict[Union[str, int], list[float]]#

Fitted parameters state zero.

fitted_parameters_state_one: dict[Union[str, int], list[float]]#

Fitted parameters state one.

fitted_parameters_state_two: dict[Union[str, int], list[float]]#

Fitted parameters state one.

property state_zero#
property state_one#
_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property params: dict#

Convert non-arrays attributes into dict.

save(path: Path)#

Store results to file.

property state_two#
class qibocal.protocols.dispersive_shift_qutrit.DispersiveShiftQutritData(resonator_type: str, data: dict[tuple[typing.Union[str, int], int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('freq', '<f8'), ('i', '<f8'), ('q', '<f8'), ('signal', '<f8'), ('phase', '<f8')])]]] = <factory>)[source]#

Bases: DispersiveShiftData

Dipsersive shift acquisition outputs.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property pairs#

Access qubit pairs ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

property qubits#

Access qubits from data structure.

register_qubit(dtype, data_keys, data_dict)#

Store output for single qubit.

Parameters:
  • data_keys (tuple) – Keys of Data.data.

  • data_dict (dict) – The keys are the fields of dtype and

  • arrays. (the values are the related) –

save(path: Path)#

Store data to file.

resonator_type: str#

Resonator type.

data: dict[tuple[QubitId, int], npt.NDArray[DispersiveShiftType]]#
qibocal.protocols.dispersive_shift_qutrit._acquisition(params: DispersiveShiftParameters, platform: Platform, targets: list[Union[str, int]]) DispersiveShiftQutritData[source]#

Data acquisition for dispersive shift experiment. Perform spectroscopy on the readout resonator, with the qubit in ground and excited state, showing the resonator shift produced by the coupling between the resonator and the qubit.

Parameters:
  • params (DispersiveShiftParameters) – experiment’s parameters

  • platform (Platform) – Qibolab platform object

  • targets (list) – list of target qubits to perform the action

qibocal.protocols.dispersive_shift_qutrit._fit(data: DispersiveShiftQutritData) DispersiveShiftQutritResults[source]#

Post-Processing for dispersive shift

qibocal.protocols.dispersive_shift_qutrit._plot(data: DispersiveShiftQutritData, target: Union[str, int], fit: DispersiveShiftQutritResults)[source]#

Plotting function for dispersive shift.

qibocal.protocols.drag module#

class qibocal.protocols.drag.DragTuningParameters(beta_start: float, beta_end: float, beta_step: float, unrolling: bool = False)[source]#

Bases: Parameters

DragTuning runcard inputs.

beta_start: float#

DRAG pulse beta start sweep parameter.

beta_end: float#

DRAG pulse beta end sweep parameter.

beta_step: float#

DRAG pulse beta sweep step parameter.

unrolling: bool = False#

If True it uses sequence unrolling to deploy multiple sequences in a single instrument call. Defaults to False.

hardware_average: bool = False#

By default hardware average will be performed.

nshots: int#

Number of executions on hardware.

relaxation_time: float#

Wait time for the qubit to decohere back to the gnd state.

class qibocal.protocols.drag.DragTuningResults(betas: dict[typing.Union[str, int], float], fitted_parameters: dict[typing.Union[str, int], dict[str, float]], chi2: dict[typing.Union[str, int], tuple[float, typing.Optional[float]]] = <factory>)[source]#

Bases: Results

DragTuning outputs.

betas: dict[Union[str, int], float]#

Optimal beta paramter for each qubit.

fitted_parameters: dict[Union[str, int], dict[str, float]]#

Raw fitting output.

chi2: dict[Union[str, int], tuple[float, Optional[float]]]#

Chi2 calculation.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property params: dict#

Convert non-arrays attributes into dict.

save(path: Path)#

Store results to file.

class qibocal.protocols.drag.DragTuningData(anharmonicity: dict[typing.Union[str, int], float] = <factory>, data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('prob', '<f8'), ('error', '<f8'), ('beta', '<f8')])]]] = <factory>)[source]#

Bases: Data

DragTuning acquisition outputs.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property pairs#

Access qubit pairs ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

property qubits#

Access qubits from data structure.

register_qubit(dtype, data_keys, data_dict)#

Store output for single qubit.

Parameters:
  • data_keys (tuple) – Keys of Data.data.

  • data_dict (dict) – The keys are the fields of dtype and

  • arrays. (the values are the related) –

save(path: Path)#

Store data to file.

anharmonicity: dict[Union[str, int], float]#

Anharmonicity of each qubit.

data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('prob', '<f8'), ('error', '<f8'), ('beta', '<f8')])]]]#

Raw data acquired.

qibocal.protocols.drag._acquisition(params: DragTuningParameters, platform: Platform, targets: list[Union[str, int]]) DragTuningData[source]#

Data acquisition for drag pulse tuning experiment. See https://arxiv.org/pdf/1504.06597.pdf Fig. 2 (c).

qibocal.protocols.drag.drag_fit(x, offset, amplitude, period, phase)[source]#
qibocal.protocols.drag._fit(data: DragTuningData) DragTuningResults[source]#
qibocal.protocols.drag._plot(data: DragTuningData, target: Union[str, int], fit: DragTuningResults)[source]#

Plotting function for DragTuning.

qibocal.protocols.drag._update(results: DragTuningResults, platform: Platform, target: Union[str, int])[source]#
qibocal.protocols.drag.drag_tuning = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#

DragTuning Routine object.

qibocal.protocols.flipping module#

class qibocal.protocols.flipping.FlippingParameters(nflips_max: int, nflips_step: int, unrolling: bool = False, delta_amplitude: float = 0)[source]#

Bases: FlippingSignalParameters

Flipping runcard inputs.

delta_amplitude: float = 0#

Amplitude detuning.

hardware_average: bool = False#

By default hardware average will be performed.

unrolling: bool = False#

If True it uses sequence unrolling to deploy multiple sequences in a single instrument call. Defaults to False.

nflips_max: int#

Maximum number of flips ([RX(pi) - RX(pi)] sequences).

nflips_step: int#

Flip step.

nshots: int#

Number of executions on hardware.

relaxation_time: float#

Wait time for the qubit to decohere back to the gnd state.

class qibocal.protocols.flipping.FlippingResults(amplitude: dict[typing.Union[str, int], typing.Union[float, list[float]]], delta_amplitude: dict[typing.Union[str, int], typing.Union[float, list[float]]], delta_amplitude_detuned: dict[typing.Union[str, int], typing.Union[float, list[float]]], fitted_parameters: dict[typing.Union[str, int], dict[str, float]], chi2: dict[typing.Union[str, int], list[float]] = <factory>)[source]#

Bases: FlippingSignalResults

Flipping outputs.

chi2: dict[Union[str, int], list[float]]#

Chi squared estimate mean value and error.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property params: dict#

Convert non-arrays attributes into dict.

save(path: Path)#

Store results to file.

amplitude: dict[QubitId, Union[float, list[float]]]#

Drive amplitude for each qubit.

delta_amplitude: dict[QubitId, Union[float, list[float]]]#

Difference in amplitude between initial value and fit.

delta_amplitude_detuned: dict[QubitId, Union[float, list[float]]]#

Difference in amplitude between detuned value and fit.

fitted_parameters: dict[QubitId, dict[str, float]]#

Raw fitting output.

class qibocal.protocols.flipping.FlippingData(resonator_type: str, delta_amplitude: float, pi_pulse_amplitudes: dict[typing.Union[str, int], float], data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('flips', '<f8'), ('prob', '<f8'), ('error', '<f8')])]]] = <factory>)[source]#

Bases: FlippingSignalData

Flipping acquisition outputs.

data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('flips', '<f8'), ('prob', '<f8'), ('error', '<f8')])]]]#

Raw data acquired.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property pairs#

Access qubit pairs ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

property qubits#

Access qubits from data structure.

register_qubit(dtype, data_keys, data_dict)#

Store output for single qubit.

Parameters:
  • data_keys (tuple) – Keys of Data.data.

  • data_dict (dict) – The keys are the fields of dtype and

  • arrays. (the values are the related) –

save(path: Path)#

Store data to file.

resonator_type: str#

Resonator type.

delta_amplitude: float#

Amplitude detuning.

pi_pulse_amplitudes: dict[Union[str, int], float]#

Pi pulse amplitudes for each qubit.

qibocal.protocols.flipping._acquisition(params: FlippingParameters, platform: Platform, targets: list[Union[str, int]]) FlippingData[source]#

Data acquisition for flipping.

The flipping experiment correct the delta amplitude in the qubit drive pulse. We measure a qubit after applying a Rx(pi/2) and N flips (Rx(pi) rotations). After fitting we can obtain the delta amplitude to refine pi pulses.

Parameters:
  • params (SingleShotClassificationParameters) – input parameters

  • platform (Platform) – Qibolab’s platform

  • qubits (dict) – dict of target Qubit objects to be characterized

Returns:

data (FlippingData)

qibocal.protocols.flipping._fit(data: FlippingData) FlippingResults[source]#

Post-processing function for Flipping.

The used model is

\[y = p_0 sin\Big(\frac{2 \pi x}{p_2} + p_3\Big) + p_1.\]
qibocal.protocols.flipping._plot(data: FlippingData, target: Union[str, int], fit: Optional[FlippingResults] = None)[source]#

Plotting function for Flipping.

qibocal.protocols.flipping.flipping = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#

Flipping Routine object.

qibocal.protocols.flipping_signal module#

class qibocal.protocols.flipping_signal.FlippingSignalParameters(nflips_max: int, nflips_step: int, unrolling: bool = False, delta_amplitude: float = 0)[source]#

Bases: Parameters

Flipping runcard inputs.

nflips_max: int#

Maximum number of flips ([RX(pi) - RX(pi)] sequences).

nflips_step: int#

Flip step.

unrolling: bool = False#

If True it uses sequence unrolling to deploy multiple sequences in a single instrument call. Defaults to False.

delta_amplitude: float = 0#

Amplitude detuning.

hardware_average: bool = False#

By default hardware average will be performed.

nshots: int#

Number of executions on hardware.

relaxation_time: float#

Wait time for the qubit to decohere back to the gnd state.

class qibocal.protocols.flipping_signal.FlippingSignalResults(amplitude: dict[Union[str, int], Union[float, list[float]]], delta_amplitude: dict[Union[str, int], Union[float, list[float]]], delta_amplitude_detuned: dict[Union[str, int], Union[float, list[float]]], fitted_parameters: dict[Union[str, int], dict[str, float]])[source]#

Bases: Results

Flipping outputs.

amplitude: dict[Union[str, int], Union[float, list[float]]]#

Drive amplitude for each qubit.

delta_amplitude: dict[Union[str, int], Union[float, list[float]]]#

Difference in amplitude between initial value and fit.

delta_amplitude_detuned: dict[Union[str, int], Union[float, list[float]]]#

Difference in amplitude between detuned value and fit.

fitted_parameters: dict[Union[str, int], dict[str, float]]#

Raw fitting output.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property params: dict#

Convert non-arrays attributes into dict.

save(path: Path)#

Store results to file.

class qibocal.protocols.flipping_signal.FlippingSignalData(resonator_type: str, delta_amplitude: float, pi_pulse_amplitudes: dict[typing.Union[str, int], float], data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('flips', '<f8'), ('signal', '<f8')])]]] = <factory>)[source]#

Bases: Data

Flipping acquisition outputs.

resonator_type: str#

Resonator type.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property pairs#

Access qubit pairs ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

property qubits#

Access qubits from data structure.

register_qubit(dtype, data_keys, data_dict)#

Store output for single qubit.

Parameters:
  • data_keys (tuple) – Keys of Data.data.

  • data_dict (dict) – The keys are the fields of dtype and

  • arrays. (the values are the related) –

save(path: Path)#

Store data to file.

delta_amplitude: float#

Amplitude detuning.

pi_pulse_amplitudes: dict[Union[str, int], float]#

Pi pulse amplitudes for each qubit.

data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('flips', '<f8'), ('signal', '<f8')])]]]#

Raw data acquired.

qibocal.protocols.flipping_signal.flipping_sequence(platform: Platform, qubit: Union[str, int], delta_amplitude: float, flips: int)[source]#
qibocal.protocols.flipping_signal._acquisition(params: FlippingSignalParameters, platform: Platform, targets: list[Union[str, int]]) FlippingSignalData[source]#

Data acquisition for flipping.

The flipping experiment correct the delta amplitude in the qubit drive pulse. We measure a qubit after applying a Rx(pi/2) and N flips (Rx(pi) rotations). After fitting we can obtain the delta amplitude to refine pi pulses.

Parameters:
  • params (FlippingSignalParameters) – input parameters

  • platform (Platform) – Qibolab’s platform

  • qubits (dict) – dict of target Qubit objects to be characterized

Returns:

data (FlippingSignalData)

qibocal.protocols.flipping_signal.flipping_fit(x, offset, amplitude, omega, phase, gamma)[source]#
qibocal.protocols.flipping_signal._fit(data: FlippingSignalData) FlippingSignalResults[source]#

Post-processing function for Flipping.

The used model is

\[y = p_0 sin\Big(\frac{2 \pi x}{p_2} + p_3\Big)*\exp{-x*p4} + p_1.\]
qibocal.protocols.flipping_signal._plot(data: FlippingSignalData, target, fit: Optional[FlippingSignalResults] = None)[source]#

Plotting function for Flipping.

qibocal.protocols.flipping_signal._update(results: FlippingSignalResults, platform: Platform, qubit: Union[str, int])[source]#
qibocal.protocols.flipping_signal.flipping_signal = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#

Flipping Routine object.

qibocal.protocols.qubit_power_spectroscopy module#

class qibocal.protocols.qubit_power_spectroscopy.QubitPowerSpectroscopyParameters(freq_width: int, freq_step: int, min_amp_factor: float, max_amp_factor: float, step_amp_factor: float, duration: int, amplitude: Optional[float] = None)[source]#

Bases: Parameters

QubitPowerSpectroscopy runcard inputs.

freq_width: int#

Width for frequency sweep relative to the drive frequency [Hz].

freq_step: int#

Frequency step for sweep [Hz].

min_amp_factor: float#

Minimum amplitude multiplicative factor.

max_amp_factor: float#

Maximum amplitude multiplicative factor.

step_amp_factor: float#

Step amplitude multiplicative factor.

duration: int#

Drive duration.

hardware_average: bool = False#

By default hardware average will be performed.

nshots: int#

Number of executions on hardware.

relaxation_time: float#

Wait time for the qubit to decohere back to the gnd state.

amplitude: Optional[float] = None#

Initial drive amplitude.

class qibocal.protocols.qubit_power_spectroscopy.QubitPowerSpectroscopyData(resonator_type: str, amplitudes: dict[typing.Union[str, int], float], data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('freq', '<f8'), ('amp', '<f8'), ('signal', '<f8'), ('phase', '<f8')])]]] = <factory>)[source]#

Bases: ResonatorPunchoutData

QubitPowerSpectroscopy data acquisition.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property pairs#

Access qubit pairs ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

property qubits#

Access qubits from data structure.

register_qubit(qubit, freq, amp, signal, phase)#

Store output for single qubit.

save(path: Path)#

Store data to file.

resonator_type: str#

Resonator type.

amplitudes: dict[QubitId, float]#

Amplitudes provided by the user.

data: dict[QubitId, npt.NDArray[ResPunchoutType]]#

Raw data acquired.

qibocal.protocols.qubit_power_spectroscopy._acquisition(params: QubitPowerSpectroscopyParameters, platform: Platform, targets: list[Union[str, int]]) QubitPowerSpectroscopyData[source]#

Perform a qubit spectroscopy experiment with different amplitudes.

For high amplitude it should be possible to see more peaks: corresponding to the (0-2)/2 frequency and the 1-2. This experiment can be used also to test if a peak is a qubit: if it is, the peak will get larger while increasing the power of the drive.

qibocal.protocols.qubit_power_spectroscopy._fit(data: QubitPowerSpectroscopyData) Results[source]#

Do not perform any fitting procedure.

qibocal.protocols.qubit_power_spectroscopy._plot(data: ResonatorPunchoutData, target: Union[str, int], fit: Optional[QubitSpectroscopyResults] = None)[source]#

Plot QubitPunchout.

qibocal.protocols.qubit_power_spectroscopy.qubit_power_spectroscopy = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#

QubitPowerSpectroscopy Routine object.

qibocal.protocols.qubit_spectroscopy module#

class qibocal.protocols.qubit_spectroscopy.QubitSpectroscopyParameters(freq_width: int, freq_step: int, drive_duration: int, drive_amplitude: Optional[float] = None, hardware_average: bool = True)[source]#

Bases: Parameters

QubitSpectroscopy runcard inputs.

freq_width: int#

Width [Hz] for frequency sweep relative to the qubit frequency.

freq_step: int#

Frequency [Hz] step for sweep.

drive_duration: int#

Drive pulse duration [ns]. Same for all qubits.

drive_amplitude: Optional[float] = None#

Drive pulse amplitude (optional). Same for all qubits.

hardware_average: bool = True#

By default hardware average will be performed.

nshots: int#

Number of executions on hardware.

relaxation_time: float#

Wait time for the qubit to decohere back to the gnd state.

class qibocal.protocols.qubit_spectroscopy.QubitSpectroscopyResults(frequency: dict[typing.Union[str, int], dict[str, float]], amplitude: dict[typing.Union[str, int], float], fitted_parameters: dict[typing.Union[str, int], list[float]], chi2_reduced: dict[typing.Union[str, int], tuple[float, typing.Optional[float]]] = <factory>, error_fit_pars: dict[typing.Union[str, int], list] = <factory>)[source]#

Bases: Results

QubitSpectroscopy outputs.

frequency: dict[Union[str, int], dict[str, float]]#

Drive frequecy [GHz] for each qubit.

amplitude: dict[Union[str, int], float]#

Input drive amplitude. Same for all qubits.

fitted_parameters: dict[Union[str, int], list[float]]#

Raw fitting output.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property params: dict#

Convert non-arrays attributes into dict.

save(path: Path)#

Store results to file.

chi2_reduced: dict[Union[str, int], tuple[float, Optional[float]]]#

Chi2 reduced.

error_fit_pars: dict[Union[str, int], list]#

Errors of the fit parameters.

class qibocal.protocols.qubit_spectroscopy.QubitSpectroscopyData(resonator_type: str, amplitudes: dict[typing.Union[str, int], float], fit_function: str = 'lorentzian', phase_sign: bool = False, data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('freq', '<f8'), ('signal', '<f8'), ('phase', '<f8'), ('error_signal', '<f8'), ('error_phase', '<f8')])]]] = <factory>, power_level: ~typing.Optional[~qibocal.protocols.utils.PowerLevel] = None, attenuations: ~typing.Optional[dict[typing.Union[str, int], int]] = <factory>)[source]#

Bases: ResonatorSpectroscopyData

QubitSpectroscopy acquisition outputs.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

fit_function: str = 'lorentzian'#

Fit function (optional) used for the resonance.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property pairs#

Access qubit pairs ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

phase_sign: bool = False#

Several instruments have their convention about the sign of the phase. If True, the routine will apply a minus to the phase data.

power_level: Optional[PowerLevel] = None#

Power regime of the resonator.

property qubits#

Access qubits from data structure.

register_qubit(dtype, data_keys, data_dict)#

Store output for single qubit.

Parameters:
  • data_keys (tuple) – Keys of Data.data.

  • data_dict (dict) – The keys are the fields of dtype and

  • arrays. (the values are the related) –

save(path: Path)#

Store data to file.

resonator_type: str#

Resonator type.

amplitudes: dict[QubitId, float]#

Amplitudes provided by the user.

data: dict[QubitId, npt.NDArray[ResSpecType]]#

Raw data acquired.

attenuations: Optional[dict[QubitId, int]]#

Readout attenuation [dB] for each qubit

qibocal.protocols.qubit_spectroscopy._acquisition(params: QubitSpectroscopyParameters, platform: Platform, targets: list[Union[str, int]]) QubitSpectroscopyData[source]#

Data acquisition for qubit spectroscopy.

qibocal.protocols.qubit_spectroscopy._fit(data: QubitSpectroscopyData) QubitSpectroscopyResults[source]#

Post-processing function for QubitSpectroscopy.

qibocal.protocols.qubit_spectroscopy._plot(data: QubitSpectroscopyData, target: Union[str, int], fit: QubitSpectroscopyResults)[source]#

Plotting function for QubitSpectroscopy.

qibocal.protocols.qubit_spectroscopy._update(results: QubitSpectroscopyResults, platform: Platform, target: Union[str, int])[source]#
qibocal.protocols.qubit_spectroscopy.qubit_spectroscopy = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#

QubitSpectroscopy Routine object.

qibocal.protocols.qubit_spectroscopy_ef module#

qibocal.protocols.qubit_spectroscopy_ef.DEFAULT_ANHARMONICITY = 300000000.0#

Initial guess for anharmonicity.

class qibocal.protocols.qubit_spectroscopy_ef.QubitSpectroscopyEFParameters(freq_width: int, freq_step: int, drive_duration: int, drive_amplitude: Optional[float] = None, hardware_average: bool = True)[source]#

Bases: QubitSpectroscopyParameters

QubitSpectroscopyEF runcard inputs.

drive_amplitude: Optional[float] = None#

Drive pulse amplitude (optional). Same for all qubits.

hardware_average: bool = True#

By default hardware average will be performed.

freq_width: int#

Width [Hz] for frequency sweep relative to the qubit frequency.

freq_step: int#

Frequency [Hz] step for sweep.

drive_duration: int#

Drive pulse duration [ns]. Same for all qubits.

nshots: int#

Number of executions on hardware.

relaxation_time: float#

Wait time for the qubit to decohere back to the gnd state.

class qibocal.protocols.qubit_spectroscopy_ef.QubitSpectroscopyEFResults(frequency: dict[typing.Union[str, int], dict[str, float]], amplitude: dict[typing.Union[str, int], float], fitted_parameters: dict[typing.Union[str, int], list[float]], chi2_reduced: dict[typing.Union[str, int], tuple[float, typing.Optional[float]]] = <factory>, error_fit_pars: dict[typing.Union[str, int], list] = <factory>, anharmonicity: dict[typing.Union[str, int], float] = <factory>)[source]#

Bases: QubitSpectroscopyResults

QubitSpectroscopyEF outputs.

anharmonicity: dict[Union[str, int], float]#
_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property params: dict#

Convert non-arrays attributes into dict.

save(path: Path)#

Store results to file.

frequency: dict[QubitId, dict[str, float]]#

Drive frequecy [GHz] for each qubit.

amplitude: dict[QubitId, float]#

Input drive amplitude. Same for all qubits.

fitted_parameters: dict[QubitId, list[float]]#

Raw fitting output.

chi2_reduced: dict[QubitId, tuple[float, Optional[float]]]#

Chi2 reduced.

error_fit_pars: dict[QubitId, list]#

Errors of the fit parameters.

class qibocal.protocols.qubit_spectroscopy_ef.QubitSpectroscopyEFData(resonator_type: str, amplitudes: dict[typing.Union[str, int], float], fit_function: str = 'lorentzian', phase_sign: bool = False, data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('freq', '<f8'), ('signal', '<f8'), ('phase', '<f8'), ('error_signal', '<f8'), ('error_phase', '<f8')])]]] = <factory>, power_level: ~typing.Optional[~qibocal.protocols.utils.PowerLevel] = None, attenuations: ~typing.Optional[dict[typing.Union[str, int], int]] = <factory>, drive_frequencies: dict[typing.Union[str, int], float] = <factory>)[source]#

Bases: QubitSpectroscopyData

QubitSpectroscopy acquisition outputs.

drive_frequencies: dict[Union[str, int], float]#
_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

fit_function: str = 'lorentzian'#

Fit function (optional) used for the resonance.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property pairs#

Access qubit pairs ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

phase_sign: bool = False#

Several instruments have their convention about the sign of the phase. If True, the routine will apply a minus to the phase data.

power_level: Optional[PowerLevel] = None#

Power regime of the resonator.

property qubits#

Access qubits from data structure.

register_qubit(dtype, data_keys, data_dict)#

Store output for single qubit.

Parameters:
  • data_keys (tuple) – Keys of Data.data.

  • data_dict (dict) – The keys are the fields of dtype and

  • arrays. (the values are the related) –

save(path: Path)#

Store data to file.

resonator_type: str#

Resonator type.

amplitudes: dict[QubitId, float]#

Amplitudes provided by the user.

data: dict[QubitId, npt.NDArray[ResSpecType]]#

Raw data acquired.

attenuations: Optional[dict[QubitId, int]]#

Readout attenuation [dB] for each qubit

qibocal.protocols.qubit_spectroscopy_ef.fit_ef(data: QubitSpectroscopyEFData) QubitSpectroscopyEFResults[source]#
qibocal.protocols.qubit_spectroscopy_ef._acquisition(params: QubitSpectroscopyEFParameters, platform: Platform, targets: list[Union[str, int]]) QubitSpectroscopyEFData[source]#

Data acquisition for qubit spectroscopy ef protocol.

Similar to a qubit spectroscopy with the difference that the qubit is first excited to the state 1. This protocols aims at finding the transition frequency between state 1 and the state 2. The anharmonicity is also computed.

If the RX12 frequency is not present in the runcard the sweep is performed around the qubit drive frequency shifted by DEFAULT_ANHARMONICITY, an hardcoded parameter editable in this file.

qibocal.protocols.qubit_spectroscopy_ef._plot(data: QubitSpectroscopyEFData, target: Union[str, int], fit: QubitSpectroscopyEFResults)[source]#

Plotting function for QubitSpectroscopy.

qibocal.protocols.qubit_spectroscopy_ef._update(results: QubitSpectroscopyEFResults, platform: Platform, target: Union[str, int])[source]#

Update w12 frequency

qibocal.protocols.qubit_spectroscopy_ef.qubit_spectroscopy_ef = Routine(acquisition=<function _acquisition>, fit=<function fit_ef>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#

QubitSpectroscopyEF Routine object.

qibocal.protocols.qutrit_classification module#

class qibocal.protocols.qutrit_classification.QutritClassificationParameters(unrolling: bool = False, classifiers_list: ~typing.Optional[list[str]] = <factory>, savedir: ~typing.Optional[str] = ' ')[source]#

Bases: SingleShotClassificationParameters

SingleShotClassification runcard inputs.

classifiers_list: Optional[list[str]]#

List of models to classify the qubit states

hardware_average: bool = False#

By default hardware average will be performed.

savedir: Optional[str] = ' '#

Dumping folder of the classification results

unrolling: bool = False#

If True it uses sequence unrolling to deploy multiple sequences in a single instrument call. Defaults to False.

nshots: int#

Number of executions on hardware.

relaxation_time: float#

Wait time for the qubit to decohere back to the gnd state.

class qibocal.protocols.qutrit_classification.QutritClassificationData(nshots: int, savedir: str, qubit_frequencies: dict[typing.Union[str, int], float] = <factory>, data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[+_ScalarType_co]]] = <factory>, classifiers_list: Optional[list[str]] = <factory>)[source]#

Bases: SingleShotClassificationData

classifiers_list: Optional[list[str]]#

List of models to classify the qubit states

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property pairs#

Access qubit pairs ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

property qubits#

Access qubits from data structure.

register_qubit(dtype, data_keys, data_dict)#

Store output for single qubit.

Parameters:
  • data_keys (tuple) – Keys of Data.data.

  • data_dict (dict) – The keys are the fields of dtype and

  • arrays. (the values are the related) –

save(path: Path)#

Store data to file.

nshots: int#

Number of shots.

savedir: str#

Dumping folder of the classification results

qubit_frequencies: dict[QubitId, float]#

Qubit frequencies.

data: dict[QubitId, npt.NDArray]#

Raw data acquired.

qibocal.protocols.qutrit_classification._acquisition(params: QutritClassificationParameters, platform: Platform, targets: list[Union[str, int]]) QutritClassificationData[source]#

This Routine prepares the qubits in 0,1 and 2 states and measures their respective I, Q values.

Parameters:
  • nshots (int) – number of times the pulse sequence will be repeated.

  • classifiers (list) – list of classifiers, the available ones are: - naive_bayes - nn - random_forest - decision_tree

  • ["naive_bayes"]. (The default value is) –

  • savedir (str) – Dumping folder of the classification results.

  • given (If not) –

  • one. (the dumping folder will be the report) –

  • relaxation_time (float) – Relaxation time.

qibocal.protocols.qutrit_classification._fit(data: QutritClassificationData) SingleShotClassificationResults[source]#
qibocal.protocols.qutrit_classification._plot(data: QutritClassificationData, target: Union[str, int], fit: SingleShotClassificationResults)[source]#
qibocal.protocols.qutrit_classification.qutrit_classification = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#

Qutrit classification Routine object.

qibocal.protocols.readout_characterization module#

class qibocal.protocols.readout_characterization.ReadoutCharacterizationParameters(delay: float = 0)[source]#

Bases: Parameters

ReadoutCharacterization runcard inputs.

delay: float = 0#

Delay between readouts, could account for resonator deplation or not [ns].

hardware_average: bool = False#

By default hardware average will be performed.

nshots: int#

Number of executions on hardware.

relaxation_time: float#

Wait time for the qubit to decohere back to the gnd state.

class qibocal.protocols.readout_characterization.ReadoutCharacterizationResults(fidelity: dict[Union[str, int], float], assignment_fidelity: dict[Union[str, int], float], qnd: dict[Union[str, int], float], effective_temperature: dict[Union[str, int], list[float]], Lambda_M: dict[Union[str, int], float], Lambda_M2: dict[Union[str, int], float])[source]#

Bases: Results

ReadoutCharacterization outputs.

fidelity: dict[Union[str, int], float]#

Fidelity of the measurement

assignment_fidelity: dict[Union[str, int], float]#

Assignment fidelity.

qnd: dict[Union[str, int], float]#

QND-ness of the measurement

effective_temperature: dict[Union[str, int], list[float]]#

Effective qubit temperature.

Lambda_M: dict[Union[str, int], float]#

Mapping between a given initial state to an outcome after the measurement

Lambda_M2: dict[Union[str, int], float]#

Mapping between the outcome after the measurement and it still being that outcame after another measurement

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property params: dict#

Convert non-arrays attributes into dict.

save(path: Path)#

Store results to file.

qibocal.protocols.readout_characterization.ReadoutCharacterizationType = dtype([('i', '<f8'), ('q', '<f8')])#

Custom dtype for ReadoutCharacterization.

class qibocal.protocols.readout_characterization.ReadoutCharacterizationData(qubit_frequencies: dict[typing.Union[str, int], float] = <factory>, delay: float = 0, data: dict[tuple, numpy.ndarray[typing.Any, numpy.dtype[dtype([('i', '<f8'), ('q', '<f8')])]]] = <factory>, samples: dict[tuple, numpy.ndarray[typing.Any, numpy.dtype[+_ScalarType_co]]] = <factory>)[source]#

Bases: Data

ReadoutCharacterization acquisition outputs.

_to_json(path: Path, filename: str)#

Helper function to dump to json.

_to_npz(path: Path, filename: str)#

Helper function to use np.savez while converting keys into strings.

static load_data(path: Path, filename: str)#

Load data stored in a npz file.

static load_params(path: Path, filename: str)#

Load parameters stored in a json file.

property pairs#

Access qubit pairs ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

property qubits#

Access qubits from data structure.

register_qubit(dtype, data_keys, data_dict)#

Store output for single qubit.

Parameters:
  • data_keys (tuple) – Keys of Data.data.

  • data_dict (dict) – The keys are the fields of dtype and

  • arrays. (the values are the related) –

save(path: Path)#

Store data to file.

qubit_frequencies: dict[Union[str, int], float]#

Qubit frequencies.

delay: float = 0#

Delay between readouts [ns].

data: dict[tuple, numpy.ndarray[typing.Any, numpy.dtype[dtype([('i', '<f8'), ('q', '<f8')])]]]#

Raw data acquired.

samples: dict[tuple, numpy.ndarray[typing.Any, numpy.dtype[+_ScalarType_co]]]#

Raw data acquired.

qibocal.protocols.readout_characterization._acquisition(params: ReadoutCharacterizationParameters, platform: Platform, targets: list[Union[str, int]]) ReadoutCharacterizationData[source]#

Data acquisition for resonator spectroscopy.

qibocal.protocols.readout_characterization._fit(data: ReadoutCharacterizationData) ReadoutCharacterizationResults[source]#

Post-processing function for ReadoutCharacterization.

qibocal.protocols.readout_characterization._plot(data: ReadoutCharacterizationData, fit: ReadoutCharacterizationResults, target: Union[str, int])[source]#

Plotting function for ReadoutCharacterization.

qibocal.protocols.readout_characterization._update(results: ReadoutCharacterizationResults, platform: Platform, target: Union[str, int])[source]#
qibocal.protocols.readout_characterization.readout_characterization = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#

ReadoutCharacterization Routine object.

qibocal.protocols.readout_mitigation_matrix module#

class qibocal.protocols.readout_mitigation_matrix.ReadoutMitigationMatrixParameters(pulses: Optional[bool] = True, nshots: Optional[int] = None, relaxation_time: Optional[int] = None)[source]#

Bases: Parameters

ReadoutMitigationMatrix matrix inputs.

pulses: Optional[bool] = True#

Get readout mitigation matrix using pulses. If False gates will be used.

nshots: Optional[int] = None#

Number of shots.

relaxation_time: Optional[int] = None#

Relaxation time [ns].

hardware_average: bool = False#

By default hardware average will be performed.

class qibocal.protocols.readout_mitigation_matrix.ReadoutMitigationMatrixResults(readout_mitigation_matrix: dict[tuple[typing.Union[str, int], ...], numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]] = <factory>, measurement_matrix: dict[tuple[typing.Union[str, int], ...], numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]] = <factory>)[source]#

Bases: Results

readout_mitigation_matrix: dict[tuple[Union[str, int], ...], numpy.ndarray[Any, numpy.dtype[numpy.float64]]]#

Readout mitigation matrices (inverse of measurement matrix).

measurement_matrix: dict[tuple[