Skip to content

Commit

Permalink
fix: evaluate the state properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Edoardo-Pedicillo committed Nov 25, 2024
1 parent 5204ba3 commit 804abff
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/qibocal/protocols/two_qubit_interaction/mermin/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MerminParameters(Parameters):
[
("theta", float),
("basis", STRING_TYPE),
("state", STRING_TYPE),
("state", int),
("frequency", int),
]
)
Expand Down Expand Up @@ -117,7 +117,7 @@ def _acquisition(
dict(
theta=np.array([theta]),
basis=np.array([basis]),
state=np.array([str(format(state, f"0{len(qubits)}b"))]),
state=np.array([state]),
frequency=np.array([frequency]),
),
)
Expand All @@ -133,14 +133,18 @@ def _fit(data: MerminData) -> MerminResults:
for qubits in targets:
mermin_polynomial = get_mermin_polynomial(len(qubits))
mermin_coefficients = get_mermin_coefficients(mermin_polynomial)

for theta in data.thetas:
qubit_data = data.data[qubits]
outputs = []
mitigated_outputs = []
for base in basis:

frequencies = np.zeros(2 ** len(qubits))
data_filter = (qubit_data.basis == base) & (qubit_data.theta == theta)
filtered_data = qubit_data[data_filter]
state_freq = qubit_data[data_filter].frequency
for state, freq in zip(filtered_data.state, filtered_data.frequency):
frequencies[state] = freq

outputs.append(
{
Expand All @@ -152,7 +156,7 @@ def _fit(data: MerminData) -> MerminResults:
if data.mitigation_matrix:
mitigated_output = np.dot(
data.mitigation_matrix[qubits],
state_freq,
frequencies,
)
mitigated_outputs.append(
{
Expand Down

0 comments on commit 804abff

Please sign in to comment.