Skip to content

Commit

Permalink
Removed duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielePalazzo committed Oct 17, 2023
1 parent c8c2f26 commit 33a723c
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 33a723c

Please sign in to comment.