Skip to content

Commit

Permalink
chore: convert Rabi amplitude to absolute sweeper
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros11 committed Aug 31, 2024
1 parent 8864e7f commit 998baca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 28 deletions.
16 changes: 5 additions & 11 deletions src/qibocal/protocols/rabi/amplitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,11 @@ def _acquisition(
sequence, qd_pulses, ro_pulses, durations = utils.sequence_amplitude(
targets, params, platform
)
# define the parameter to sweep and its range:
# qubit drive pulse amplitude
qd_pulse_amplitude_range = np.arange(
params.min_amp_factor,
params.max_amp_factor,
params.step_amp_factor,
)

sweeper = Sweeper(
Parameter.amplitude,
qd_pulse_amplitude_range,
[qd_pulses[qubit] for qubit in targets],
parameter=Parameter.amplitude,
range=(params.min_amp, params.max_amp, params.step_amp),
pulses=[qd_pulses[qubit] for qubit in targets],
)

data = RabiAmplitudeData(durations=durations)
Expand All @@ -89,7 +83,7 @@ def _acquisition(
RabiAmpType,
(qubit),
dict(
amp=qd_pulses[qubit].amplitude * qd_pulse_amplitude_range,
amp=sweeper.values,
prob=prob.tolist(),
error=np.sqrt(prob * (1 - prob) / params.nshots).tolist(),
),
Expand Down
27 changes: 10 additions & 17 deletions src/qibocal/protocols/rabi/amplitude_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
class RabiAmplitudeSignalParameters(Parameters):
"""RabiAmplitude runcard inputs."""

min_amp_factor: float
"""Minimum amplitude multiplicative factor."""
max_amp_factor: float
"""Maximum amplitude multiplicative factor."""
step_amp_factor: float
"""Step amplitude multiplicative factor."""
min_amp: float
"""Minimum amplitude."""
max_amp: float
"""Maximum amplitude."""
step_amp: float
"""Step amplitude."""
pulse_length: Optional[float] = None
"""RX pulse duration [ns]."""

Expand Down Expand Up @@ -73,17 +73,10 @@ def _acquisition(
targets, params, platform
)

# define the parameter to sweep and its range:
# qubit drive pulse amplitude
qd_pulse_amplitude_range = np.arange(
params.min_amp_factor,
params.max_amp_factor,
params.step_amp_factor,
)
sweeper = Sweeper(
Parameter.amplitude,
qd_pulse_amplitude_range,
[qd_pulses[qubit] for qubit in targets],
parameter=Parameter.amplitude,
range=(params.min_amp, params.max_amp, params.step_amp),
pulses=[qd_pulses[qubit] for qubit in targets],
)

data = RabiAmplitudeSignalData(durations=durations)
Expand All @@ -105,7 +98,7 @@ def _acquisition(
RabiAmpSignalType,
(qubit),
dict(
amp=qd_pulses[qubit].amplitude * qd_pulse_amplitude_range,
amp=sweeper.values,
signal=magnitude(result),
phase=phase(result),
),
Expand Down

0 comments on commit 998baca

Please sign in to comment.