qibocal.protocols.flux_dependence package

Submodules

qibocal.protocols.flux_dependence.cryoscope module

Cryoscope experiment.

class qibocal.protocols.flux_dependence.cryoscope.CryoscopeData(flux_pulse_amplitude: float, fir: int, sampling_rate: float, flux_pulse_durations: list[float], flux_coefficients: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, has_filters: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], bool] = <factory>, data: dict[tuple[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], str], ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[~numpy.float64]]] = <factory>, iir: bool = False)[source]

Bases: Data

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

flux_pulse_amplitude: float

Flux pulse amplitude.

fir: int

Number of feedforward taps to be optimized after IIR.

sampling_rate: float

Sampling rate of the instrument [GSps].

flux_pulse_durations: list[float]

Durations of the flux pulses [ns]. Same for all qubits.

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

Flux - amplitude relation coefficients obtained from flux_amplitude_frequency routine

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

Check if there are filters already.

data: dict[tuple[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], str], ndarray[tuple[Any, ...], dtype[float64]]]
iir: bool = False

Whether an IIR filter should be determined. If False only an FIR filter is determined.

class qibocal.protocols.flux_dependence.cryoscope.CryoscopeResults(fitted_parameters: dict[tuple[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], str], list[float]] = <factory>, detuning: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, amplitude: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, step_response: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, exp_amplitude: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float] = <factory>, tau: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float] = <factory>, fir_taps: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, feedforward_taps: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, feedforward_taps_iir: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, feedback_taps: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, iir: bool = False)[source]

Bases: Results

Cryoscope outputs.

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

Fitted <X> and <Y> for each qubit.

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

Expected detuning.

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

Flux amplitude computed from detuning.

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

Waveform normalized to 1.

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

A parameters for the exp decay approximation

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

Time decay constant in exp decay approximation [ns].

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

FIR feedforward taps

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

feedforward taps

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

feedforward taps for IIR

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

feedback taps

iir: bool = False

Whether an IIR filter should be determined. If False only an FIR filter is determined.

_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.flux_dependence.flux_amplitude_frequency module

Experiment to compute detuning from flux pulses.

qibocal.protocols.flux_dependence.flux_gate module

FluxGate experiment, implementation of Z gate using flux pulse.

qibocal.protocols.flux_dependence.qubit_crosstalk module

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

Qubit crosstalk Protocol object

qibocal.protocols.flux_dependence.qubit_flux_dependence module

class qibocal.protocols.flux_dependence.qubit_flux_dependence.QubitFluxData(resonator_type: str, charging_energy: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float] = <factory>, qubit_frequency: 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([('freq', '<f8'), ('bias', '<f8'), ('signal', '<f8')])]]] = <factory>)[source]

Bases: Data

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

resonator_type: str

Resonator type.

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

Qubit charging energy.

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

Qubit charging energy.

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

Raw data acquired.

register_qubit(qubit, freq, bias, signal)[source]

Store output for single qubit.

class qibocal.protocols.flux_dependence.qubit_flux_dependence.QubitFluxParameters(drive_amplitude: float = 0.01, drive_duration: int = 2000, *, freq_width: int | None = None, freq_step: int | None = None, frequency: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int] | None = None, bias_width: float | None = None, bias_step: float | None = None, bias: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int] | None = None)[source]

Bases: FluxFrequencySweepParameters

QubitFlux runcard inputs.

drive_amplitude: float = 0.01

Amplitude of the drive pulse.

drive_duration: int = 2000

Duration of the drive pulse.

bias: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int] | None = None

Bias [a.u.] range for sweep.

bias_range(center: float = 0.0) tuple[float, float, float]
bias_step: float | None = None

Bias step for sweep [a.u.].

bias_width: float | None = None

Width for bias sweep [a.u.].

freq_step: int | None = None

Frequency step for sweep [Hz].

freq_width: int | None = None

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

frequency: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int] | None = None

Frequency [Hz] range for sweep.

frequency_range(center: float = 0.0) tuple[float, float, float]
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.flux_dependence.qubit_flux_dependence.QubitFluxResults(sweetspot: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float] = <factory>, frequency: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float] = <factory>, fitted_parameters: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], dict[str, float]] = <factory>, matrix_element: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float] = <factory>, successful_fit: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], bool] = <factory>, peak_biases: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, peak_frequencies: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[int]] = <factory>, inliers: dict[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[bool]] = <factory>)[source]

Bases: Results

QubitFlux outputs.

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

Sweetspot for each qubit.

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

Drive frequency for each qubit.

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

Raw fitting output.

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

V_ii coefficient.

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

flag for each qubit to see whether the fit was successful.

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

Bias of extracted peaks (for visualization).

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

Frequency of extracted peaks (for visualization).

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

Boolean mask indicating which peaks are inliers (for visualization).

_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.flux_dependence.qubit_flux_dependence.QubitFluxType = dtype([('freq', '<f8'), ('bias', '<f8'), ('signal', '<f8')])

Custom dtype for resonator flux dependence.

qibocal.protocols.flux_dependence.qubit_flux_dependence.qubit_flux = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)

QubitFlux Protocol object.

qibocal.protocols.flux_dependence.qubit_vz module

Experiment to measure the Z rotation of a qubit under a rectangular flux pulse.

qibocal.protocols.flux_dependence.resonator_flux_dependence module

class qibocal.protocols.flux_dependence.resonator_flux_dependence.ResonatorFluxParameters(bias_center: float | None = None, freq_center: float | None = None, *, freq_width: int | None = None, freq_step: int | None = None, frequency: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int] | None = None, bias_width: float | None = None, bias_step: float | None = None, bias: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int] | None = None)[source]

Bases: FluxFrequencySweepParameters

ResonatorFlux runcard inputs.

bias_center: float | None = None
freq_center: float | None = None
bias: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int] | None = None

Bias [a.u.] range for sweep.

bias_range(center: float = 0.0) tuple[float, float, float]
bias_step: float | None = None

Bias step for sweep [a.u.].

bias_width: float | None = None

Width for bias sweep [a.u.].

freq_step: int | None = None

Frequency step for sweep [Hz].

freq_width: int | None = None

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

frequency: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int] | None = None

Frequency [Hz] range for sweep.

frequency_range(center: float = 0.0) tuple[float, float, float]
nshots: int

Number of executions on hardware.

relaxation_time: float

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

qibocal.protocols.flux_dependence.resonator_flux_dependence.resonator_flux = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)

ResonatorFlux Protocol object.

qibocal.protocols.flux_dependence.utils module

class qibocal.protocols.flux_dependence.utils.FluxFrequencySweepParameters(*, freq_width: int | None = None, freq_step: int | None = None, frequency: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int] | None = None, bias_width: float | None = None, bias_step: float | None = None, bias: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int] | None = None)[source]

Bases: Parameters

Parameters to define flux DC sweep.

freq_width: int | None = None

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

freq_step: int | None = None

Frequency step for sweep [Hz].

frequency: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int] | None = None

Frequency [Hz] range for sweep.

bias_width: float | None = None

Width for bias sweep [a.u.].

bias_step: float | None = None

Bias step for sweep [a.u.].

bias: tuple[float, float, float] | tuple[Literal['linspace'], float, float, int] | tuple[Literal['window'], float, float, float] | tuple[Literal['linwindow'], float, float, int] | tuple[Literal['center'], float, float] | tuple[Literal['lincenter'], float, int] | tuple[Literal['asym'], tuple[float, float], float] | tuple[Literal['linasym'], tuple[float, float], int] | None = None

Bias [a.u.] range for sweep.

frequency_range(center: float = 0.0) tuple[float, float, float][source]
bias_range(center: float = 0.0) tuple[float, float, float][source]
nshots: int

Number of executions on hardware.

relaxation_time: float

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

qibocal.protocols.flux_dependence.utils.create_data_array(freq, bias, signal, dtype)[source]

Create custom dtype array for acquired data.

qibocal.protocols.flux_dependence.utils.flux_dependence_plot(data, fit, qubit, inliers, outliers, fit_function)[source]
qibocal.protocols.flux_dependence.utils.flux_crosstalk_plot(data, qubit, fit, fit_function)[source]
qibocal.protocols.flux_dependence.utils.G_f_d(xi, xj, offset, d, crosstalk_element, normalization)[source]

Auxiliary function to calculate qubit frequency as a function of bias.

It also determines the flux dependence of \(E_J\),:math:E_J(phi)=E_J(0)G_f_d. For more details see: https://arxiv.org/pdf/cond-mat/0703002.pdf

Parameters:
  • xi (float) – bias of target qubit

  • xj (float) – bias of neighbor qubit

  • offset (float) – phase_offset [a.u.].

  • d (float) – asymmetry between the two junctions of the transmon. Typically denoted as \(d\). \(d = (E_J^1 - E_J^2) / (E_J^1 + E_J^2)\).

  • crosstalk_element (float) – off-diagonal crosstalk matrix element

  • normalization (float) – diagonal crosstalk matrix element

Returns:

(float)

qibocal.protocols.flux_dependence.utils.transmon_frequency(xi, xj, w_max, d, normalization, offset, crosstalk_element, charging_energy)[source]

Approximation to transmon frequency.

The formula holds in the transmon regime Ej / Ec >> 1.

See https://arxiv.org/pdf/cond-mat/0703002.pdf for the complete formula.

Parameters:
  • xi (float) – bias of target qubit

  • xj (float) – bias of neighbor qubit

  • w_max (float) – maximum frequency :math:`w_{max} = sqrt{8 E_j E_c}

  • d (float) – asymmetry between the two junctions of the transmon. Typically denoted as \(d\). \(d = (E_J^1 - E_J^2) / (E_J^1 + E_J^2)\).

  • normalization (float) – diagonal crosstalk matrix element

  • offset (float) – phase_offset [a.u.].

  • crosstalk_element (float) – off-diagonal crosstalk matrix element

  • charging_energy – Ec / h

qibocal.protocols.flux_dependence.utils.transmon_readout_frequency(xi, xj, w_max, d, normalization, crosstalk_element, offset, resonator_freq, g, charging_energy)[source]

Approximation to flux dependent resonator frequency.

The formula holds in the transmon regime Ej / Ec >> 1.

See https://arxiv.org/pdf/cond-mat/0703002.pdf for the complete formula.

Parameters:
  • xi (float) – bias of target qubit

  • xj (float) – bias of neighbor qubit

  • w_max (float) – maximum frequency :math:`w_{max} = sqrt{8 E_j E_c}

  • d (float) – asymmetry between the two junctions of the transmon. Typically denoted as \(d\). \(d = (E_J^1 - E_J^2) / (E_J^1 + E_J^2)\).

  • normalization (float) – diagonal crosstalk matrix element

  • offset (float) – phase_offset [a.u.].

  • crosstalk_element (float) – off-diagonal crosstalk matrix element

  • resonator_freq (float) – bare resonator frequency

  • g (float) – readout coupling.

  • charging_energy – Ec / h

qibocal.protocols.flux_dependence.utils.filter_data(matrix_z: ndarray)[source]

Filter data with a ZCA transformation and then a unit-variance Gaussian.

qibocal.protocols.flux_dependence.utils.flux_extract_feature(x: ndarray, y: ndarray, z: ndarray, find_min: bool, min_points: int = 5) tuple[ndarray, ndarray][source]

Extract features of the signal by filtering out background noise.

It first applies a custom filter mask (see custom_filter_mask) and then finds the biggest peak for each DC bias value; the masked signal is then clustered (see clustering) in order to classify the relevant signal for the experiment. If find_min is set to True it finds minimum peaks of the input signal; min_points is the minimum number of points for a cluster to be considered relevant signal. Position of the relevant signal is returned.

qibocal.protocols.flux_dependence.utils._function_dof(fit_function) int[source]
qibocal.protocols.flux_dependence.utils.select_sweetspot(offset: float, normalization: float, bias_window: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], max_distance: float = 0)[source]

Select the closest flux sweetspot that lies in the acquired bias window.

The fitted model is periodic in offset + normalization * bias. There is a sweetspot for every integer n at bias = (n - offset) / normalization.

If no sweetspot lies inside the acquired bias window, the closest sweetspot outside the window is selected unless it is farther than max_distance.

qibocal.protocols.flux_dependence.utils._continuity_score(xvals: ndarray[tuple[Any, ...], dtype[floating]], yvals: ndarray[tuple[Any, ...], dtype[floating]], inliers: ndarray[tuple[Any, ...], dtype[bool]]) int[source]

Score consecutive inlier runs quadratically, counting each y-value once.

qibocal.protocols.flux_dependence.utils.ransac_fit(xvals: ndarray[tuple[Any, ...], dtype[floating]], yvals: ndarray[tuple[Any, ...], dtype[floating]], fit_function: Callable[[...], ndarray], residual_threshold: float, min_trials: int = 100, max_trials: int = 5000, stop_probability: float = 0.999, random_state: int = 0, bounds: tuple[_Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]] | None = None) tuple[ndarray[tuple[Any, ...], dtype[floating]], ndarray[tuple[Any, ...], dtype[bool]]][source]

Fit a model to data using RANSAC, ignoring outliers.

Repeatedly fits fit_function to minimal random subsets of the data (sized to the function’s degrees of freedom). Points with residual below residual_threshold are inliers. Candidate models are scored by summing the squared lengths of consecutive inlier runs along the x-axis, favoring a continuous feature over scattered noise.

The number of trials adapts dynamically based on the current inlier ratio, following the standard RANSAC stopping criterion, and is bounded by min_trials and max_trials. A final least-squares refit is performed on the best inlier set.

Returns:

Tuple of (fit parameters, boolean array of inliers).