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.

_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_gnd_states: dict[Union[str, int], list[float]]#

Centroid of the ground state blob.

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(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.

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, detuning: float = 0)[source]#

Bases: FlippingSignalParameters

Flipping runcard inputs.

detuning: 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], tuple[float, typing.Optional[float]]], delta_amplitude: dict[typing.Union[str, int], tuple[float, typing.Optional[float]]], delta_amplitude_detuned: dict[typing.Union[str, int], tuple[float, typing.Optional[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: FlippingSignalResults

Flipping outputs.

chi2: dict[Union[str, int], tuple[float, Optional[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[Union[str, int], tuple[float, Optional[float]]]#

Drive amplitude for each qubit.

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

Difference in amplitude between initial value and fit.

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

Difference in amplitude between detuned value and fit.

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

Raw fitting output.

class qibocal.protocols.flipping.FlippingData(resonator_type: str, detuning: 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.

detuning: 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, detuning: 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.

detuning: 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], tuple[float, Optional[float]]], delta_amplitude: dict[Union[str, int], tuple[float, Optional[float]]], delta_amplitude_detuned: dict[Union[str, int], tuple[float, Optional[float]]], fitted_parameters: dict[Union[str, int], dict[str, float]])[source]#

Bases: Results

Flipping outputs.

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

Drive amplitude for each qubit.

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

Difference in amplitude between initial value and fit.

delta_amplitude_detuned: dict[Union[str, int], tuple[float, Optional[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, detuning: 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.

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

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.

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

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.

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], tuple[float, 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], tuple[float, 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[Union[str, int], ...], numpy.ndarray[Any, numpy.dtype[numpy.float64]]]#

Matrix containing measurement matrices for each state.

_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.readout_mitigation_matrix.ReadoutMitigationMatrixData(qubit_list: list[typing.Union[str, int]], nshots: int, data: dict = <factory>)[source]#

Bases: Data

ReadoutMitigationMatrix acquisition outputs.

qubit_list: list[Union[str, int]]#

List of qubit ids

nshots: int#

Number of shots

_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.

data: dict#

Raw data acquited.

add(qubits, state, freqs)[source]#
qibocal.protocols.readout_mitigation_matrix._acquisition(params: ReadoutMitigationMatrixParameters, platform: Platform, targets: list[list[Union[str, int]]]) ReadoutMitigationMatrixData[source]#
qibocal.protocols.readout_mitigation_matrix._fit(data: ReadoutMitigationMatrixData) ReadoutMitigationMatrixResults[source]#

Post processing for readout mitigation matrix protocol.

qibocal.protocols.readout_mitigation_matrix._plot(data: ReadoutMitigationMatrixData, fit: ReadoutMitigationMatrixResults, target: list[Union[str, int]])[source]#

Plotting function for readout mitigation matrix.

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

Readout mitigation matrix protocol.

qibocal.protocols.resonator_punchout module#

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

Bases: Parameters

ResonatorPunchout runcard inputs.

freq_width: int#

Width for frequency sweep relative to the readout 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.

amplitude: float = None#

Initial readout amplitude.

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.resonator_punchout.ResonatorPunchoutResults(readout_frequency: dict[Union[str, int], float], bare_frequency: Optional[dict[Union[str, int], float]], readout_amplitude: dict[Union[str, int], float])[source]#

Bases: Results

ResonatorPunchout outputs.

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

Readout frequency [GHz] for each qubit.

bare_frequency: Optional[dict[Union[str, int], float]]#

Bare resonator frequency [GHz] for each qubit.

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

Readout amplitude for each qubit.

_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.resonator_punchout.ResPunchoutType = dtype([('freq', '<f8'), ('amp', '<f8'), ('signal', '<f8'), ('phase', '<f8')])#

Custom dtype for resonator punchout.

class qibocal.protocols.resonator_punchout.ResonatorPunchoutData(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: Data

ResonatorPunchout 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.

save(path: Path)#

Store data to file.

resonator_type: str#

Resonator type.

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

Amplitudes provided by the user.

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

Raw data acquired.

register_qubit(qubit, freq, amp, signal, phase)[source]#

Store output for single qubit.

qibocal.protocols.resonator_punchout._acquisition(params: ResonatorPunchoutParameters, platform: Platform, targets: list[Union[str, int]]) ResonatorPunchoutData[source]#

Data acquisition for Punchout over amplitude.

qibocal.protocols.resonator_punchout._fit(data: ResonatorPunchoutData, fit_type='amp') ResonatorPunchoutResults[source]#

Fit frequency and attenuation at high and low power for a given resonator.

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

Plotting function for ResonatorPunchout.

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

ResonatorPunchout Routine object.

qibocal.protocols.resonator_punchout_attenuation module#

class qibocal.protocols.resonator_punchout_attenuation.ResonatorPunchoutAttenuationParameters(freq_width: int, freq_step: int, min_att: int, max_att: int, step_att: int)[source]#

Bases: Parameters

ResonatorPunchoutAttenuation runcard inputs.

freq_width: int#

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

freq_step: int#

Frequency step for sweep [Hz].

min_att: int#

Attenuation minimum value [dB].

max_att: int#

Attenuation maximum value [dB].

step_att: int#

Attenuation step [dB].

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.resonator_punchout_attenuation.ResonatorPunchoutAttenuationResults(readout_frequency: dict[Union[str, int], float], bare_frequency: Optional[dict[Union[str, int], float]], readout_attenuation: dict[Union[str, int], int])[source]#

Bases: Results

ResonatorPunchoutAttenation outputs.

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

Readout frequency [GHz] for each qubit.

bare_frequency: Optional[dict[Union[str, int], float]]#

Bare resonator frequency [GHZ] for each qubit.

readout_attenuation: dict[Union[str, int], int]#

Readout attenuation [dB] for each qubit.

_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.resonator_punchout_attenuation.ResPunchoutAttType = dtype([('freq', '<f8'), ('att', '<f8'), ('signal', '<f8'), ('phase', '<f8')])#

Custom dtype for resonator punchout.

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

Bases: Data

ResonatorPunchoutAttenuation 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.

save(path: Path)#

Store data to file.

resonator_type: str#

Resonator type.

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

Raw data acquired.

register_qubit(qubit, freq, att, signal, phase)[source]#

Store output for single qubit.

qibocal.protocols.resonator_punchout_attenuation._acquisition(params: ResonatorPunchoutAttenuationParameters, platform: Platform, targets: list[Union[str, int]]) ResonatorPunchoutAttenuationData[source]#

Data acquisition for Punchout over attenuation.

qibocal.protocols.resonator_punchout_attenuation._fit(data: ResonatorPunchoutAttenuationData, fit_type='att') ResonatorPunchoutAttenuationResults[source]#

Fit frequency and attenuation at high and low power for a given resonator.

qibocal.protocols.resonator_punchout_attenuation._plot(data: ResonatorPunchoutAttenuationData, target: Union[str, int], fit: Optional[ResonatorPunchoutAttenuationResults] = None)[source]#

Plotting for ResonatorPunchoutAttenuation.

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

ResonatorPunchoutAttenuation Routine object.

qibocal.protocols.resonator_spectroscopy module#

qibocal.protocols.resonator_spectroscopy.ResSpecType = dtype([('freq', '<f8'), ('signal', '<f8'), ('phase', '<f8'), ('error_signal', '<f8'), ('error_phase', '<f8')])#

Custom dtype for resonator spectroscopy.

class qibocal.protocols.resonator_spectroscopy.ResonatorSpectroscopyParameters(freq_width: int, freq_step: int, power_level: Union[PowerLevel, str], amplitude: Optional[float] = None, attenuation: Optional[int] = None, hardware_average: bool = True)[source]#

Bases: Parameters

ResonatorSpectroscopy runcard inputs.

freq_width: int#

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

freq_step: int#

Frequency step for sweep [Hz].

power_level: Union[PowerLevel, str]#

Power regime (low or high). If low the readout frequency will be updated. If high both the readout frequency and the bare resonator frequency will be updated.

amplitude: Optional[float] = None#

Readout amplitude (optional). If defined, same amplitude will be used in all qubits. Otherwise the default amplitude defined on the platform runcard will be used

attenuation: Optional[int] = None#

Readout attenuation (optional). If defined, same attenuation will be used in all qubits. Otherwise the default attenuation defined on the platform runcard will be used

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.resonator_spectroscopy.ResonatorSpectroscopyResults(frequency: dict[typing.Union[str, int], float], fitted_parameters: dict[typing.Union[str, int], list[float]], bare_frequency: ~typing.Optional[dict[typing.Union[str, int], float]] = <factory>, error_fit_pars: dict[typing.Union[str, int], list] = <factory>, chi2_reduced: dict[typing.Union[str, int], tuple[float, typing.Optional[float]]] = <factory>, amplitude: ~typing.Optional[dict[typing.Union[str, int], float]] = <factory>, attenuation: ~typing.Optional[dict[typing.Union[str, int], int]] = <factory>)[source]#

Bases: Results

ResonatorSpectroscopy outputs.

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

Readout frequency [Hz] for each qubit.

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

Raw fitted parameters.

bare_frequency: Optional[dict[Union[str, int], float]]#

Bare resonator frequency [Hz] for each qubit.

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

Errors of the fit parameters.

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

Chi2 reduced.

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

Readout amplitude for each qubit.

_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.

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

Readout attenuation [dB] for each qubit.

class qibocal.protocols.resonator_spectroscopy.ResonatorSpectroscopyData(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'), ('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: Data

Data structure for resonator spectroscopy with attenuation.

_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.

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

Amplitudes provided by the user.

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')])]]]#

Raw data acquired.

power_level: Optional[PowerLevel] = None#

Power regime of the resonator.

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

Readout attenuation [dB] for each qubit

qibocal.protocols.resonator_spectroscopy._acquisition(params: ResonatorSpectroscopyParameters, platform: Platform, targets: list[Union[str, int]]) ResonatorSpectroscopyData[source]#

Data acquisition for resonator spectroscopy.

qibocal.protocols.resonator_spectroscopy._fit(data: ResonatorSpectroscopyData) ResonatorSpectroscopyResults[source]#

Post-processing function for ResonatorSpectroscopy.

qibocal.protocols.resonator_spectroscopy._plot(data: ResonatorSpectroscopyData, target: Union[str, int], fit: ResonatorSpectroscopyResults)[source]#

Plotting function for ResonatorSpectroscopy.

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

ResonatorSpectroscopy Routine object.

qibocal.protocols.state_tomography module#

qibocal.protocols.state_tomography.BASIS = ['X', 'Y', 'Z']#

Single qubit measurement basis.

qibocal.protocols.state_tomography.SIMULATED_DENSITY_MATRIX = 'ideal'#

Filename for simulated density matrix.

class qibocal.protocols.state_tomography.StateTomographyParameters(circuit: Optional[Union[str, Circuit]] = None)[source]#

Bases: Parameters

Tomography input parameters

circuit: Optional[Union[str, Circuit]] = None#

Circuit to prepare initial state.

It can also be provided the path to a json file containing a serialized circuit.

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.state_tomography.TomographyType = dtype([('samples', '<i8')])#

Custom dtype for tomography.

class qibocal.protocols.state_tomography.StateTomographyData(ideal: dict[tuple[typing.Union[str, int], str], numpy.float64] = <factory>, data: dict[tuple[typing.Union[str, int], str], numpy.int64] = <factory>)[source]#

Bases: Data

Tomography data

ideal: dict[tuple[Union[str, int], str], numpy.float64]#

Ideal samples measurements.

data: dict[tuple[Union[str, int], str], numpy.int64]#

Hardware measurements.

save(path)[source]#

Store data to file.

_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) –

class qibocal.protocols.state_tomography.StateTomographyResults(measured_density_matrix_real: dict[Union[str, int], list], measured_density_matrix_imag: dict[Union[str, int], list], target_density_matrix_real: dict[Union[str, int], list], target_density_matrix_imag: dict[Union[str, int], list], fidelity: dict[Union[str, int], float])[source]#

Bases: Results

Tomography results

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

Real part of measured density matrix.

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

Imaginary part of measured density matrix.

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

Real part of exact density matrix.

_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.

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

Imaginary part of exact density matrix.

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

State fidelity.

qibocal.protocols.state_tomography._acquisition(params: StateTomographyParameters, platform: Platform, targets: list[Union[str, int]]) StateTomographyData[source]#

Acquisition protocol for single qubit state tomography experiment.

qibocal.protocols.state_tomography._fit(data: StateTomographyData) StateTomographyResults[source]#

Post-processing for State tomography.

qibocal.protocols.state_tomography.plot_parallelogram(a, e, pos_x, pos_y, **options)[source]#

Plotting single histogram in 3d plot.

qibocal.protocols.state_tomography.plot_rho(fig, zz, trace_options, figure_options, showlegend=None)[source]#

Plot density matrix

qibocal.protocols.state_tomography.plot_reconstruction(ideal, measured)[source]#

Plot 3D plot with reconstruction of ideal and measured density matrix.

qibocal.protocols.state_tomography._plot(data: StateTomographyData, fit: StateTomographyResults, target: Union[str, int])[source]#

Plotting for state tomography

qibocal.protocols.two_qubit_state_tomography module#

qibocal.protocols.two_qubit_state_tomography.SIMULATED_DENSITY_MATRIX = 'ideal'#

Filename for simulated density matrix.

qibocal.protocols.two_qubit_state_tomography.TomographyType = dtype([('frequencies', '<i8'), ('simulation_probabilities', '<f8')])#

Custom dtype for tomography.

class qibocal.protocols.two_qubit_state_tomography.StateTomographyData(data: dict[tuple[typing.Union[str, int], typing.Union[str, int], str, str], numpy.int64] = <factory>, ideal: dict[typing.Tuple[typing.Union[str, int], typing.Union[str, int]], numpy.ndarray] = <factory>, simulated: ~typing.Optional[~qibo.result.QuantumState] = None)[source]#

Bases: Data

Tomography data

data: dict[tuple[Union[str, int], Union[str, int], str, str], numpy.int64]#
ideal: dict[Tuple[Union[str, int], Union[str, int]], numpy.ndarray]#
simulated: Optional[QuantumState] = None#
save(path)[source]#

Store data to file.

_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) –

class qibocal.protocols.two_qubit_state_tomography.StateTomographyResults(measured_raw_density_matrix_real: dict[typing.Tuple[typing.Union[str, int], typing.Union[str, int]], list] = <factory>, measured_raw_density_matrix_imag: dict[typing.Tuple[typing.Union[str, int], typing.Union[str, int]], list] = <factory>, measured_density_matrix_real: dict[typing.Tuple[typing.Union[str, int], typing.Union[str, int]], list] = <factory>, measured_density_matrix_imag: dict[typing.Tuple[typing.Union[str, int], typing.Union[str, int]], list] = <factory>, fidelity: dict[typing.Union[str, int], float] = <factory>)[source]#

Bases: Results

Tomography results

measured_raw_density_matrix_real: dict[Tuple[Union[str, int], Union[str, int]], list]#

Real part of measured density matrix before projecting.

measured_raw_density_matrix_imag: dict[Tuple[Union[str, int], Union[str, int]], list]#

Imaginary part of measured density matrix before projecting.

measured_density_matrix_real: dict[Tuple[Union[str, int], Union[str, int]], list]#

Real part of measured density matrix after projecting.

measured_density_matrix_imag: dict[Tuple[Union[str, int], Union[str, int]], list]#

Imaginary part of measured density matrix after projecting.

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

State fidelity.

_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.two_qubit_state_tomography._acquisition(params: StateTomographyParameters, platform: Platform, targets: list[Tuple[Union[str, int], Union[str, int]]]) StateTomographyData[source]#

Acquisition protocol for two qubit state tomography experiment.

qibocal.protocols.two_qubit_state_tomography.rotation_matrix(basis)[source]#

Matrix of the gate implementing the rotation to the given basis.

Parameters:

basis (str) – One of Pauli basis: X, Y or Z.

qibocal.protocols.two_qubit_state_tomography.project_psd(matrix)[source]#

Project matrix to the space of positive semidefinite matrices.

qibocal.protocols.two_qubit_state_tomography._fit(data: StateTomographyData) StateTomographyResults[source]#

Post-processing for two qubit state tomography.

Uses the standard linear inversion algorithm described in https://en.wikipedia.org/wiki/Quantum_tomography#Linear_inversion to reconstruct the density matrix. The matrix is also post projected after the linear inversion using project_psd.

qibocal.protocols.two_qubit_state_tomography.plot_measurements(data: StateTomographyData, target: Tuple[Union[str, int], Union[str, int]])[source]#

Plot histogram of measurements in the 9 different basis.

qibocal.protocols.two_qubit_state_tomography._plot(data: StateTomographyData, fit: StateTomographyResults, target: Tuple[Union[str, int], Union[str, int]])[source]#

Plotting for two qubit state tomography

qibocal.protocols.utils module#

qibocal.protocols.utils.HBAR = 1.0545718176461565e-34#

Chi2 output when errors list contains zero elements

qibocal.protocols.utils.CONFIDENCE_INTERVAL_FIRST_MASK = 99#

Confidence interval used to mask flux data.

qibocal.protocols.utils.CONFIDENCE_INTERVAL_SECOND_MASK = 70#

Confidence interval used to clean outliers.

qibocal.protocols.utils.effective_qubit_temperature(prob_0: array, prob_1: array, qubit_frequency: float, nshots: int)[source]#

Calculates the qubit effective temperature.

The formula used is the following one:

kB Teff = - hbar qubit_freq / ln(prob_1/prob_0)

Parameters:
  • prob_0 (np.array) – population 0 samples

  • prob_1 (np.array) – population 1 samples

  • qubit_frequency (float) – frequency of qubit

  • nshots (int) – number of shots

Returns:

effective temperature error (float): error on effective temperature

Return type:

temp (float)

qibocal.protocols.utils.calculate_frequencies(results, qubit_list)[source]#

Calculates outcome frequencies from individual shots. :param results: return of execute_pulse_sequence :type results: dict :param qubit_list: list of qubit ids executed in pulse sequence. :type qubit_list: list

Returns:

dictionary containing frequencies.

class qibocal.protocols.utils.PowerLevel(value)[source]#

Bases: str, Enum

Power Regime for Resonator Spectroscopy

high = 'high'#
low = 'low'#
_generate_next_value_(start, count, last_values)#

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_value: the last value assigned or None

_member_names_ = ['high', 'low']#
_member_map_ = {'high': PowerLevel.high, 'low': PowerLevel.low}#
_member_type_#

alias of str

_value2member_map_ = {'high': PowerLevel.high, 'low': PowerLevel.low}#
qibocal.protocols.utils.lorentzian(frequency, amplitude, center, sigma, offset)[source]#
qibocal.protocols.utils.lorentzian_fit(data, resonator_type=None, fit=None)[source]#
qibocal.protocols.utils.spectroscopy_plot(data, qubit, fit: Optional[Results] = None)[source]#
qibocal.protocols.utils.norm(x_mags)[source]#
qibocal.protocols.utils.cumulative(input_data, points)[source]#

Evaluates in data the cumulative distribution function of points.

qibocal.protocols.utils.fit_punchout(data: Data, fit_type: str)[source]#

Punchout fitting function.

Args:

data (Data): Punchout acquisition data. fit_type (str): Punchout type, it could be amp (amplitude) or att (attenuation).

Return:

List of dictionaries containing the low, high amplitude (attenuation) frequencies and the readout amplitude (attenuation) for each qubit.

qibocal.protocols.utils.eval_magnitude(value)[source]#

number of non decimal digits in value

qibocal.protocols.utils.round_report(measure: list) tuple[list, list][source]#

Rounds the measured values and their errors according to their significant digits.

Parameters:

measure (list) – Variable-Errors couples.

Returns:

A tuple with the lists of values and errors in the correct string format.

qibocal.protocols.utils.format_error_single_cell(measure: tuple)[source]#

Helper function to print mean value and error in one line.

qibocal.protocols.utils.chi2_reduced(observed: ndarray[Any, dtype[_ScalarType_co]], estimated: ndarray[Any, dtype[_ScalarType_co]], errors: ndarray[Any, dtype[_ScalarType_co]], dof: Optional[float] = None)[source]#
qibocal.protocols.utils.get_color_state0(number)[source]#
qibocal.protocols.utils.get_color_state1(number)[source]#
qibocal.protocols.utils.significant_digit(number: float)[source]#

Computes the position of the first significant digit of a given number.

Parameters:

number (Number) – number for which the significant digit is computed. Can be complex.

Returns:

position of the first significant digit. Returns -1 if the given number

is >= 1, = 0 or inf.

Return type:

int

qibocal.protocols.utils.evaluate_grid(data: ndarray[Any, dtype[_ScalarType_co]])[source]#

This function returns a matrix grid evaluated from the datapoints data.

qibocal.protocols.utils.plot_results(data: Data, qubit: Union[str, int], qubit_states: list, fit: Results)[source]#

Plots for the qubit and qutrit classification.

Parameters:
  • data (Data) – acquisition data

  • qubit (QubitID) – qubit

  • qubit_states (list) – list of qubit states available.

  • fit (Results) – fit results

qibocal.protocols.utils.table_dict(qubit: Union[list[Union[str, int]], str, int], names: list[str], values: list, display_error=False) dict[source]#

Build a dictionary to generate HTML table with table_html.

Parameters:
  • qubit (Union[list[QubitId], QubitId]) – If qubit is a scalar value,

  • repeated. (the "Qubit" entries will have only this value) –

  • names (list[str]) – List of the names of the parameters.

  • values (list) – List of the values of the parameters.

  • display_errors (bool) – if True, it means that values is a list of value-error couples,

  • False. (so an Errors key will be displayed in the dictionary. The function will round the couples according to their significant digits. Default) –

Returns:

A dictionary with keys Qubit, Parameters, Values (Errors).

qibocal.protocols.utils.table_html(data: dict) str[source]#

This function converts a dictionary into an HTML table.

Parameters:
  • data (dict) – the keys will be converted into table entries and the

  • table. (values will be the columns of the) –

  • strings. (Values must be valid HTML) –

Returns:

str

qibocal.protocols.utils.extract_feature(x: ndarray, y: ndarray, z: ndarray, feat: str, ci_first_mask: float = 99, ci_second_mask: float = 70)[source]#

Extract feature using confidence intervals.

Given a dataset of the form (x, y, z) where a spike or a valley is expected, this function discriminate the points (x, y) with a signal, from the pure noise and return the first ones.

A first mask is construct by looking at ci_first_mask confidence interval for each y bin. A second mask is applied by looking at ci_second_mask confidence interval to remove outliers. feat could be min or max, in the first case the function will look for valleys, otherwise for peaks.