Skip to content

Commit 77e3e43

Browse files
committed
updates to plots
1 parent e7cf430 commit 77e3e43

File tree

6 files changed

+270
-154
lines changed

6 files changed

+270
-154
lines changed
133 KB
Loading
336 KB
Loading

script/plots/chsh_uniform_amplitude_damping_high_res.py

Lines changed: 79 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,14 @@
103103
Theoretical Scores
104104
"""
105105

106+
# def max_entangled_score(gamma):
107+
# return 2 * np.sqrt(2 * (1 - gamma) ** 2)
108+
106109
def max_entangled_score(gamma):
107-
return 2 * np.sqrt(2 * (1 - gamma) ** 2)
110+
return max(
111+
2 * np.sqrt(2 * (1 - gamma) ** 2),
112+
2 * np.sqrt((1 - gamma) ** 2 + (gamma ** 2 + (1 - gamma) ** 2) ** 2)
113+
)
108114

109115
def max_entangled_score2(gamma):
110116
return 2 * np.sqrt((1 - gamma) ** 2 + (gamma ** 2 + (1 - gamma) ** 2) ** 2)
@@ -130,10 +136,12 @@ def _nonmax_entangled_score(gamma, lambda_star):
130136

131137
def nonmax_entangled_score(gamma):
132138
lambda_star = lambda_star_score(gamma)
133-
return _nonmax_entangled_score(gamma, lambda_star)
139+
# return _nonmax_entangled_score(gamma, lambda_star)
140+
return max(max_entangled_score(gamma), _nonmax_entangled_score(gamma, lambda_star))
141+
134142

135143
max_entangled_theory = [max_entangled_score(gamma) for gamma in noise_params]
136-
max_entangled_theory2 = [max_entangled_score2(gamma) for gamma in noise_params]
144+
# max_entangled_theory2 = [max_entangled_score2(gamma) for gamma in noise_params]
137145

138146
nonmax_entangled_theory = [nonmax_entangled_score(gamma) for gamma in noise_params]
139147

@@ -158,76 +166,84 @@ def nonmax_entangled_score(gamma):
158166
fontweight="bold",
159167
)
160168

161-
ylabel = r"Max CHSH Score ($S^\star_{\mathrm{CHSH}}(\tilde{\rho}_\lambda)$)"
169+
ylabel = r"$S^\star_{\mathrm{CHSH}}(\tilde{\rho}_{\lambda,\gamma})$"
162170

163-
ax1.plot(noise_params, [np.sqrt(2) * 2] * num_samples, "-", linewidth=2, label="Quantum Bound")
164-
ax1.plot(noise_params, [2] * num_samples, "-.", linewidth=2, label="Classical Bound")
165-
ax1.plot(
171+
(qbound_plot,) = ax1.plot(noise_params, [np.sqrt(2) * 2] * num_samples, "-", linewidth=2, label="Quantum Bound")
172+
(cbound_plot,) = ax1.plot(noise_params, [2] * num_samples, "-.", linewidth=2, label="Classical Bound")
173+
(max_ent_theory_plot,) = ax1.plot(
166174
noise_params,
167175
max_entangled_theory,
168176
"-",
169177
color="C2",
170178
linewidth=2,
171-
label="Max Entangled " + r"($\sqrt{\mu_x + \mu_y}$)",
179+
label=r"$S^\star_{\mathrm{CHSH}}(\tilde{\rho}_{\frac{1}{2},\gamma})$",
172180
)
173-
ax1.plot(
174-
noise_params,
175-
max_entangled_theory2,
176-
"--",
177-
color="C2",
178-
linewidth=2,
179-
label="Max Entangled " + r"($\sqrt{\mu_x + \mu_z}$)",
180-
)
181-
ax1.plot(
181+
# ax1.plot(
182+
# noise_params,
183+
# max_entangled_theory2,
184+
# "--",
185+
# color="C2",
186+
# linewidth=2,
187+
# label="Max Entangled " + r"($\sqrt{\tau^2_x + \tau^2_z}$)",
188+
# )
189+
(nonmax_ent_theory_plot,) = ax1.plot(
182190
noise_params,
183191
nonmax_entangled_theory,
184-
"-.",
192+
"-",
185193
color="C3",
186194
linewidth=2,
187-
label="Nonmax Entangled " + r"($\sqrt{\mu_x + \mu_z}$)",
195+
label=r"$S^\star_{\mathrm{CHSH}}(\tilde{\rho}_{\lambda^\star,\gamma})$",
188196
)
189-
ax1.plot(
197+
(gamma_c_nonmax_ent_plot,) = ax1.plot(
190198
[crit_gamma, crit_gamma],
191-
[0, 2 * np.sqrt(2)],
199+
[1, 2 * np.sqrt(2)],
192200
":",
193201
linewidth=2,
194-
color="magenta",
195-
label="Optimal State Crossover",
202+
color="C3",
203+
label=r"$\gamma_{c,\lambda^\star}$",
196204
)
197-
ax1.plot(
205+
(gamma_0_max_ent_plot,) = ax1.plot(
198206
[1 - 1 / np.sqrt(2), 1 - 1 / np.sqrt(2)],
199-
[0, 2 * np.sqrt(2)],
200-
":",
207+
[1, 2 * np.sqrt(2)],
208+
"-.",
201209
linewidth=2,
202210
color="C2",
203-
label="Max Entangled\nNonlocality Broken",
211+
label=r"$\gamma_{0,\frac{1}{2}}$",
204212
)
205-
ax1.plot(
213+
(gamma_0_non_max_ent_plot,) = ax1.plot(
206214
[1 / 3, 1 / 3],
207-
[0, 2 * np.sqrt(2)],
208-
":",
215+
[1, 2 * np.sqrt(2)],
216+
"-.",
209217
linewidth=2,
210218
color="C3",
211-
label="Nonmax Entangled\nNonlocality Broken",
219+
label=r"$\gamma_{0,\lambda^\star}$",
212220
)
213-
ax1.plot(
221+
(gamma_c_max_ent_plot,) = ax1.plot(
222+
[1 / 2, 1 / 2],
223+
[1, 2 * np.sqrt(2)],
224+
":",
225+
linewidth=2,
226+
color="C2",
227+
label=r"$\gamma_{c,\frac{1}{2}}$",
228+
)
229+
(vqo_max_ent_plot,) = ax1.plot(
214230
noise_params,
215231
ghz_max_chsh_uniform_ad,
216232
marker="d",
217233
color="C2",
218-
markersize=5,
234+
markersize=6,
219235
markerfacecolor="None",
220236
linewidth=2,
221237
linestyle="None",
222238
label="VQO Max Entangled",
223239
alpha=0.6,
224240
)
225-
ax1.plot(
241+
(vqo_nonmax_ent_plot,) = ax1.plot(
226242
noise_params,
227243
ryrz_cnot_max_chsh_uniform_ad,
228244
color="C3",
229245
marker="o",
230-
markersize=5,
246+
markersize=6,
231247
markerfacecolor="None",
232248
linewidth=2,
233249
linestyle="None",
@@ -238,7 +254,28 @@ def nonmax_entangled_score(gamma):
238254
ax1.set_xlabel(r"Noise Parameter ($\gamma$)", size=18)
239255
ax1.set_ylabel(ylabel, size=18)
240256

241-
plt.figlegend(ncol=2, loc="lower center", fontsize=16, bbox_to_anchor=(0, -0.01, 1, 1,))
257+
plt.figlegend(
258+
[
259+
qbound_plot,
260+
cbound_plot,
261+
(max_ent_theory_plot, vqo_max_ent_plot),
262+
(nonmax_ent_theory_plot, vqo_nonmax_ent_plot),
263+
gamma_c_max_ent_plot,
264+
gamma_c_nonmax_ent_plot,
265+
gamma_0_max_ent_plot,
266+
gamma_0_non_max_ent_plot,
267+
],
268+
[
269+
"Quantum Bound", "Classical Bound",
270+
r"Max CHSH Score $S^\star_{\mathrm{CHSH}}(\tilde{\rho}_{\frac{1}{2},\gamma})$",
271+
r"Max CHSH Score $S^\star_{\mathrm{CHSH}}(\tilde{\rho}_{\lambda^\star,\gamma})$",
272+
r"Crossover Parameter $\gamma_{c,\frac{1}{2}}$",
273+
r"Crossover Parameter $\gamma_{c,\lambda^\star}$",
274+
r"Nonlocality Broken $\gamma_{0,\frac{1}{2}}$",
275+
r"Nonlocality Broken $\gamma_{0,\lambda^\star}$",
276+
],
277+
ncol=2, loc="lower center", fontsize=18, bbox_to_anchor=(0, 0.05, 1, 1,)
278+
)
242279

243280
ax2.plot(
244281
noise_params_inset,
@@ -259,23 +296,23 @@ def nonmax_entangled_score(gamma):
259296
ax2.plot(
260297
noise_params_inset,
261298
nonmax_entangled_theory_inset,
262-
"-.",
299+
"-",
263300
color="C3",
264301
linewidth=2,
265302
label="Nonmaximally Entangled\nState Preparation",
266303
)
267304
ax2.plot(
268305
[1 - 1 / np.sqrt(2), 1 - 1 / np.sqrt(2)],
269306
[1.84, 2.12],
270-
":",
307+
"-.",
271308
color="C2",
272309
label="Max Entangled\nNonlocality Broken",
273310
linewidth=2,
274311
)
275312
ax2.plot(
276313
[1 / 3, 1 / 3],
277314
[1.84, 2.12],
278-
":",
315+
"-.",
279316
color="C3",
280317
label="Nonmax Entanglement\nNonlocality Broken",
281318
linewidth=2,
@@ -284,7 +321,7 @@ def nonmax_entangled_score(gamma):
284321
[crit_gamma, crit_gamma],
285322
[1.84, 2.12],
286323
":",
287-
color="magenta",
324+
color="C3",
288325
label="Nonmax Entanglement\nNonlocality Broken",
289326
linewidth=2,
290327
)
@@ -293,7 +330,7 @@ def nonmax_entangled_score(gamma):
293330
ghz_max_chsh_uniform_ad_inset,
294331
color="C2",
295332
marker="d",
296-
markersize=5,
333+
markersize=6,
297334
markerfacecolor="None",
298335
label=r"Bell State Preparation ($|\Phi^+\rangle$)",
299336
alpha=0.6,
@@ -303,7 +340,7 @@ def nonmax_entangled_score(gamma):
303340
ryrz_cnot_max_chsh_uniform_ad_inset,
304341
color="C3",
305342
marker="o",
306-
markersize=5,
343+
markersize=6,
307344
markerfacecolor="None",
308345
linewidth=1,
309346
label="Nonmaximally Entangled\nState Preparation",

script/plots/context.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
import sys
33

44
sys.path.insert(0, os.path.abspath("./"))
5+
# sys.path.insert(0, os.path.abspath("../../"))
56

67
import src

0 commit comments

Comments
 (0)