qibocal.protocols.ramsey package

Submodules

qibocal.protocols.ramsey.acquisition module

exception qibocal.protocols.ramsey.acquisition.InputError[source]

Bases: Exception

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class qibocal.protocols.ramsey.acquisition.RamseyParameters(delay: tuple[float, float, float] | None = None, delay_between_pulses_start: float | None = None, delay_between_pulses_end: float | None = None, delay_between_pulses_step: float | None = None, detuning: float | None = None)[source]

Bases: Parameters

Ramsey runcard inputs.

delay: tuple[float, float, float] | None = None

(start, stop, step).

Type:

Tuple of the sweeper parameters in the form

delay_between_pulses_start: float | None = None

Initial delay between RX(pi/2) pulses in ns.

delay_between_pulses_end: float | None = None

Final delay between RX(pi/2) pulses in ns.

delay_between_pulses_step: float | None = None

Step delay between RX(pi/2) pulses in ns.

detuning: float | None = None

Frequency detuning [Hz] (optional). If 0 standard Ramsey experiment is performed.

property delay_range: tuple[float, float, float]

Return a tuple with the delay times between pulses.

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.ramsey.acquisition.RamseyResults(detuning: float | None = None, frequency: dict[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, t2: dict[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, delta_phys: dict[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, delta_fitting: dict[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>, fitted_parameters: dict[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], list[float]] = <factory>)[source]

Bases: Results

Ramsey outputs.

detuning: float | None = None

Qubit frequency detuning.

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

Drive frequency [GHz] for each qubit.

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

T2 for each qubit [ns].

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

Drive frequency [Hz] correction for each qubit.

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

Raw drive frequency [Hz] correction for each qubit. including the detuning.

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

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

Raw fitting output.

class qibocal.protocols.ramsey.acquisition.RamseyData(detuning: float | None = None, qubit_freqs: dict[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float] = <factory>, data: dict[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[~numpy._typing._array_like._ScalarT]]] = <factory>)[source]

Bases: Data

Ramsey acquisition outputs.

_to_json(path: Path, filename: str)

Helper function to dump to json.

_to_npz(path: Path, filename: str)

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

static load_data(path: Path, filename: str)

Load data stored in a npz file.

static load_params(path: Path, filename: str)

Load parameters stored in a json file.

property pairs

Access qubit pairs 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.

detuning: float | None = None

Frequency detuning [Hz].

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

Qubit freqs for each qubit.

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

Raw data acquired.

property waits: ndarray[tuple[Any, ...], dtype[_ScalarT]]

Return a list with the waiting times without repetitions.

qibocal.protocols.ramsey.acquisition.single_qubit_ramsey_sequence(platform: Platform, target: Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], wait: int = 0, flux_pulse_amplitude: float | None = None) tuple[PulseSequence, PulseSequence, list[Pulse | Delay]][source]

Pulse sequence used in Ramsey (detuned) experiments.

The pulse sequence is the following:

RX90 – wait – RX90 – MZ

qibocal.protocols.ramsey.acquisition.ramsey_sequence(platform: Platform, targets: list[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], wait: int = 0, flux_pulse_amplitude: float | None = None) tuple[PulseSequence, PulseSequence, list[Pulse | Delay]][source]

Pulse sequence used in Ramsey (detuned) experiments. To be used to run in parallel multiple Ramsey sequences on a qubit list.

The pulse sequence is the following:

RX90 – wait – RX90 – MZ

qibocal.protocols.ramsey.acquisition.ramsey_and_acquisition_sequence(platform: Platform, targets: list[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], wait: int = 0, flux_pulse_amplitude: float | None = None) dict[PulseSequence, list[Pulse | Delay]][source]

Wrapper to generate the Ramsey sequence and the acquisition sequence together, where no other pulse has to be added.

qibocal.protocols.ramsey.acquisition.execute_experiment(sequence: PulseSequence, delays: list[Annotated[Align | Pulse | Delay | VirtualZ | Acquisition | Readout, FieldInfo(annotation=NoneType, required=True, discriminator='kind')]], platform: Platform, targets: list[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], params: RamseyParameters, return_probs: bool) dict[Annotated[UUID, UuidVersion(uuid_version=4)], Results][source]

Execute Ramsey experiment on the platform.

qibocal.protocols.ramsey.classification module

qibocal.protocols.ramsey.classification.ramsey = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function ramsey_update>, two_qubit_gates=False)

Ramsey Protocol object.

The protocol consists in applying the following pulse sequence: RX90 - wait - RX90 - MZ for different waiting times wait. The range of waiting times is defined through the attributes delay_between_pulses_* available in RamseyParameters. The final range will be constructed using np.arange. It is possible to detune the drive frequency using the parameter detuning in RamseyParameters which will increment the drive frequency accordingly. Currently when detuning==0 it will be performed a sweep over the waiting values if detuning is not zero, all sequences with different waiting value will be executed sequentially. The following protocol will display on the y-axis the probability of finding the ground state, therefore it is advise to execute it only after having performed the single shot classification.

qibocal.protocols.ramsey.processing module

RAMSEY protocol processing utilities.

Contains fitting routines, result transformations, and figure generation helpers for Ramsey experiments.

qibocal.protocols.ramsey.processing.MAXIMUM_FIT_POINTS = 1000

maximum number of points to use when plotting fit results.

qibocal.protocols.ramsey.processing.DAMPED_CONSTANT = 1.5

See rabi.utils.QUANTILE_CONSTANT for details.

In general in Ramsey it’s intended to observe the decay of the signal due to decoherence, hence we need to correct and decrease a little the value of rabi.utils.DAMPED_CONSTANT; Indeed, for damped oscillations, the factor is not easily determined, since the value associated to a certain quantile depends on the observation window extent, and the ratio between the decay rate and the oscillation.

Assuming a mild decay, and we can approximate this factor with the same one for the pure oscillation. This can be assumed to be slightly decreased because of the dampening, but there is no general control about how much. By reducing the amplitude by this rough 30%, the estimation will lend closer to the actual amplitude. We rely anyhow on the fit to determine the precise value.

qibocal.protocols.ramsey.processing.ramsey_update(results: RamseyResults, platform: CalibrationPlatform, target: Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]) None[source]

Update the platform calibration with the results of the Ramsey experiment.

qibocal.protocols.ramsey.processing.ramsey_fit(x, offset, amplitude, delta, phase, decay) ndarray[tuple[Any, ...], dtype[_ScalarT]] | float[source]

Dumped sinusoidal fit.

qibocal.protocols.ramsey.processing.fitting(x: list, y: list) tuple[list[float], list[float]][source]

Given the inputs list x and outputs one y, this function fits the ramsey_fit function and returns a list with the fit parameters.

qibocal.protocols.ramsey.processing.process_fit(popt: list[float], perr: list[float], qubit_frequency: float, detuning: float) tuple[list[float], list[float], list[float], list[float], list[float]][source]

Processing Ramsey fitting results.

qibocal.protocols.ramsey.processing.fit_plot(target: Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], fit: RamseyResults, waits: ndarray[tuple[Any, ...], dtype[_ScalarT]], fig: Figure) str[source]

Generate the fit trace and summary table for Ramsey data.

qibocal.protocols.ramsey.processing.signal_plot(waits: ndarray[tuple[Any, ...], dtype[_ScalarT]], signal: ndarray[tuple[Any, ...], dtype[_ScalarT]], target: Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], fit: RamseyResults | None, yaxis_title: str) tuple[list[Figure], str][source]

Create a signal scatter plot and optional fit report.

qibocal.protocols.ramsey.signal module

qibocal.protocols.ramsey.signal.ramsey_signal = Protocol(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function ramsey_update>, two_qubit_gates=False)

Ramsey Protocol object.

The protocol consists in applying the following pulse sequence: RX90 - wait - RX90 - MZ for different waiting times wait. The range of waiting times is defined through the attributes delay_between_pulses_* available in RamseyParameters. The final range will be constructed using np.arange. It is possible to detune the drive frequency using the parameter detuning in RamseyParameters which will increment the drive frequency accordingly. Currently when detuning==0 it will be performed a sweep over the waiting values if detuning is not zero, all sequences with different waiting value will be executed sequentially. The following protocol will display on the y-axis the signal amplitude.

qibocal.protocols.ramsey.zz_coupling module

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

Ramsey ZZ Protocol object.

This protocol measures the state-dependent frequency shift (ZZ interaction) between a selected target qubit and one spectator qubit. It performs two Ramsey experiments for each qubit in the target list:

  • “I” setup: spectator qubit remain in the ground state.

  • “X” setup: spectator qubit is excited before the Ramsey sequence.

The fitted Ramsey frequencies from these two experiments are compared to extract the conditional ZZ shift experienced by each measured qubit. The difference between the two fitted frequencies is reported as the ZZ interaction strength. Using the measured qubit frequencies, the target qubit frequency, and the anharmonicities, the routine also estimates the effective coupling strength between each qubit and the target qubit. This protocol is useful for characterizing residual static coupling and frequency shifts induced by an excited neighboring qubit. The plot output shows Ramsey traces in probability for both the I and X setups.