Skip to content

Commit

Permalink
Merge branch 'clouds' of github.com:qiboteam/qibocal into clouds
Browse files Browse the repository at this point in the history
  • Loading branch information
Edoardo-Pedicillo committed Nov 14, 2023
2 parents b877a72 + aa623fd commit 613fc1a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- id: check-merge-conflict
- id: debug-statements
- repo: https://github.com/psf/black
rev: 23.10.1
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ def _acquisition(
qubit_data = data_transition.data[qubit]
freq = qubit_data["freq"]
bias = qubit_data["bias"]
msr = qubit_data["msr"]
signal = qubit_data["signal"]
phase = qubit_data["phase"]
data.register_qubit(
QubitFluxType,
(float(qubit), transition),
dict(
freq=freq.tolist(),
bias=bias.tolist(),
msr=msr.tolist(),
signal=signal.tolist(),
phase=phase.tolist(),
),
)
Expand Down Expand Up @@ -171,7 +171,7 @@ def _plot(data: AvoidedCrossingData, fit: AvoidedCrossingResults, qubit):
go.Heatmap(
x=data_high.freq * HZ_TO_GHZ,
y=data_high.bias,
z=data_high.msr,
z=data_high.signal,
coloraxis="coloraxis",
),
row=1,
Expand Down Expand Up @@ -293,14 +293,8 @@ def find_parabola(data: dict) -> list:
frequencies = []
for bias in biass:
data_bias = data[currs == bias]
index = data_bias["msr"].argmax()
average_msr = np.average(data_bias["msr"])
st_dev_msr = np.std(data_bias["msr"])
if (
data_bias["msr"][index] > average_msr + st_dev_msr
or data_bias["msr"][index] > average_msr - st_dev_msr
):
frequencies.append(freqs[index])
index = data_bias["signal"].argmax()
frequencies.append(freqs[index])
return frequencies


Expand Down
32 changes: 14 additions & 18 deletions src/qibocal/protocols/characterization/readout_mitigation_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

import numpy as np
import numpy.typing as npt
import plotly.figure_factory as ff
import plotly.graph_objects as go
import plotly.express as px
from qibo import gates
from qibo.models import Circuit
from qibolab import ExecutionParameters
Expand Down Expand Up @@ -172,30 +171,27 @@ def _plot(
):
"""Plotting function for readout mitigation matrix."""
fitting_report = ""
fig = go.Figure()

if fit is not None:
computational_basis = [
format(i, f"0{len(qubit)}b") for i in range(2 ** len(qubit))
]

x = computational_basis
y = computational_basis[::-1]

[X, Y] = np.meshgrid(x, y)

Z = fit.measurement_matrix[tuple(qubit)]

fig = ff.create_annotated_heatmap(Z, showscale=True)
fig.update_layout(
uirevision="0", # ``uirevision`` allows zooming while live plotting
xaxis_title="State prepared",
yaxis_title="State measured",
z = fit.measurement_matrix[tuple(qubit)]

fig = px.imshow(
z,
x=computational_basis,
y=computational_basis[::-1],
text_auto=True,
labels={
"x": "Prepeared States",
"y": "Measured States",
"color": "Probabilities",
},
width=700,
height=700,
)

return [fig], None
return [fig], fitting_report


readout_mitigation_matrix = Routine(_acquisition, _fit, _plot)
Expand Down

0 comments on commit 613fc1a

Please sign in to comment.