qibocal.protocols package#

class qibocal.protocols.Operation(value)[source]#

Bases: Enum

An enumeration.

resonator_spectroscopy = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
resonator_punchout = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
resonator_punchout_attenuation = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
resonator_flux = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
resonator_crosstalk = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
qubit_spectroscopy = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
qubit_flux = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
qubit_flux_tracking = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
qubit_crosstalk = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
rabi_amplitude = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
rabi_length = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
rabi_length_sequences = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
rabi_amplitude_signal = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
rabi_length_signal = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
ramsey = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
ramsey_signal = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
t1 = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
t1_signal = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
t1_sequences = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
t2 = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
t2_signal = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
t2_sequences = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
time_of_flight_readout = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#
single_shot_classification = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
spin_echo = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
spin_echo_signal = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
allxy = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#
allxy_drag_pulse_tuning = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#
drag_tuning = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
allxy_resonator_depletion_tuning = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#
flipping = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
dispersive_shift = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
chevron = Routine(acquisition=<function _aquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=True)#
chevron_signal = Routine(acquisition=<function _aquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=True)#
cz_virtualz = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=True)#
standard_rb = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#
filtered_rb = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#
resonator_frequency = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
fast_reset = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#
zeno = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
zeno_signal = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
chsh_pulses = Routine(acquisition=<function _acquisition_pulses>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=True)#
readout_characterization = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
chsh_circuits = Routine(acquisition=<function _acquisition_circuits>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=True)#
readout_mitigation_matrix = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#
twpa_frequency = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
twpa_frequency_SNR = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#
twpa_power = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
twpa_power_SNR = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#
twpa_frequency_power = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
rabi_amplitude_ef = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
qubit_spectroscopy_ef = Routine(acquisition=<function _acquisition>, fit=<function _fit_ef>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
qutrit_classification = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#
resonator_amplitude = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
avoided_crossing = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#
dispersive_shift_qutrit = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#
coupler_resonator_spectroscopy = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
coupler_qubit_spectroscopy = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
cz_virtualz_signal = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=True)#
coupler_chevron = Routine(acquisition=<function _aquisition>, fit=<function _fit>, report=<function plot>, update=<function _dummy_update>, two_qubit_gates=True)#
flipping_signal = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
calibrate_state_discrimination = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#
state_tomography = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _dummy_update>, two_qubit_gates=False)#

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

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

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.

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

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

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

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

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.

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.

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.

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.drag_fit(x, offset, amplitude, period, phase)[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.

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.

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.

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.

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.

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.

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.flipping_fit(x, offset, amplitude, omega, phase, gamma)[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_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.

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.

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.

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.

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

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

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

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

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.

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

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.

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

data: dict#

Raw data acquited.

add(qubits, state, freqs)[source]#
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.

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.

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.

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

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.

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.

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

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.

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.

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

classmethod load(path)[source]#

Load data and parameters.

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.

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.

classmethod load(path)[source]#

Load data and parameters.

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.

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.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.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'#
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.