diff --git a/src/qibocal/protocols/coherence/t1_signal.py b/src/qibocal/protocols/coherence/t1_signal.py index 74c13fc90..569dee6f6 100644 --- a/src/qibocal/protocols/coherence/t1_signal.py +++ b/src/qibocal/protocols/coherence/t1_signal.py @@ -6,7 +6,7 @@ import plotly.graph_objects as go from qibolab import AcquisitionType, AveragingMode, ExecutionParameters from qibolab.platform import Platform -from qibolab.pulses import PulseSequence +from qibolab.pulses import Delay, PulseSequence from qibolab.qubits import QubitId from qibolab.sweeper import Parameter, Sweeper, SweeperType @@ -81,15 +81,19 @@ def _acquisition( # create a sequence of pulses for the experiment # RX - wait t - MZ qd_pulses = {} + delays = {} ro_pulses = {} sequence = PulseSequence() - for qubit in targets: - qd_pulses[qubit] = platform.create_RX_pulse(qubit, start=0) - ro_pulses[qubit] = platform.create_qubit_readout_pulse( - qubit, start=qd_pulses[qubit].duration - ) - sequence.add(qd_pulses[qubit]) - sequence.add(ro_pulses[qubit]) + for q in targets: + qubit = platform.qubits[q] + qd_sequence = qubit.native_gates.RX.create_sequence(theta=np.pi, phi=0) + ro_sequence = qubit.native_gates.MZ.create_sequence() + qd_pulses[q] = qd_sequence[qubit.drive.name][0] + ro_pulses[q] = ro_sequence[qubit.measure.name][0] + delays[q] = Delay(duration=qd_pulses[q].duration) + sequence.extend(qd_sequence) + sequence[qubit.measure.name].append(delays[q]) + sequence.extend(ro_sequence) # define the parameter to sweep and its range: # wait time before readout @@ -100,9 +104,9 @@ def _acquisition( ) sweeper = Sweeper( - Parameter.start, + Parameter.duration, ro_wait_range, - [ro_pulses[qubit] for qubit in targets], + [delays[q] for q in targets], type=SweeperType.ABSOLUTE, ) @@ -122,15 +126,15 @@ def _acquisition( ) data = T1SignalData() - for qubit in targets: - result = results[ro_pulses[qubit].serial] + for q in targets: + result = results[ro_pulses[q].id] if params.single_shot: _waits = np.array(len(result.magnitude) * [ro_wait_range]) else: _waits = ro_wait_range data.register_qubit( utils.CoherenceType, - (qubit), + (q), dict(wait=_waits, signal=result.magnitude, phase=result.phase), ) diff --git a/src/qibocal/protocols/coherence/t2_signal.py b/src/qibocal/protocols/coherence/t2_signal.py index 4c8ffc714..17127a817 100644 --- a/src/qibocal/protocols/coherence/t2_signal.py +++ b/src/qibocal/protocols/coherence/t2_signal.py @@ -5,7 +5,7 @@ import plotly.graph_objects as go from qibolab import AcquisitionType, AveragingMode, ExecutionParameters from qibolab.platform import Platform -from qibolab.pulses import PulseSequence +from qibolab.pulses import Delay, PulseSequence from qibolab.qubits import QubitId from qibolab.sweeper import Parameter, Sweeper, SweeperType @@ -60,21 +60,23 @@ def _acquisition( # create a sequence of pulses for the experiment # RX90 - t - RX90 - MZ ro_pulses = {} - RX90_pulses1 = {} - RX90_pulses2 = {} + qd_delays = {} + ro_delays = {} sequence = PulseSequence() - for qubit in targets: - RX90_pulses1[qubit] = platform.create_RX90_pulse(qubit, start=0) - RX90_pulses2[qubit] = platform.create_RX90_pulse( - qubit, - start=RX90_pulses1[qubit].finish, - ) - ro_pulses[qubit] = platform.create_qubit_readout_pulse( - qubit, start=RX90_pulses2[qubit].finish - ) - sequence.add(RX90_pulses1[qubit]) - sequence.add(RX90_pulses2[qubit]) - sequence.add(ro_pulses[qubit]) + for q in targets: + qubit = platform.qubits[q] + qd_sequence = qubit.native_gates.RX.create_sequence(theta=np.pi / 2, phi=0) + ro_sequence = qubit.native_gates.MZ.create_sequence() + qd_delays[q] = Delay(duration=16) + ro_delays[q] = Delay(duration=16) + qd_pulse = qd_sequence[qubit.drive.name][0] + ro_pulses[q] = ro_sequence[qubit.measure.name][0] + sequence.extend(qd_sequence) + sequence[qubit.drive.name].append(qd_delays[q]) + sequence.extend(qd_sequence) + sequence[qubit.measure.name].append(Delay(duration=2 * qd_pulse.duration)) + sequence[qubit.measure.name].append(ro_delays[q]) + sequence.extend(ro_sequence) # define the parameter to sweep and its range: waits = np.arange( @@ -85,9 +87,9 @@ def _acquisition( ) sweeper = Sweeper( - Parameter.start, + Parameter.duration, waits, - [RX90_pulses2[qubit] for qubit in targets], + [qd_delays[q] for q in targets] + [ro_delays[q] for q in targets], type=SweeperType.ABSOLUTE, ) @@ -106,15 +108,15 @@ def _acquisition( ) data = T2SignalData() - for qubit in targets: - result = results[ro_pulses[qubit].serial] + for q in targets: + result = results[ro_pulses[q].id] if params.single_shot: _waits = np.array(len(result.magnitude) * [waits]) else: _waits = waits data.register_qubit( utils.CoherenceType, - (qubit), + (q), dict(wait=_waits, signal=result.magnitude, phase=result.phase), ) return data diff --git a/src/qibocal/protocols/rabi/length.py b/src/qibocal/protocols/rabi/length.py index 1b529322b..5d9726548 100644 --- a/src/qibocal/protocols/rabi/length.py +++ b/src/qibocal/protocols/rabi/length.py @@ -64,7 +64,7 @@ def _acquisition( to find the drive pulse length that creates a rotation of a desired angle. """ - sequence, qd_pulses, _, amplitudes = utils.sequence_length( + sequence, qd_pulses, delays, ro_pulses, amplitudes = utils.sequence_length( targets, params, platform ) # define the parameter to sweep and its range: @@ -78,7 +78,7 @@ def _acquisition( sweeper = Sweeper( Parameter.duration, qd_pulse_duration_range, - [qd_pulses[qubit] for qubit in targets], + [qd_pulses[q] for q in targets] + [delays[q] for q in targets], type=SweeperType.ABSOLUTE, ) @@ -96,11 +96,11 @@ def _acquisition( sweeper, ) - for qubit in targets: - prob = results[qubit].probability(state=1) + for q in targets: + prob = results[ro_pulses[q].id].probability(state=1) data.register_qubit( RabiLenType, - (qubit), + (q), dict( length=qd_pulse_duration_range, prob=prob, diff --git a/src/qibocal/protocols/rabi/length_signal.py b/src/qibocal/protocols/rabi/length_signal.py index 51513ca0f..3dccdafe9 100644 --- a/src/qibocal/protocols/rabi/length_signal.py +++ b/src/qibocal/protocols/rabi/length_signal.py @@ -67,7 +67,7 @@ def _acquisition( to find the drive pulse length that creates a rotation of a desired angle. """ - sequence, qd_pulses, ro_pulses, amplitudes = utils.sequence_length( + sequence, qd_pulses, delays, ro_pulses, amplitudes = utils.sequence_length( targets, params, platform ) @@ -82,7 +82,7 @@ def _acquisition( sweeper = Sweeper( Parameter.duration, qd_pulse_duration_range, - [qd_pulses[qubit] for qubit in targets], + [qd_pulses[q] for q in targets] + [delays[q] for q in targets], type=SweeperType.ABSOLUTE, ) @@ -100,11 +100,11 @@ def _acquisition( sweeper, ) - for qubit in targets: - result = results[ro_pulses[qubit].serial] + for q in targets: + result = results[ro_pulses[q].id] data.register_qubit( RabiLenSignalType, - (qubit), + (q), dict( length=qd_pulse_duration_range, signal=result.magnitude, diff --git a/src/qibocal/protocols/rabi/utils.py b/src/qibocal/protocols/rabi/utils.py index 171e579ac..4ee30845d 100644 --- a/src/qibocal/protocols/rabi/utils.py +++ b/src/qibocal/protocols/rabi/utils.py @@ -239,8 +239,8 @@ def sequence_amplitude( qd_pulses[q] = qd_sequence[qubit.drive.name][0] if params.pulse_length is not None: qd_pulses[q].duration = params.pulse_length - durations[q] = qd_pulses[q].duration + ro_pulses[q] = ro_sequence[qubit.measure.name][0] sequence[qubit.drive.name].append(qd_pulses[q]) @@ -255,22 +255,27 @@ def sequence_length( """Return sequence for rabi length.""" sequence = PulseSequence() qd_pulses = {} + delays = {} ro_pulses = {} amplitudes = {} - for qubit in targets: - qd_pulses[qubit] = platform.create_qubit_drive_pulse( - qubit, start=0, duration=params.pulse_duration_start - ) + for q in targets: + qubit = platform.qubits[q] + qd_sequence = qubit.native_gates.RX.create_sequence(theta=np.pi, phi=0) + ro_sequence = qubit.native_gates.MZ.create_sequence() + + qd_pulses[q] = qd_sequence[qubit.drive.name][0] if params.pulse_amplitude is not None: - qd_pulses[qubit].amplitude = params.pulse_amplitude - amplitudes[qubit] = qd_pulses[qubit].amplitude + qd_pulses[q].amplitude = params.pulse_amplitude + amplitudes[q] = qd_pulses[q].amplitude - ro_pulses[qubit] = platform.create_qubit_readout_pulse( - qubit, start=qd_pulses[qubit].finish - ) - sequence.add(qd_pulses[qubit]) - sequence.add(ro_pulses[qubit]) - return sequence, qd_pulses, ro_pulses, amplitudes + delays[q] = Delay(duration=16) + ro_pulses[q] = ro_sequence[qubit.measure.name][0] + + sequence[qubit.drive.name].append(qd_pulses[q]) + sequence[qubit.measure.name].append(delays[q]) + sequence[qubit.measure.name].append(ro_pulses[q]) + + return sequence, qd_pulses, delays, ro_pulses, amplitudes def fit_length_function(