Skip to content

Commit

Permalink
Merge pull request #561 from qiboteam/lorentzian_fit_offset_guess
Browse files Browse the repository at this point in the history
Now excluding differences lower than -1*st.dev.
  • Loading branch information
andrea-pasquale authored Oct 17, 2023
2 parents 4be55c8 + 33a723c commit 0ee1b4e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/qibocal/protocols/characterization/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,22 @@ def lorentzian_fit(data, resonator_type=None, fit=None):

# Guess parameters for Lorentzian max or min
# TODO: probably this is not working on HW
guess_offset = np.mean(
voltages[np.abs(voltages - np.mean(voltages)) < np.std(voltages)]
)
if (resonator_type == "3D" and fit == "resonator") or (
resonator_type == "2D" and fit == "qubit"
):
guess_center = frequencies[
np.argmax(voltages)
] # Argmax = Returns the indices of the maximum values along an axis.
guess_offset = np.mean(
voltages[np.abs(voltages - np.mean(voltages) < np.std(voltages))]
)
guess_sigma = abs(frequencies[np.argmin(voltages)] - guess_center)
guess_amp = (np.max(voltages) - guess_offset) * guess_sigma * np.pi

else:
guess_center = frequencies[
np.argmin(voltages)
] # Argmin = Returns the indices of the minimum values along an axis.
guess_offset = np.mean(
voltages[np.abs(voltages - np.mean(voltages) < np.std(voltages))]
)
guess_sigma = abs(frequencies[np.argmax(voltages)] - guess_center)
guess_amp = (np.min(voltages) - guess_offset) * guess_sigma * np.pi

Expand Down

0 comments on commit 0ee1b4e

Please sign in to comment.