# Ramsey experiments#

In this section we show how to run Ramsey experiments using Qibocal

## Ramsey#

To measure the decoherence time of a qubit it is possible to perform a Ramsey experiment. In this protocol two short $$\pi /2$$ are sent separated by a waiting time $$\tau$$. The first $$\pi /2$$ pulse will project the qubit from $$\ket{0}$$ onto the xy plane of the Bloch sphere. During the waiting time $$\tau$$ the qubit will decohere around the z axis, after the second $$\pi /2$$ we peform a measurement. By changing the waiting time $$\tau$$ we should observe an exponential decay in the probability of measuring $$\ket{1}$$ which will give us an estimate of $$T_2*$$. In the case where there is a difference between the qubit frequency and the frequency of the drive pulse the final state will show a sinusoidal dependence from which we can extract a correction on the qubit frequency [2]:

$p_e = \frac{1}{2} + \frac{1}{2} e^{-\tau/T_2} \cos(\Delta \omega \pm \pi/2)$

In order to obtain the correction on the qubit frequency reliably usually the drive pulse it is detuned on purpose to generate oscillations.

### Parameters#

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

Ramsey runcard inputs.

detuning: Optional[int] = 0#

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

### Example#

A possible runcard to launch a Ramsey experiment could be the following:

- id: ramsey
operation: ramsey
parameters:
delay_between_pulses_end: 2000
delay_between_pulses_start: 50
delay_between_pulses_step: 50
detuning: -1000000
nshots: 1024


The expected output is the following:

$$T_2$$ and $$\Delta \omega$$ are determined by fitting the output signal using the formula presented above.

If the protocols is successful the drive frequency will be updated. For updating $$T_2$$ the user is invited to run T2 experiment.

## Ramsey with raw signal#

A standard Ramsey experiment will try to compute the probability of the qubit being measured in state $$\ket{1}$$. It is possible to perform a Ramsey experiment without performing single shot classification by running an experiment called ramsey_signal.

The acquisition and the fitting procedure are exactly the same, the only difference being that on the y axis it will be displayed the raw measurements from the instruments.

### Parameters#

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

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] = 0#

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

### Example#

- id: ramsey with signal
operation: ramsey_signal
parameters:
delay_between_pulses_end: 25000
delay_between_pulses_start: 50
delay_between_pulses_step: 1000
nshots: 1024


Note that in this case error bars will not be provided.