Skip to content

Commit

Permalink
display properly the measurements for apparatus 2 even if the color c…
Browse files Browse the repository at this point in the history
…onvention is inverted
  • Loading branch information
azimonti committed May 15, 2024
1 parent 34f09e9 commit a2f2d59
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions epr_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,19 @@ def drawText(self):
self.measurements1 == -1) / measurements_nb
painter.drawText(rect, Qt.AlignmentFlag.AlignCenter,
f"< color 2 > = {prob_m1*100:.1f}%")

# Invert back the results for apparatus 2 if in the config,
# for correctly displaying the measurement as it would be
# if the apparatus measure it (so if apparatus 1 shows +1
# and both are using the same switch, apparatus 2 should
# show -1 if it is a singlet
if cfg.invert:
measurement2_disp = -1 * self.measurement2
else:
measurement2_disp = self.measurement2
y = int(0.25 * self.height() + base1 + 0 * step)
rect = QRect(0, y, tq_width, self.height() - y)
painter.drawText(rect, Qt.AlignmentFlag.AlignCenter,
f"Measurement: {self.measurement2}")
f"Measurement: {measurement2_disp}")
y = int(0.25 * self.height() + base1 + 1 * step)
rect = QRect(0, y, tq_width, self.height() - y)
prob_p2 = np.count_nonzero(
Expand All @@ -453,6 +461,10 @@ def drawText(self):
diff_mask = self.switches1 != self.switches2
num_same = np.sum(same_mask)
num_diff = np.sum(diff_mask)

# Count occurrences where measurements have
# the same value
equal = np.sum(self.measurements1 == self.measurements2)
# Count occurrences where measurements have
# the same value for same_mask
if num_same > 0:
Expand Down Expand Up @@ -500,11 +512,12 @@ def drawText(self):
y = int(0.25 * self.height() + base1 + 0 * step)
rect = QRect(0, y, self.width(), self.height() - y)
painter.drawText(rect, Qt.AlignmentFlag.AlignCenter,
"Total Measurements")
f"Total Measurements: {measurements_nb}")
y = int(0.25 * self.height() + base1 + 1 * step)
rect = QRect(0, y, self.width(), self.height() - y)
painter.drawText(rect, Qt.AlignmentFlag.AlignCenter,
f"{measurements_nb}")
"% same results = "
f"{equal/measurements_nb*100:.1f}%")

painter.end()
glEnable(GL_DEPTH_TEST)
Expand Down

0 comments on commit a2f2d59

Please sign in to comment.