diff --git a/src/qibocal/protocols/characterization/flipping.py b/src/qibocal/protocols/characterization/flipping.py index 7444d6850..575690a08 100644 --- a/src/qibocal/protocols/characterization/flipping.py +++ b/src/qibocal/protocols/characterization/flipping.py @@ -172,8 +172,8 @@ def _fit(data: FlippingData) -> FlippingResults: popt = popt.tolist() except: log.warning("flipping_fit: the fitting was not succesful") - popt = [0] * 4 - perr = [1] * 4 + popt = [0] * 5 + perr = [1] * 5 if popt[3] > np.pi / 2 and popt[3] < 3 * np.pi / 2: signed_correction = -popt[2] / 2 diff --git a/src/qibocal/protocols/characterization/flipping_signal.py b/src/qibocal/protocols/characterization/flipping_signal.py index fe6234ced..4d0fad5b7 100644 --- a/src/qibocal/protocols/characterization/flipping_signal.py +++ b/src/qibocal/protocols/characterization/flipping_signal.py @@ -167,7 +167,7 @@ def _fit(data: FlippingSignalData) -> FlippingSignalResults: ) except: log.warning("flipping_fit: the fitting was not succesful") - popt = [0, 0, 0, 0] + popt = [0] * 5 translated_popt = [ y_min + (y_max - y_min) * popt[0], @@ -178,10 +178,11 @@ def _fit(data: FlippingSignalData) -> FlippingSignalResults: popt[3] - x_min * 2 * np.pi * f / (x_max - x_min) * popt[2], popt[4] * 2 * np.pi * f / (x_max - x_min), ] + # TODO: this might be related to the resonator type if popt[3] > np.pi / 2 and popt[3] < 3 * np.pi / 2: - signed_correction = -translated_popt[2] / 2 - else: signed_correction = translated_popt[2] / 2 + else: + signed_correction = -translated_popt[2] / 2 # The amplitude is directly proportional to the rotation angle corrected_amplitudes[qubit] = (pi_pulse_amplitude * np.pi) / ( np.pi + signed_correction @@ -190,7 +191,6 @@ def _fit(data: FlippingSignalData) -> FlippingSignalResults: amplitude_correction_factors[qubit] = ( signed_correction / np.pi * pi_pulse_amplitude ) - return FlippingSignalResults( corrected_amplitudes, amplitude_correction_factors, fitted_parameters )