qibocal.protocols.rabi package

Submodules

qibocal.protocols.rabi.amplitude module

qibocal.protocols.rabi.amplitude.rabi_amplitude = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)

RabiAmplitude Protocol object.

qibocal.protocols.rabi.amplitude_frequency module

Rabi experiment that sweeps amplitude and frequency.

qibocal.protocols.rabi.amplitude_frequency.rabi_amplitude_frequency = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)

Rabi amplitude with frequency tuning.

qibocal.protocols.rabi.amplitude_frequency_signal module

Rabi experiment that sweeps amplitude and frequency (with probability).

class qibocal.protocols.rabi.amplitude_frequency_signal.RabiAmplitudeFreqSignalData(rx90: bool, durations: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float] = <factory>, data: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[dtype([('amp', '<f8'), ('freq', '<f8'), ('i', '<f8'), ('q', '<f8')])]]] = <factory>)[source]

Bases: Data

RabiAmplitudeFreqSignal 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: list[~typing.Annotated[tuple[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], ~pydantic.functional_validators.BeforeValidator(func=~qibocal.calibration.calibration.<lambda>, json_schema_input_type=PydanticUndefined), ~pydantic.functional_serializers.PlainSerializer(func=~qibocal.calibration.calibration.<lambda>, return_type=PydanticUndefined, when_used=always)]]

Access qubit pairs from data structure.

property params: dict

Convert non-arrays attributes into dict.

property qubits: list[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]]

Access qubits from data structure.

save(path: Path, filename: str = 'data')

Store data to file.

rx90: bool

Pi or Pi_half calibration

durations: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Pulse durations provided by the user.

data: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ndarray[tuple[Any, ...], dtype[dtype(['amp', '<f8', 'freq', '<f8', 'i', '<f8', 'q', '<f8'])]]]

Raw data acquired.

register_qubit(qubit, freq, amp, i, q)[source]

Store output for single qubit.

amplitudes(qubit)[source]

Unique qubit amplitudes.

frequencies(qubit)[source]

Unique qubit frequency.

data_at_frequency(freq: float, qubit: Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])])[source]

Return the data subset for a selected drive frequency.

Parameters:
  • freq – Frequency value used to filter the recorded data.

  • qubit – Identifier of the qubit whose data should be returned.

Returns:

The data restricted to the requested frequency.

class qibocal.protocols.rabi.amplitude_frequency_signal.RabiAmplitudeFrequencySignalParameters(min_amp: float, max_amp: float, step_amp: float, left_freq_offset: int, right_freq_offset: int, step_freq: int, rx90: bool = False, pulse_length: float | None = None)[source]

Bases: Parameters

RabiAmplitudeFrequency runcard inputs.

min_amp: float

Minimum amplitude.

max_amp: float

Maximum amplitude.

step_amp: float

Step amplitude.

left_freq_offset: int

sweep starts at channel_freq + left_freq_offset.

Type:

Left frequency offset

right_freq_offset: int

sweep ends at channel_freq + right_freq_offset.

Type:

Right frequency offset

step_freq: int

Frequency to use as step for the scan.

rx90: bool = False

Calibration of native pi pulse, if true calibrates pi/2 pulse

pulse_length: float | None = None

RX pulse duration [ns].

nshots: int

Number of executions on hardware.

relaxation_time: float

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

class qibocal.protocols.rabi.amplitude_frequency_signal.RabiAmplitudeSignalResults(amplitude: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float], length: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float], fitted_parameters: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]], rx90: bool)[source]

Bases: Results

RabiAmplitude outputs.

amplitude: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Pulse amplitude. Same for all qubits.

length: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Pulse duration for each qubit.

fitted_parameters: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]]

Raw fitted parameters.

rx90: bool

Pi or Pi_half calibration

_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, filename: str = 'results')

Store results to file.

qibocal.protocols.rabi.amplitude_frequency_signal._update(results: RabiAmplitudeFrequencySignalResults, platform: CalibrationPlatform, target: Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])])[source]
qibocal.protocols.rabi.amplitude_frequency_signal.rabi_amplitude_frequency_signal = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)

Rabi amplitude with frequency tuning.

qibocal.protocols.rabi.amplitude_signal module

qibocal.protocols.rabi.amplitude_signal.RabiAmpSignalType = dtype([('amp', '<f8'), ('i', '<f8'), ('q', '<f8')])

Custom dtype for rabi amplitude.

class qibocal.protocols.rabi.amplitude_signal.RabiAmplitudeSignalData(rx90: bool, durations: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float] = <factory>, data: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[dtype([('amp', '<f8'), ('i', '<f8'), ('q', '<f8')])]]] = <factory>)[source]

Bases: Data

RabiAmplitudeSignal 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: list[~typing.Annotated[tuple[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], ~pydantic.functional_validators.BeforeValidator(func=~qibocal.calibration.calibration.<lambda>, json_schema_input_type=PydanticUndefined), ~pydantic.functional_serializers.PlainSerializer(func=~qibocal.calibration.calibration.<lambda>, return_type=PydanticUndefined, when_used=always)]]

Access qubit pairs from data structure.

property params: dict

Convert non-arrays attributes into dict.

property qubits: list[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]]

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, filename: str = 'data')

Store data to file.

rx90: bool

Pi or Pi_half calibration

durations: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Pulse durations provided by the user.

data: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ndarray[tuple[Any, ...], dtype[dtype(['amp', '<f8', 'i', '<f8', 'q', '<f8'])]]]

Raw data acquired.

class qibocal.protocols.rabi.amplitude_signal.RabiAmplitudeSignalParameters(min_amp: float, max_amp: float, step_amp: float, pulse_length: float | None = None, rx90: bool = False)[source]

Bases: Parameters

RabiAmplitude runcard inputs.

min_amp: float

Minimum amplitude.

max_amp: float

Maximum amplitude.

step_amp: float

Step amplitude.

pulse_length: float | None = None

RX pulse duration [ns].

rx90: bool = False

Calibration of native pi pulse, if true calibrates pi/2 pulse

nshots: int

Number of executions on hardware.

relaxation_time: float

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

class qibocal.protocols.rabi.amplitude_signal.RabiAmplitudeSignalResults(amplitude: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float], length: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float], fitted_parameters: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]], rx90: bool)[source]

Bases: Results

RabiAmplitude outputs.

amplitude: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Pulse amplitude. Same for all qubits.

length: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Pulse duration for each qubit.

fitted_parameters: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]]

Raw fitted parameters.

rx90: bool

Pi or Pi_half calibration

_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, filename: str = 'results')

Store results to file.

qibocal.protocols.rabi.amplitude_signal._fit(data: RabiAmplitudeSignalData) → RabiAmplitudeSignalResults[source]

Post-processing for RabiAmplitude.

qibocal.protocols.rabi.amplitude_signal.rabi_amplitude_signal = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)

RabiAmplitude Protocol object.

qibocal.protocols.rabi.ef module

qibocal.protocols.rabi.ef.rabi_amplitude_ef = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)

RabiAmplitudeEF Protocol object.

qibocal.protocols.rabi.length module

qibocal.protocols.rabi.length.rabi_length = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)

RabiLength Protocol object.

qibocal.protocols.rabi.length_frequency module

Rabi experiment that sweeps length and frequency (with probability).

qibocal.protocols.rabi.length_frequency.rabi_length_frequency = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)

Rabi length with frequency tuning.

qibocal.protocols.rabi.length_frequency_signal module

Rabi experiment that sweeps length and frequency.

class qibocal.protocols.rabi.length_frequency_signal.RabiLengthFreqSignalData(rx90: bool, amplitudes: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float] = <factory>, data: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[dtype([('length', '<f8'), ('freq', '<f8'), ('i', '<f8'), ('q', '<f8')])]]] = <factory>)[source]

Bases: Data

RabiLengthFreqSignal 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: list[~typing.Annotated[tuple[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], ~pydantic.functional_validators.BeforeValidator(func=~qibocal.calibration.calibration.<lambda>, json_schema_input_type=PydanticUndefined), ~pydantic.functional_serializers.PlainSerializer(func=~qibocal.calibration.calibration.<lambda>, return_type=PydanticUndefined, when_used=always)]]

Access qubit pairs from data structure.

property params: dict

Convert non-arrays attributes into dict.

property qubits: list[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]]

Access qubits from data structure.

save(path: Path, filename: str = 'data')

Store data to file.

rx90: bool

Pi or Pi_half calibration

amplitudes: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Pulse amplitudes provided by the user.

data: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ndarray[tuple[Any, ...], dtype[dtype(['length', '<f8', 'freq', '<f8', 'i', '<f8', 'q', '<f8'])]]]

Raw data acquired.

register_qubit(qubit, freq, lens, i, q)[source]

Store output for single qubit.

durations(qubit) → ndarray[tuple[Any, ...], dtype[_ScalarT]][source]

Unique qubit lengths.

frequencies(qubit) → ndarray[tuple[Any, ...], dtype[_ScalarT]][source]

Unique qubit frequency.

data_at_frequency(freq: float, qubit: Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])])[source]

Return the data subset for a selected drive frequency.

Parameters:
  • freq – Frequency value used to filter the recorded data.

  • qubit – Identifier of the qubit whose data should be returned.

Returns:

The data restricted to the requested frequency.

class qibocal.protocols.rabi.length_frequency_signal.RabiLengthFrequencySignalParameters(pulse_duration_start: float, pulse_duration_end: float, pulse_duration_step: float, left_freq_offset: int, right_freq_offset: int, step_freq: int, pulse_amplitude: float | None = None, rx90: bool = False, interpolated_sweeper: bool = False)[source]

Bases: Parameters

RabiLengthFrequency runcard inputs.

pulse_duration_start: float

Initial pi pulse duration [ns].

pulse_duration_end: float

Final pi pulse duration [ns].

pulse_duration_step: float

Step pi pulse duration [ns].

left_freq_offset: int

sweep starts at channel_freq + left_freq_offset.

Type:

Left frequency offset

right_freq_offset: int

sweep ends at channel_freq + right_freq_offset.

Type:

Right frequency offset

step_freq: int

Frequency to use as step for the scan.

pulse_amplitude: float | None = None

Pi pulse amplitude. Same for all qubits.

rx90: bool = False

Calibration of native pi pulse, if true calibrates pi/2 pulse

interpolated_sweeper: bool = False

Use real-time interpolation if supported by instruments.

nshots: int

Number of executions on hardware.

relaxation_time: float

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

class qibocal.protocols.rabi.length_frequency_signal.RabiLengthFrequencySignalResults(length: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float], amplitude: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float], fitted_parameters: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]], rx90: bool, frequency: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float])[source]

Bases: RabiLengthSignalResults

RabiLengthFrequency outputs.

rx90: bool

Pi or Pi_half calibration

frequency: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Drive frequency 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, filename: str = 'results')

Store results to file.

length: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Pulse duration for each qubit.

amplitude: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Pulse amplitude. Same for all qubits.

fitted_parameters: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]]

Raw fitting output.

qibocal.protocols.rabi.length_frequency_signal._update(results: RabiLengthFrequencySignalResults, platform: CalibrationPlatform, target: Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])])[source]
qibocal.protocols.rabi.length_frequency_signal.rabi_length_frequency_signal = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)

Rabi length with frequency tuning.

qibocal.protocols.rabi.length_signal module

class qibocal.protocols.rabi.length_signal.RabiLengthSignalResults(length: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float], amplitude: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float], fitted_parameters: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]], rx90: bool)[source]

Bases: Results

RabiLengthSignal outputs.

length: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Pulse duration for each qubit.

amplitude: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float]

Pulse amplitude. Same for all qubits.

fitted_parameters: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]]

Raw fitting output.

rx90: bool

Pi or Pi_half calibration

_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, filename: str = 'results')

Store results to file.

qibocal.protocols.rabi.length_signal.rabi_length_signal = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)

RabiLength Protocol object.

qibocal.protocols.rabi.utils module

qibocal.protocols.rabi.utils.QUANTILE_CONSTANT_RABI = 1.5

Scaling factor to recover signal amplitude from quantiles.

Measuring intermediate quantiles is less noise sensitive then measuring extremal points (minimum and maximum), but it is not a direct measurement of the amplitude itself. For pure sinusoidal oscillations, the scaling from the value associated to a given quantile and the amplitude is asymptotically fixed, for a large number of oscillations. Assuming that samples are dense enough that they could be represented by the continuous distribution, essentially projecting a uniform measure over an interval through a single sinusoidal oscillation.

qibocal.protocols.rabi.utils.rabi_amplitude_function(x, offset, amplitude, period, phase)[source]

Fit function of Rabi amplitude signal experiment.

Parameters:

x – Input data.

qibocal.protocols.rabi.utils.rabi_length_function(x, offset, amplitude, period, phase, t2_inv)[source]

Fit function of Rabi length signal experiment.

Parameters:

x – Input data.

qibocal.protocols.rabi.utils.rabi_initial_guess(x, y, experiment: str, signal: bool, axis: int = -1)[source]
qibocal.protocols.rabi.utils.pca_matrix(data, sweep_field: str, freq_field: str)[source]

Compute the first PCA component for each frequency slice.

The 2D matrix is built from the coordinate values stored in the record array, so it does not depend on the row ordering of the data.

Parameters:
  • data – Per-qubit record array with fields for the sweep parameter, the frequency, and the I/Q quadratures.

  • sweep_field – Name of the sweep parameter field (e.g. "amp" or "length").

  • freq_field – Name of the frequency field.

Returns:

Array of shape (n_freqs, n_sweep) with the first PCA component for each frequency slice.

qibocal.protocols.rabi.utils.plot(data, qubit, fit, rx90)[source]

Generate a visualization of Rabi experiment results.

Creates a two-subplot figure displaying: Panel 1: IQ plane with quadrature data and PCA components Panel 2: Principal axis projection with optional fit curve

qibocal.protocols.rabi.utils.plot_probabilities(data, qubit, fit, rx90)[source]
qibocal.protocols.rabi.utils.extract_rabi(data)[source]

Extract Rabi fit info.

qibocal.protocols.rabi.utils.period_correction_factor(phase: float)[source]

Correct period by taking phase into account.

https://github.com/qiboteam/qibocal/issues/656

We want to find the first maximum or minimum which will correspond to an exchange of population between 0 and 1. To find it we need to solve the following equation \(\cos(2 \pi x / T + \phi) = \pm 1\) which will give us the following solution

\[x = ( k - \phi / \pi) T / 2\]

for integer \(k\), which is chosen such that we get the smallest multiplicative correction compared to \(T/2\).

qibocal.protocols.rabi.utils.sequence_amplitude(targets: list[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], params: Parameters, platform: Platform, rx90: bool) → tuple[PulseSequence, dict, dict, dict][source]

Return sequence for rabi amplitude.

qibocal.protocols.rabi.utils.sequence_length(targets: list[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], params: Parameters, platform: Platform, rx90: bool, use_align: bool = False) → tuple[PulseSequence, dict, dict, dict, dict][source]

Return sequence for rabi length.

qibocal.protocols.rabi.utils.fit_length_function(x, y, guess, sigma=None) → tuple[list[float], float][source]
qibocal.protocols.rabi.utils.fit_amplitude_function(x, y, guess, sigma=None) → tuple[list[float], float][source]