Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dispersive shift updated frequency #432

Merged
merged 4 commits into from
Jul 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/qibocal/protocols/characterization/dispersive_shift.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from qibocal.auto.operation import Data, Parameters, Qubits, Results, Routine
from qibocal.protocols.characterization.utils import (
GHZ_TO_HZ,
HZ_TO_GHZ,
V_TO_UV,
lorentzian,
Expand Down Expand Up @@ -204,7 +205,7 @@ def _fit(data: DispersiveShiftData) -> DispersiveShiftResults:
best_freqs = {}
best_iqs = {}
for qubit in qubits:
frequencies = data[qubit, 0].freq
frequencies = data[qubit, 0].freq * HZ_TO_GHZ

max_index = np.argmax(
np.linalg.norm(iq_couples[0][qubit] - iq_couples[1][qubit], axis=-1)
Expand Down Expand Up @@ -299,7 +300,7 @@ def _plot(data: DispersiveShiftData, fit: DispersiveShiftResults, qubit):

fig.add_trace(
go.Scatter(
x=[fit.best_freq[qubit] * HZ_TO_GHZ, fit.best_freq[qubit] * HZ_TO_GHZ],
x=[fit.best_freq[qubit], fit.best_freq[qubit]],
y=[
np.min(np.concatenate((data_0.msr, data_1.msr))),
np.max(np.concatenate((data_0.msr, data_1.msr))),
Expand All @@ -313,23 +314,23 @@ def _plot(data: DispersiveShiftData, fit: DispersiveShiftResults, qubit):
)

fig.add_vline(
x=fit.best_freq[qubit] * HZ_TO_GHZ,
x=fit.best_freq[qubit],
line=dict(color="orange", width=3, dash="dash"),
row=1,
col=1,
)

fitting_report = fitting_report + (
f"{qubit} | State zero freq : {fit_data_0.frequency[qubit]:,.0f} Hz.<br>"
f"{qubit} | State zero freq : {fit_data_0.frequency[qubit]*GHZ_TO_HZ:,.0f} Hz.<br>"
)
fitting_report = fitting_report + (
f"{qubit} | State one freq : {fit_data_1.frequency[qubit]:,.0f} Hz.<br>"
f"{qubit} | State one freq : {fit_data_1.frequency[qubit]*GHZ_TO_HZ:,.0f} Hz.<br>"
)
fitting_report = fitting_report + (
f"{qubit} | Frequency shift : {(fit_data_1.frequency[qubit] - fit_data_0.frequency[qubit]):,.0f} Hz.<br>"
f"{qubit} | Chi : {(fit_data_0.frequency[qubit]*GHZ_TO_HZ - fit_data_1.frequency[qubit]*GHZ_TO_HZ)/2:,.0f} Hz.<br>"
)
fitting_report = fitting_report + (
f"{qubit} | Best frequency : {fit.best_freq[qubit]:,.0f} Hz.<br>"
f"{qubit} | Best frequency : {fit.best_freq[qubit]*GHZ_TO_HZ:,.0f} Hz.<br>"
)
fig.update_layout(
showlegend=True,
Expand Down