Skip to content

Commit 113149a

Browse files
fix: Propagate changes in punchout/qubit_power_spectroscopy
1 parent 4343449 commit 113149a

4 files changed

Lines changed: 18 additions & 74 deletions

File tree

src/qibocal/protocols/flux_dependence/qubit_crosstalk.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from qibocal.calibration import CalibrationPlatform
1919
from qibocal.config import log
2020

21-
from ...result import magnitude, phase
21+
from ...result import magnitude
2222
from ...update import replace
2323
from ..utils import (
2424
GHZ_TO_HZ,
@@ -166,7 +166,7 @@ def _acquisition(
166166
offset_sweepers.append(
167167
Sweeper(
168168
parameter=Parameter.offset,
169-
values=offset0 + params.bais_range,
169+
values=offset0 + params.bias_range,
170170
channels=[flux_channel],
171171
)
172172
)
@@ -210,7 +210,6 @@ def _acquisition(
210210
qubit,
211211
flux_qubit,
212212
signal=magnitude(result),
213-
phase=phase(result),
214213
freq=freq_sweepers[i].values,
215214
bias=offset_sweeper.values,
216215
)

src/qibocal/protocols/qubit_spectroscopies/qubit_power_spectroscopy.py

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import numpy as np
55
import plotly.graph_objects as go
6-
from plotly.subplots import make_subplots
76
from qibolab import (
87
AcquisitionType,
98
AveragingMode,
@@ -16,7 +15,7 @@
1615
from qibocal.auto.operation import Parameters, QubitId, Results, Routine
1716
from qibocal.calibration import CalibrationPlatform
1817

19-
from ...result import magnitude, phase
18+
from ...result import magnitude
2019
from ...update import replace
2120
from ..resonator_spectroscopies.resonator_punchout import ResonatorPunchoutData
2221
from ..utils import HZ_TO_GHZ, readout_frequency
@@ -120,7 +119,6 @@ def _acquisition(
120119
data.register_qubit(
121120
qubit,
122121
signal=magnitude(result),
123-
phase=phase(result),
124122
freq=freq_sweepers[qubit].values,
125123
amp=amp_sweeper.values,
126124
)
@@ -141,16 +139,7 @@ def _plot(
141139
"""Plot QubitPunchout."""
142140
figures = []
143141
fitting_report = ""
144-
fig = make_subplots(
145-
rows=1,
146-
cols=2,
147-
horizontal_spacing=0.1,
148-
vertical_spacing=0.2,
149-
subplot_titles=(
150-
"Signal [a.u.]",
151-
"phase [rad]",
152-
),
153-
)
142+
fig = go.Figure()
154143
qubit_data = data[target]
155144
frequencies = qubit_data.freq * HZ_TO_GHZ
156145
amplitudes = qubit_data.amp
@@ -161,30 +150,16 @@ def _plot(
161150
y=amplitudes,
162151
z=qubit_data.signal,
163152
colorbar_x=0.46,
164-
),
165-
row=1,
166-
col=1,
167-
)
168-
169-
fig.add_trace(
170-
go.Heatmap(
171-
x=frequencies,
172-
y=amplitudes,
173-
z=qubit_data.phase,
174-
colorbar_x=1.01,
175-
),
176-
row=1,
177-
col=2,
153+
)
178154
)
179155

180156
fig.update_layout(
181157
showlegend=True,
182158
legend=dict(orientation="h"),
183159
)
184160

185-
fig.update_xaxes(title_text="Drive frequency [GHz]", row=1, col=1)
186-
fig.update_xaxes(title_text="Drive frequency [GHz]", row=1, col=2)
187-
fig.update_yaxes(title_text="Drive amplitude [a.u.]", row=1, col=1)
161+
fig.update_xaxes(title_text="Drive frequency [GHz]")
162+
fig.update_yaxes(title_text="Drive amplitude [a.u.]")
188163

189164
figures.append(fig)
190165

src/qibocal/protocols/resonator_spectroscopies/resonator_punchout.py

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
import numpy as np
55
import numpy.typing as npt
66
import plotly.graph_objects as go
7-
from plotly.subplots import make_subplots
87
from qibolab import AcquisitionType, AveragingMode, Parameter, PulseSequence, Sweeper
98

109
from qibocal import update
1110
from qibocal.auto.operation import Data, Parameters, QubitId, Results, Routine
1211
from qibocal.calibration import CalibrationPlatform
13-
from qibocal.result import magnitude, phase
12+
from qibocal.result import magnitude
1413

1514
from ..utils import HZ_TO_GHZ, fit_punchout, norm, table_dict, table_html
1615

@@ -50,7 +49,6 @@ class ResonatorPunchoutResults(Results):
5049
("freq", np.float64),
5150
("amp", np.float64),
5251
("signal", np.float64),
53-
("phase", np.float64),
5452
]
5553
)
5654
"""Custom dtype for resonator punchout."""
@@ -67,15 +65,18 @@ class ResonatorPunchoutData(Data):
6765
data: dict[QubitId, npt.NDArray[ResPunchoutType]] = field(default_factory=dict)
6866
"""Raw data acquired."""
6967

70-
def register_qubit(self, qubit, freq, amp, signal, phase):
68+
@property
69+
def find_min(self):
70+
return self.resonator_type != "2D"
71+
72+
def register_qubit(self, qubit, freq, amp, signal):
7173
"""Store output for single qubit."""
7274
size = len(freq) * len(amp)
7375
frequency, amplitude = np.meshgrid(freq, amp)
7476
ar = np.empty(size, dtype=ResPunchoutType)
7577
ar["freq"] = frequency.ravel()
7678
ar["amp"] = amplitude.ravel()
7779
ar["signal"] = signal.ravel()
78-
ar["phase"] = phase.ravel()
7980
self.data[qubit] = np.rec.array(ar)
8081

8182

@@ -142,7 +143,6 @@ def _acquisition(
142143
data.register_qubit(
143144
qubit,
144145
signal=magnitude(result),
145-
phase=phase(result),
146146
freq=freq_sweepers[qubit].values,
147147
amp=amp_sweeper.values,
148148
)
@@ -152,7 +152,6 @@ def _acquisition(
152152

153153
def _fit(data: ResonatorPunchoutData, fit_type="amp") -> ResonatorPunchoutResults:
154154
"""Fit frequency and attenuation at high and low power for a given resonator."""
155-
156155
return ResonatorPunchoutResults(*fit_punchout(data, fit_type))
157156

158157

@@ -162,16 +161,7 @@ def _plot(
162161
"""Plotting function for ResonatorPunchout."""
163162
figures = []
164163
fitting_report = ""
165-
fig = make_subplots(
166-
rows=1,
167-
cols=2,
168-
horizontal_spacing=0.1,
169-
vertical_spacing=0.2,
170-
subplot_titles=(
171-
"Normalised Signal [a.u.]",
172-
"phase [rad]",
173-
),
174-
)
164+
fig = go.Figure()
175165
qubit_data = data[target]
176166
frequencies = qubit_data.freq * HZ_TO_GHZ
177167
amplitudes = qubit_data.amp
@@ -188,21 +178,9 @@ def _plot(
188178
y=amplitudes,
189179
z=qubit_data.signal,
190180
colorbar_x=0.46,
191-
),
192-
row=1,
193-
col=1,
181+
)
194182
)
195183

196-
fig.add_trace(
197-
go.Heatmap(
198-
x=frequencies,
199-
y=amplitudes,
200-
z=qubit_data.phase,
201-
colorbar_x=1.01,
202-
),
203-
row=1,
204-
col=2,
205-
)
206184
if fit is not None:
207185
fig.add_trace(
208186
go.Scatter(
@@ -243,9 +221,8 @@ def _plot(
243221
legend=dict(orientation="h"),
244222
)
245223

246-
fig.update_xaxes(title_text="Frequency [GHz]", row=1, col=1)
247-
fig.update_xaxes(title_text="Frequency [GHz]", row=1, col=2)
248-
fig.update_yaxes(title_text="Amplitude [a.u.]", row=1, col=1)
224+
fig.update_xaxes(title_text="Frequency [GHz]")
225+
fig.update_yaxes(title_text="Amplitude [a.u.]")
249226

250227
figures.append(fig)
251228

src/qibocal/protocols/utils.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,7 @@ def fit_punchout(data: Data, fit_type: str):
226226
freqs = qubit_data.freq
227227
amps = getattr(qubit_data, fit_type)
228228
signal = qubit_data.signal
229-
if data.resonator_type == "3D":
230-
mask_freq, mask_amps = extract_feature(
231-
freqs, amps, signal, "max", ci_first_mask=90
232-
)
233-
else:
234-
mask_freq, mask_amps = extract_feature(
235-
freqs, amps, signal, "min", ci_first_mask=90
236-
)
229+
mask_freq, mask_amps = extract_feature(freqs, amps, signal, data.find_min)
237230
if fit_type == "amp":
238231
best_freq = np.max(mask_freq)
239232
bare_freq = np.min(mask_freq)

0 commit comments

Comments
 (0)