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 d7f30da commit e9e42be
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 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 @@ -138,9 +138,12 @@ def _fit(data: MerminData) -> MerminResults:
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 +155,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 e9e42be

Please sign in to comment.