diff --git a/src/qibocal/protocols/rabi/utils.py b/src/qibocal/protocols/rabi/utils.py index a5a630a62..97d3a7e23 100644 --- a/src/qibocal/protocols/rabi/utils.py +++ b/src/qibocal/protocols/rabi/utils.py @@ -342,7 +342,7 @@ def fit_amplitude_function( ) if signal is False: perr = np.sqrt(np.diag(perr)) - if y_limits is not None and x_limits is not None: + if None not in y_limits and None not in x_limits: popt = [ y_limits[0] + (y_limits[1] - y_limits[0]) * popt[0], (y_limits[1] - y_limits[0]) * popt[1], diff --git a/src/qibocal/protocols/two_qubit_interaction/chevron/chevron.py b/src/qibocal/protocols/two_qubit_interaction/chevron/chevron.py index d0650b67a..9f8cda596 100644 --- a/src/qibocal/protocols/two_qubit_interaction/chevron/chevron.py +++ b/src/qibocal/protocols/two_qubit_interaction/chevron/chevron.py @@ -316,9 +316,9 @@ def _plot(data: ChevronData, fit: ChevronResults, target: QubitPairId): def _update(results: ChevronResults, platform: Platform, target: QubitPairId): if isinstance(target, list): target = tuple(target) - if target not in results.duration: target = (target[1], target[0]) + getattr(update, f"{results.native}_duration")( results.duration[target], platform, target ) diff --git a/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases.py b/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases.py index e1b9945ba..58be9fa4a 100644 --- a/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases.py +++ b/src/qibocal/protocols/two_qubit_interaction/virtual_z_phases.py @@ -474,12 +474,10 @@ def _plot(data: VirtualZPhasesData, fit: VirtualZPhasesResults, target: QubitPai def _update(results: VirtualZPhasesResults, platform: Platform, target: QubitPairId): - # FIXME: quick fix for qubit order - qubit_pair = tuple(sorted(target)) target = tuple(sorted(target)) - # update.virtual_phases( - # results.virtual_phase[target], results.native, platform, target - # ) + update.virtual_phases( + results.virtual_phase[target], results.native, platform, target + ) getattr(update, f"{results.native}_duration")( results.flux_pulse_duration[target], platform, target ) diff --git a/src/qibocal/update.py b/src/qibocal/update.py index 5a59d6425..5b1c9e5fe 100644 --- a/src/qibocal/update.py +++ b/src/qibocal/update.py @@ -5,7 +5,7 @@ import numpy as np from pydantic import BaseModel -from qibolab import Platform +from qibolab import Platform, PulseSequence, VirtualZ from qibocal.auto.operation import QubitId, QubitPairId @@ -112,43 +112,46 @@ def readout_fidelity(fidelity: float, platform: Platform, qubit: QubitId): def virtual_phases( phases: dict[QubitId, float], native: str, platform: Platform, pair: QubitPairId ): - pass - # """Update virtual phases for given qubits in pair in results.""" - # virtual_z_pulses = { - # pulse.qubit.name: pulse - # for pulse in getattr(platform.pairs[pair].native_gates, native).pulses - # if isinstance(pulse, VirtualZPulse) - # } - # for qubit_id, phase in phases.items(): - # if qubit_id in virtual_z_pulses: - # virtual_z_pulses[qubit_id].phase = phase - # else: - # virtual_z_pulses[qubit_id] = VirtualZPulse( - # phase=phase, qubit=platform.qubits[qubit_id] - # ) - # getattr(platform.pairs[pair].native_gates, native).pulses.append( - # virtual_z_pulses[qubit_id] - # ) + native_sequence = getattr(platform.natives.two_qubit[pair], native) + new_native = PulseSequence() + if len(native_sequence) > 1: + new_native += native_sequence[0] + else: + new_native = native_sequence + for qubit, phase in phases.items(): + new_native.append((platform.qubits[qubit].drive, VirtualZ(phase=phase))) + + platform.update( + {f"native_gates.two_qubit.{f'{pair[0]}-{pair[1]}'}.{native}": new_native} + ) def CZ_duration(duration: int, platform: Platform, pair: QubitPairId): """Update CZ duration for specific pair.""" - platform.update({f"native_gates.two_qubit.{pair}.CZ.0.1.duration": duration}) + platform.update( + {f"native_gates.two_qubit.{f'{pair[0]}-{pair[1]}'}.CZ.0.1.duration": duration} + ) def CZ_amplitude(amp: float, platform: Platform, pair: QubitPairId): """Update CZ amplitude for specific pair.""" - platform.update({f"native_gates.two_qubit.{pair}.CZ.0.1.amp": amp}) + platform.update( + {f"native_gates.two_qubit.{f'{pair[0]}-{pair[1]}'}.CZ.0.1.amplitude": amp} + ) def iSWAP_duration(duration: int, platform: Platform, pair: QubitPairId): """Update iSWAP_duration duration for specific pair.""" - platform.update({f"native_gates.two_qubit.{pair}.CZ.0.1.duration": duration}) + platform.update( + {f"native_gates.two_qubit.{f'{pair[0]}-{pair[1]}'}.CZ.0.1.duration": duration} + ) def iSWAP_amplitude(amp: float, platform: Platform, pair: QubitPairId): """Update iSWAP_duration amplitude for specific pair.""" - platform.update({f"native_gates.two_qubit.{pair}.CZ.0.1.amp": amp}) + platform.update( + {f"native_gates.two_qubit.{f'{pair[0]}-{pair[1]}'}.CZ.0.1.amplitude": amp} + ) def t1(t1: int, platform: Platform, qubit: QubitId):