Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RX90 calibration implementation #1044

Merged
merged 81 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
14f80b4
first test for swittching from pi to pi-half
ElStabilini Nov 19, 2024
ec4b7ad
fixed pi half calibration sequence
ElStabilini Nov 20, 2024
9f63c69
modified classes and methods for running rabi for RX90
ElStabilini Nov 20, 2024
33db217
added option to save duration of RX90 pulse
ElStabilini Nov 21, 2024
32cceda
started modifying rabi ef for using RX90
ElStabilini Nov 21, 2024
7661361
modified pihalf_pulse to rx90 in parameters
ElStabilini Nov 21, 2024
d03f383
Update rabi.rst
ElStabilini Nov 21, 2024
d0c1228
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 21, 2024
e6a2395
set pi calibration as default and change rx90 dtype
ElStabilini Nov 21, 2024
144f468
Saving modified documentation
ElStabilini Nov 21, 2024
c112748
fix ordering error
ElStabilini Nov 21, 2024
f083434
moved all pihalf_pulses in Rabi-Data class
ElStabilini Nov 21, 2024
f52765f
moved all pihalf_pulses in Rabi-Data class
ElStabilini Nov 21, 2024
efcb55a
fixed errors
ElStabilini Nov 21, 2024
66f0b71
Update rabi.rst
ElStabilini Nov 21, 2024
1f16f50
fixed amplitude_sequence and length_sequence inputs
ElStabilini Nov 21, 2024
f8e9021
Sync remote and local branches
ElStabilini Nov 21, 2024
a08cf3c
fixed acquisition error
ElStabilini Nov 21, 2024
0f9ec82
fixed error
ElStabilini Nov 21, 2024
6111a46
fix rabi length signal
ElStabilini Nov 22, 2024
973b318
fix rabi length signal
ElStabilini Nov 22, 2024
3164fd8
align True
ElStabilini Nov 22, 2024
393d039
Update rabi.rst
ElStabilini Nov 22, 2024
1742dc1
Add rabi_amplitude_rx90
ElStabilini Nov 22, 2024
30dd98c
Update rabi.rst
ElStabilini Nov 22, 2024
f521abc
rename pi_half to rx90
ElStabilini Nov 22, 2024
bf70bf6
Sync local and remote branches
ElStabilini Nov 22, 2024
349e312
force ef rabi protocol with pihalf
ElStabilini Nov 22, 2024
07a62b8
Delete rabi_length_signal.yaml
ElStabilini Nov 25, 2024
1873ccb
Update src/qibocal/protocols/rabi/utils.py
ElStabilini Nov 25, 2024
ef2e21a
Update src/qibocal/protocols/rabi/amplitude_frequency.py
ElStabilini Nov 25, 2024
7deade0
Update src/qibocal/protocols/rabi/length_frequency.py
ElStabilini Nov 25, 2024
222539d
Update src/qibocal/protocols/rabi/length_frequency.py
ElStabilini Nov 25, 2024
62230c9
Update src/qibocal/protocols/rabi/length.py
ElStabilini Nov 25, 2024
23ae111
Update src/qibocal/protocols/rabi/ef.py
ElStabilini Nov 25, 2024
4dbcc34
Update src/qibocal/protocols/rabi/length.py
ElStabilini Nov 25, 2024
3427756
Update update.py
ElStabilini Nov 25, 2024
3c676ff
Update protocols.yml
ElStabilini Nov 26, 2024
df453df
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 26, 2024
92e0d71
Update pyproject.toml
ElStabilini Nov 26, 2024
1f9d532
Update length_frequency.py
ElStabilini Nov 26, 2024
31db8b7
Update ef.py
ElStabilini Nov 26, 2024
c579cbb
Update flipping.py
ElStabilini Nov 26, 2024
64e5352
Update pyproject.toml
ElStabilini Nov 26, 2024
3c4e0d9
Update poetry.lock
ElStabilini Nov 27, 2024
04cf0f9
Update flipping.py
ElStabilini Nov 27, 2024
cf73084
modify amplitude_sequence and length_sequence for rx90, add flipping …
ElStabilini Nov 27, 2024
f6bfcaf
Update flipping.py
ElStabilini Nov 27, 2024
454f5b5
Update flipping.py
ElStabilini Nov 27, 2024
47a22b5
Update flipping.py
ElStabilini Nov 27, 2024
96dd44e
Update flipping.py
ElStabilini Nov 27, 2024
07a4bcd
Update flipping.py
ElStabilini Nov 27, 2024
e8cea9a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 27, 2024
4052755
Update flipping.py
ElStabilini Nov 27, 2024
12fedb5
fix FlippingResults and FlippingData class definition
ElStabilini Nov 28, 2024
b58e13a
fix globalbackends error: downgrade qibo
ElStabilini Nov 28, 2024
32308e2
Update flipping.rst
ElStabilini Nov 28, 2024
57904a1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 28, 2024
3b6769d
fix error in _fit method
ElStabilini Nov 28, 2024
29a1296
update documentation for flipping
ElStabilini Nov 28, 2024
022240d
fix tests for rx90
ElStabilini Nov 28, 2024
8b0995d
Update flipping.rst
ElStabilini Nov 28, 2024
98bcf1d
modify plot function in utils to have the correct name of the pulse c…
ElStabilini Nov 29, 2024
17ba606
'sync remote and local branch'
ElStabilini Nov 29, 2024
7b907ae
improve code for printing pulse names on reports
ElStabilini Nov 30, 2024
7660fde
fix compatibility with qibo v0.2.14
ElStabilini Dec 3, 2024
2d8c8f7
fix conflict with pyproject.toml for branch 0.2
ElStabilini Dec 3, 2024
1bac594
fix error in flipping sequence construction for rx90
ElStabilini Dec 3, 2024
af82fec
Merge branch '0.2' into pi_half
ElStabilini Dec 3, 2024
228a02e
Update src/qibocal/protocols/flipping.py
ElStabilini Dec 6, 2024
35c7178
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 6, 2024
8950008
Update src/qibocal/protocols/flipping.py
ElStabilini Dec 6, 2024
b90f887
fix test definition and improve code for flipping with rx90 gate
ElStabilini Dec 6, 2024
23ee280
'sync remote and local fixes'
ElStabilini Dec 6, 2024
01a4d1a
Update utils.py
ElStabilini Dec 6, 2024
c5bb28f
improve documentation for flipping and rabi protocols
ElStabilini Dec 6, 2024
f62bbc3
Update doc/source/protocols/rabi/rabi.rst
ElStabilini Dec 7, 2024
832d0e9
create first RX90 of the sequence always using R.(theta=pi/2)
ElStabilini Dec 11, 2024
05c2886
fix tabs
ElStabilini Dec 11, 2024
478c864
sync remote and local update
ElStabilini Dec 11, 2024
837cc08
Update src/qibocal/protocols/flipping.py
ElStabilini Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/qibocal/protocols/rabi/amplitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class RabiAmplitudeData(Data):
"""Pulse durations provided by the user."""
data: dict[QubitId, npt.NDArray[RabiAmpType]] = field(default_factory=dict)
"""Raw data acquired."""
pihalf_pulse: bool
"""Pi or Pi_half calibration"""


def _acquisition(
Expand All @@ -65,6 +67,7 @@ def _acquisition(
)

data = RabiAmplitudeData(durations=durations)
data.pihalf_pulse = params.pihalf_pulse

# sweep the parameter
results = platform.execute(
Expand Down Expand Up @@ -128,7 +131,9 @@ def _fit(data: RabiAmplitudeData) -> RabiAmplitudeResults:

except Exception as e:
log.warning(f"Rabi fit failed for qubit {qubit} due to {e}.")
return RabiAmplitudeResults(pi_pulse_amplitudes, durations, fitted_parameters, chi2)
return RabiAmplitudeResults(
pi_pulse_amplitudes, durations, fitted_parameters, data.pihalf_pulse, chi2
)


def _plot(data: RabiAmplitudeData, target: QubitId, fit: RabiAmplitudeResults = None):
Expand All @@ -139,7 +144,9 @@ def _plot(data: RabiAmplitudeData, target: QubitId, fit: RabiAmplitudeResults =
def _update(
results: RabiAmplitudeResults, platform: CalibrationPlatform, target: QubitId
):
update.drive_amplitude(results.amplitude[target], platform, target)
update.drive_amplitude(
results.amplitude[target], results.pihalf_pulse, platform, target
)
update.drive_duration(results.length[target], platform, target)


Expand Down
5 changes: 5 additions & 0 deletions src/qibocal/protocols/rabi/amplitude_frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class RabiAmplitudeFreqData(RabiAmplitudeFreqSignalData):
data: dict[QubitId, npt.NDArray[RabiAmpFreqType]] = field(default_factory=dict)
"""Raw data acquired."""

pihalf_pulse: bool
"""Pi or Pi_half calibration"""

def register_qubit(self, qubit, freq, amp, prob, error):
"""Store output for single qubit."""
size = len(freq) * len(amp)
Expand Down Expand Up @@ -102,6 +105,7 @@ def _acquisition(
)

data = RabiAmplitudeFreqData(durations=durations)
data.pihalf_pulse = params.pihalf_pulse

results = platform.execute(
[sequence],
Expand Down Expand Up @@ -186,6 +190,7 @@ def _fit(data: RabiAmplitudeFreqData) -> RabiAmplitudeFrequencyResults:
fitted_parameters=fitted_parameters,
frequency=fitted_frequencies,
chi2=chi2,
pihalf_pulse=data.pihalf_pulse,
)


Expand Down
10 changes: 9 additions & 1 deletion src/qibocal/protocols/rabi/amplitude_frequency_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class RabiAmplitudeFrequencySignalParameters(Parameters):
"""Frequency to use as step for the scan."""
pulse_length: Optional[float] = None
"""RX pulse duration [ns]."""
pihalf_pulse: Optional[bool] = True
"""Calibration of native pihalf pulse, if false calibrates pi pulse"""


@dataclass
Expand Down Expand Up @@ -75,6 +77,8 @@ class RabiAmplitudeFreqSignalData(Data):
default_factory=dict
)
"""Raw data acquired."""
pihalf_pulse: bool
"""Pi or Pi_half calibration"""

def register_qubit(self, qubit, freq, amp, signal, phase):
"""Store output for single qubit."""
Expand Down Expand Up @@ -127,6 +131,7 @@ def _acquisition(
)

data = RabiAmplitudeFreqSignalData(durations=durations)
data.pihalf_pulse = params.pihalf_pulse

results = platform.execute(
[sequence],
Expand Down Expand Up @@ -198,6 +203,7 @@ def _fit(data: RabiAmplitudeFreqSignalData) -> RabiAmplitudeFrequencySignalResul
length=data.durations,
fitted_parameters=fitted_parameters,
frequency=fitted_frequencies,
pihalf_pulse=data.pihalf_pulse,
)


Expand Down Expand Up @@ -296,7 +302,9 @@ def _update(
target: QubitId,
):
update.drive_duration(results.length[target], platform, target)
update.drive_amplitude(results.amplitude[target], platform, target)
update.drive_amplitude(
results.amplitude[target], results.pihalf_pulse, platform, target
)
update.drive_frequency(results.frequency[target], platform, target)


Expand Down
13 changes: 11 additions & 2 deletions src/qibocal/protocols/rabi/amplitude_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class RabiAmplitudeSignalParameters(Parameters):
"""Step amplitude."""
pulse_length: Optional[float] = None
"""RX pulse duration [ns]."""
pihalf_pulse: Optional[bool] = True
"""Calibration of native pihalf pulse, if false calibrates pi pulse"""


@dataclass
Expand All @@ -39,6 +41,8 @@ class RabiAmplitudeSignalResults(Results):
"""Drive pulse duration. Same for all qubits."""
fitted_parameters: dict[QubitId, dict[str, float]]
"""Raw fitted parameters."""
pihalf_pulse: bool
"""Pi or Pi_half calibration"""


RabiAmpSignalType = np.dtype(
Expand All @@ -55,6 +59,8 @@ class RabiAmplitudeSignalData(Data):
"""Pulse durations provided by the user."""
data: dict[QubitId, npt.NDArray[RabiAmpSignalType]] = field(default_factory=dict)
"""Raw data acquired."""
pihalf_pulse: bool
"""Pi or Pi_half calibration"""


def _acquisition(
Expand All @@ -80,6 +86,7 @@ def _acquisition(
)

data = RabiAmplitudeSignalData(durations=durations)
data.pihalf_pulse = params.pihalf_pulse

# sweep the parameter
results = platform.execute(
Expand Down Expand Up @@ -142,7 +149,7 @@ def _fit(data: RabiAmplitudeSignalData) -> RabiAmplitudeSignalResults:
log.warning(f"Rabi fit failed for qubit {qubit} due to {e}.")

return RabiAmplitudeSignalResults(
pi_pulse_amplitudes, data.durations, fitted_parameters
pi_pulse_amplitudes, data.durations, fitted_parameters, data.pihalf_pulse
)


Expand All @@ -158,7 +165,9 @@ def _plot(
def _update(
results: RabiAmplitudeSignalResults, platform: CalibrationPlatform, target: QubitId
):
update.drive_amplitude(results.amplitude[target], platform, target)
update.drive_amplitude(
results.amplitude[target], results.pihalf_pulse, platform, target
)
update.drive_duration(results.length[target], platform, target)


Expand Down
11 changes: 9 additions & 2 deletions src/qibocal/protocols/rabi/length.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class RabiLengthParameters(Parameters):
"""Step pi pulse duration [ns]."""
pulse_amplitude: Optional[float] = None
"""Pi pulse amplitude. Same for all qubits."""
pihalf_pulse: Optional[bool] = True
"""Calibration of native pihalf pulse, if false calibrates pi pulse"""
interpolated_sweeper: bool = False
"""Use real-time interpolation if supported by instruments."""

Expand Down Expand Up @@ -87,6 +89,7 @@ def _acquisition(
)

data = RabiLengthData(amplitudes=amplitudes)
data.pihalf_pulse = params.pihalf_pulse

# execute the sweep
results = platform.execute(
Expand Down Expand Up @@ -155,11 +158,15 @@ def _fit(data: RabiLengthData) -> RabiLengthResults:
except Exception as e:
log.warning(f"Rabi fit failed for qubit {qubit} due to {e}.")

return RabiLengthResults(durations, amplitudes, fitted_parameters, chi2)
return RabiLengthResults(
durations, amplitudes, fitted_parameters, data.pihalf_pulse, chi2
)


def _update(results: RabiLengthResults, platform: CalibrationPlatform, target: QubitId):
update.drive_duration(results.length[target], platform, target)
update.drive_duration(
results.length[target], results.pihalf_pulse, platform, target
)
update.drive_amplitude(results.amplitude[target], platform, target)


Expand Down
10 changes: 9 additions & 1 deletion src/qibocal/protocols/rabi/length_frequency_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class RabiLengthFrequencySignalParameters(Parameters):
"""Frequency to use as step for the scan."""
pulse_amplitude: Optional[float] = None
"""Pi pulse amplitude. Same for all qubits."""
pihalf_pulse: Optional[bool] = True
ElStabilini marked this conversation as resolved.
Show resolved Hide resolved
"""Calibration of native pihalf pulse, if false calibrates pi pulse"""
interpolated_sweeper: bool = False
"""Use real-time interpolation if supported by instruments."""

Expand Down Expand Up @@ -72,6 +74,8 @@ class RabiLengthFreqSignalData(Data):
default_factory=dict
)
"""Raw data acquired."""
pihalf_pulse: bool
"""Pi or Pi_half calibration"""

def register_qubit(self, qubit, freq, lens, signal, phase):
"""Store output for single qubit."""
Expand Down Expand Up @@ -137,6 +141,7 @@ def _acquisition(
)

data = RabiLengthFreqSignalData(amplitudes=amplitudes)
data.pihalf_pulse = params.pihalf_pulse

results = platform.execute(
[sequence],
Expand Down Expand Up @@ -207,6 +212,7 @@ def _fit(data: RabiLengthFreqSignalData) -> RabiLengthFrequencySignalResults:
amplitude=data.amplitudes,
fitted_parameters=fitted_parameters,
frequency=fitted_frequencies,
pihalf_pulse=data.pihalf_pulse,
)


Expand Down Expand Up @@ -305,7 +311,9 @@ def _update(
platform: CalibrationPlatform,
target: QubitId,
):
update.drive_amplitude(results.amplitude[target], platform, target)
update.drive_amplitude(
results.amplitude[target], results.pihalf_pulse, platform, target
)
update.drive_duration(results.length[target], platform, target)
update.drive_frequency(results.frequency[target], platform, target)

Expand Down
15 changes: 13 additions & 2 deletions src/qibocal/protocols/rabi/length_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class RabiLengthSignalParameters(Parameters):
"""Step pi pulse duration [ns]."""
pulse_amplitude: Optional[float] = None
"""Pi pulse amplitude. Same for all qubits."""
pihalf_pulse: Optional[bool] = True
"""Calibration of native pihalf pulse, if false calibrates pi pulse"""
interpolated_sweeper: bool = False
"""Use real-time interpolation if supported by instruments."""

Expand All @@ -41,6 +43,8 @@ class RabiLengthSignalResults(Results):
"""Pi pulse amplitude. Same for all qubits."""
fitted_parameters: dict[QubitId, dict[str, float]]
"""Raw fitting output."""
pihalf_pulse: bool
"""Pi or Pi_half calibration"""


RabiLenSignalType = np.dtype(
Expand All @@ -57,6 +61,8 @@ class RabiLengthSignalData(Data):
"""Pulse durations provided by the user."""
data: dict[QubitId, npt.NDArray[RabiLenSignalType]] = field(default_factory=dict)
"""Raw data acquired."""
pihalf_pulse: bool
"""Pi or Pi_half calibration"""


def _acquisition(
Expand Down Expand Up @@ -92,6 +98,7 @@ def _acquisition(
)

data = RabiLengthSignalData(amplitudes=amplitudes)
data.pihalf_pulse = params.pihalf_pulse

# execute the sweep
results = platform.execute(
Expand Down Expand Up @@ -153,13 +160,17 @@ def _fit(data: RabiLengthSignalData) -> RabiLengthSignalResults:
except Exception as e:
log.warning(f"Rabi fit failed for qubit {qubit} due to {e}.")

return RabiLengthSignalResults(durations, data.amplitudes, fitted_parameters)
return RabiLengthSignalResults(
durations, data.amplitudes, fitted_parameters, data.pihalf_pulse
)


def _update(
results: RabiLengthSignalResults, platform: CalibrationPlatform, target: QubitId
):
update.drive_duration(results.length[target], platform, target)
update.drive_duration(
results.length[target], results.pihalf_pulse, platform, target
)
ElStabilini marked this conversation as resolved.
Show resolved Hide resolved
update.drive_amplitude(results.amplitude[target], platform, target)


Expand Down
14 changes: 13 additions & 1 deletion src/qibocal/protocols/rabi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,13 @@ def period_correction_factor(phase: float):


def sequence_amplitude(
targets: list[QubitId], params: Parameters, platform: Platform
targets: list[QubitId],
params: Parameters,
platform: Platform,
pulse: bool, # if true calibrate pi_half pulse
) -> tuple[PulseSequence, dict, dict, dict]:
"""Return sequence for rabi amplitude."""

sequence = PulseSequence()
qd_pulses = {}
ro_pulses = {}
Expand All @@ -242,6 +246,9 @@ def sequence_amplitude(
qd_pulses[q] = qd_pulse
ro_pulses[q] = ro_pulse

if pulse:
sequence.append((qd_channel, qd_pulses[q]))

sequence.append((qd_channel, qd_pulses[q]))
sequence.append((ro_channel, Delay(duration=durations[q])))
sequence.append((ro_channel, ro_pulse))
Expand All @@ -252,9 +259,11 @@ def sequence_length(
targets: list[QubitId],
params: Parameters,
platform: Platform,
pulse: bool, # if true calibrate pi_half pulse
use_align: bool = False,
) -> tuple[PulseSequence, dict, dict, dict]:
"""Return sequence for rabi length."""

sequence = PulseSequence()
qd_pulses = {}
delays = {}
Expand All @@ -272,6 +281,9 @@ def sequence_length(
qd_pulses[q] = qd_pulse
ro_pulses[q] = ro_pulse

if pulse:
sequence.append((qd_channel, qd_pulse))

sequence.append((qd_channel, qd_pulse))
if use_align:
sequence.align([qd_channel, ro_channel])
Expand Down
9 changes: 7 additions & 2 deletions src/qibocal/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,16 @@ def drive_frequency(
platform.update({f"configs.{drive_channel}.frequency": freq})


def drive_amplitude(amp: Union[float, tuple, list], platform: Platform, qubit: QubitId):
def drive_amplitude(
amp: Union[float, tuple, list], pi_half: bool, platform: Platform, qubit: QubitId
):
"""Update drive frequency value in platform for specific qubit."""
if isinstance(amp, Iterable):
amp = amp[0]
platform.update({f"native_gates.single_qubit.{qubit}.RX.0.1.amplitude": amp})
if pi_half:
andrea-pasquale marked this conversation as resolved.
Show resolved Hide resolved
platform.update({f"native_gates.single_qubit.{qubit}.RX90.0.1.amplitude": amp})
ElStabilini marked this conversation as resolved.
Show resolved Hide resolved
else:
platform.update({f"native_gates.single_qubit.{qubit}.RX.0.1.amplitude": amp})


def drive_duration(
Expand Down
Loading