qibocal.protocols.ramsey package#

Submodules#

qibocal.protocols.ramsey.ramsey module#

class qibocal.protocols.ramsey.ramsey.RamseyParameters(delay_between_pulses_start: int, delay_between_pulses_end: int, delay_between_pulses_step: int, detuning: Optional[int] = None, unrolling: bool = False)[source]#

Bases: RamseySignalParameters

Ramsey runcard inputs.

detuning: Optional[int] = None#

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

hardware_average: bool = False#

By default hardware average will be performed.

unrolling: bool = False#

If True it uses sequence unrolling to deploy multiple sequences in a single instrument call. Defaults to False.

delay_between_pulses_start: int#

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

delay_between_pulses_end: int#

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

delay_between_pulses_step: int#

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

nshots: int#

Number of executions on hardware.

relaxation_time: float#

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

class qibocal.protocols.ramsey.ramsey.RamseyResults(detuning: float, frequency: dict[Union[str, int], Union[float, list[float]]], t2: dict[Union[str, int], Union[float, list[float]]], delta_phys: dict[Union[str, int], Union[float, list[float]]], delta_fitting: dict[Union[str, int], Union[float, list[float]]], fitted_parameters: dict[Union[str, int], list[float]], chi2: dict[Union[str, int], tuple[float, Optional[float]]])[source]#

Bases: RamseySignalResults

Ramsey outputs.

chi2: dict[Union[str, int], tuple[float, Optional[float]]]#

Chi squared estimate mean value and error.

_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)#

Store results to file.

detuning: float#

Qubit frequency detuning.

frequency: dict[QubitId, Union[float, list[float]]]#

Drive frequency [GHz] for each qubit.

t2: dict[QubitId, Union[float, list[float]]]#

T2 for each qubit [ns].

delta_phys: dict[QubitId, Union[float, list[float]]]#

Drive frequency [Hz] correction for each qubit.

delta_fitting: dict[QubitId, Union[float, list[float]]]#

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

fitted_parameters: dict[QubitId, list[float]]#

Raw fitting output.

qibocal.protocols.ramsey.ramsey.RamseyType = dtype([('wait', '<f8'), ('prob', '<f8'), ('errors', '<f8')])#

Custom dtype for coherence routines.

class qibocal.protocols.ramsey.ramsey.RamseyData(detuning: ~typing.Optional[int] = None, qubit_freqs: dict[typing.Union[str, int], float] = <factory>, data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('wait', '<f8'), ('prob', '<f8'), ('errors', '<f8')])]]] = <factory>)[source]#

Bases: RamseySignalData

Ramsey acquisition outputs.

data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('wait', '<f8'), ('prob', '<f8'), ('errors', '<f8')])]]]#

Raw data acquired.

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

detuning: Optional[int] = None#

Frequency detuning [Hz].

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 ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

property qubits#

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

Store data to file.

property waits#

Return a list with the waiting times without repetitions.

qubit_freqs: dict[Union[str, int], float]#

Qubit freqs for each qubit.

qibocal.protocols.ramsey.ramsey._acquisition(params: RamseyParameters, platform: Platform, targets: list[Union[str, int]]) RamseyData[source]#

Data acquisition for Ramsey Experiment (detuned).

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. By providing the option unrolling=True in RamseyParameters the sequences will be unrolled when the frequency is detuned. 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. Error bars are provided as binomial distribution error.

qibocal.protocols.ramsey.ramsey._fit(data: RamseyData) RamseyResults[source]#

Fitting routine for Ramsey experiment. The used model is .. math:

y = p_0 + p_1 sin \Big(p_2 x + p_3 \Big) e^{-x p_4}.
qibocal.protocols.ramsey.ramsey._plot(data: RamseyData, target: Union[str, int], fit: Optional[RamseyResults] = None)[source]#

Plotting function for Ramsey Experiment.

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

Ramsey Routine object.

qibocal.protocols.ramsey.ramsey_signal module#

class qibocal.protocols.ramsey.ramsey_signal.RamseySignalParameters(delay_between_pulses_start: int, delay_between_pulses_end: int, delay_between_pulses_step: int, detuning: Optional[int] = None, unrolling: bool = False)[source]#

Bases: Parameters

Ramsey runcard inputs.

delay_between_pulses_start: int#

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

delay_between_pulses_end: int#

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

delay_between_pulses_step: int#

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

detuning: Optional[int] = None#

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

unrolling: bool = False#

If True it uses sequence unrolling to deploy multiple sequences in a single instrument call. Defaults to False.

hardware_average: bool = False#

By default hardware average will be performed.

nshots: int#

Number of executions on hardware.

relaxation_time: float#

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

class qibocal.protocols.ramsey.ramsey_signal.RamseySignalResults(detuning: float, frequency: dict[Union[str, int], Union[float, list[float]]], t2: dict[Union[str, int], Union[float, list[float]]], delta_phys: dict[Union[str, int], Union[float, list[float]]], delta_fitting: dict[Union[str, int], Union[float, list[float]]], fitted_parameters: dict[Union[str, int], list[float]])[source]#

Bases: Results

Ramsey outputs.

detuning: float#

Qubit frequency detuning.

frequency: dict[Union[str, int], Union[float, list[float]]]#

Drive frequency [GHz] for each qubit.

t2: dict[Union[str, int], Union[float, list[float]]]#

T2 for each qubit [ns].

delta_phys: dict[Union[str, int], Union[float, list[float]]]#

Drive frequency [Hz] correction for each qubit.

delta_fitting: dict[Union[str, int], Union[float, list[float]]]#

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

fitted_parameters: dict[Union[str, int], list[float]]#

Raw fitting output.

_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)#

Store results to file.

qibocal.protocols.ramsey.ramsey_signal.RamseySignalType = dtype([('wait', '<f8'), ('signal', '<f8')])#

Custom dtype for coherence routines.

class qibocal.protocols.ramsey.ramsey_signal.RamseySignalData(detuning: ~typing.Optional[int] = None, qubit_freqs: dict[typing.Union[str, int], float] = <factory>, data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('wait', '<f8'), ('signal', '<f8')])]]] = <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 ordered alphanumerically from data structure.

property params: dict#

Convert non-arrays attributes into dict.

property qubits#

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

Store data to file.

detuning: Optional[int] = None#

Frequency detuning [Hz].

qubit_freqs: dict[Union[str, int], float]#

Qubit freqs for each qubit.

data: dict[typing.Union[str, int], numpy.ndarray[typing.Any, numpy.dtype[dtype([('wait', '<f8'), ('signal', '<f8')])]]]#

Raw data acquired.

property waits#

Return a list with the waiting times without repetitions.

qibocal.protocols.ramsey.ramsey_signal._acquisition(params: RamseySignalParameters, platform: Platform, targets: list[Union[str, int]]) RamseySignalData[source]#

Data acquisition for Ramsey Experiment (detuned).

qibocal.protocols.ramsey.ramsey_signal._fit(data: RamseySignalData) RamseySignalResults[source]#

Fitting routine for Ramsey experiment. The used model is .. math:

y = p_0 + p_1 sin \Big(p_2 x + p_3 \Big) e^{-x p_4}.
qibocal.protocols.ramsey.ramsey_signal._plot(data: RamseySignalData, target: Union[str, int], fit: Optional[RamseySignalResults] = None)[source]#

Plotting function for Ramsey Experiment.

qibocal.protocols.ramsey.ramsey_signal._update(results: RamseySignalResults, platform: Platform, target: Union[str, int])[source]#
qibocal.protocols.ramsey.ramsey_signal.ramsey_signal = Routine(acquisition=<function _acquisition>, fit=<function _fit>, report=<function _plot>, update=<function _update>, two_qubit_gates=False)#

Ramsey Routine object.

qibocal.protocols.ramsey.utils module#

qibocal.protocols.ramsey.utils.POPT_EXCEPTION = [0, 0, 0, 0, 1]#

Fit parameters output to handle exceptions

qibocal.protocols.ramsey.utils.PERR_EXCEPTION = [1, 1, 1, 1, 1]#

Fit errors to handle exceptions; their choice has no physical meaning and is meant to avoid breaking the code.

qibocal.protocols.ramsey.utils.THRESHOLD = 0.5#

Threshold parameters for find_peaks to guess frequency for sinusoidal fit.

qibocal.protocols.ramsey.utils.ramsey_sequence(platform: Platform, qubit: Union[str, int], wait: int = 0, detuning: Optional[int] = None)[source]#

Pulse sequence used in Ramsey (detuned) experiments.

The pulse sequence is the following:

RX90 – wait – RX90 – MZ

If detuning is specified the RX90 pulses will be sent to frequency = drive_frequency + detuning

qibocal.protocols.ramsey.utils.ramsey_fit(x, offset, amplitude, delta, phase, decay)[source]#

Dumped sinusoidal fit.

qibocal.protocols.ramsey.utils.fitting(x: list, y: list, errors: Optional[list] = None) list[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.utils.process_fit(popt: list[float], perr: list[float], qubit_frequency: float, detuning: float)[source]#

Processing Ramsey fitting results.