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

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

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.

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[~types.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], float] = <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: 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.

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.

property waits: ndarray[tuple[int, ...], dtype[_ScalarType_co]]

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.QUANTILE_CONSTANT_RAMSEY = 1.5

See rabi.utils.QUANTILE_CONSTANT_RABI 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[int, ...], dtype[_ScalarType_co]] | float[source]

Dumped sinusoidal fit.

qibocal.protocols.ramsey.processing.fitting(x: ndarray[tuple[int, ...], dtype[_ScalarType_co]], y: ndarray[tuple[int, ...], dtype[_ScalarType_co]], y_err: ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None = None) 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 | None) 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[int, ...], dtype[_ScalarType_co]], fig: Figure) str[source]

Generate the fit trace and summary table for Ramsey data.

qibocal.protocols.ramsey.processing.signal_plot(waits: ndarray[tuple[int, ...], dtype[_ScalarType_co]], signal: ndarray[tuple[int, ...], dtype[_ScalarType_co]], target: Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], fit: RamseyResults | None, yaxis_title: str, error_bar: ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None = None) 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.