Skip to content

Commit

Permalink
updates to plots
Browse files Browse the repository at this point in the history
  • Loading branch information
bdoolittle committed Jan 9, 2023
1 parent e7cf430 commit 77e3e43
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 154 deletions.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 79 additions & 42 deletions script/plots/chsh_uniform_amplitude_damping_high_res.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,14 @@
Theoretical Scores
"""

# def max_entangled_score(gamma):
# return 2 * np.sqrt(2 * (1 - gamma) ** 2)

def max_entangled_score(gamma):
return 2 * np.sqrt(2 * (1 - gamma) ** 2)
return max(
2 * np.sqrt(2 * (1 - gamma) ** 2),
2 * np.sqrt((1 - gamma) ** 2 + (gamma ** 2 + (1 - gamma) ** 2) ** 2)
)

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

def nonmax_entangled_score(gamma):
lambda_star = lambda_star_score(gamma)
return _nonmax_entangled_score(gamma, lambda_star)
# return _nonmax_entangled_score(gamma, lambda_star)
return max(max_entangled_score(gamma), _nonmax_entangled_score(gamma, lambda_star))


max_entangled_theory = [max_entangled_score(gamma) for gamma in noise_params]
max_entangled_theory2 = [max_entangled_score2(gamma) for gamma in noise_params]
# max_entangled_theory2 = [max_entangled_score2(gamma) for gamma in noise_params]

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

Expand All @@ -158,76 +166,84 @@ def nonmax_entangled_score(gamma):
fontweight="bold",
)

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

ax1.plot(noise_params, [np.sqrt(2) * 2] * num_samples, "-", linewidth=2, label="Quantum Bound")
ax1.plot(noise_params, [2] * num_samples, "-.", linewidth=2, label="Classical Bound")
ax1.plot(
(qbound_plot,) = ax1.plot(noise_params, [np.sqrt(2) * 2] * num_samples, "-", linewidth=2, label="Quantum Bound")
(cbound_plot,) = ax1.plot(noise_params, [2] * num_samples, "-.", linewidth=2, label="Classical Bound")
(max_ent_theory_plot,) = ax1.plot(
noise_params,
max_entangled_theory,
"-",
color="C2",
linewidth=2,
label="Max Entangled " + r"($\sqrt{\mu_x + \mu_y}$)",
label=r"$S^\star_{\mathrm{CHSH}}(\tilde{\rho}_{\frac{1}{2},\gamma})$",
)
ax1.plot(
noise_params,
max_entangled_theory2,
"--",
color="C2",
linewidth=2,
label="Max Entangled " + r"($\sqrt{\mu_x + \mu_z}$)",
)
ax1.plot(
# ax1.plot(
# noise_params,
# max_entangled_theory2,
# "--",
# color="C2",
# linewidth=2,
# label="Max Entangled " + r"($\sqrt{\tau^2_x + \tau^2_z}$)",
# )
(nonmax_ent_theory_plot,) = ax1.plot(
noise_params,
nonmax_entangled_theory,
"-.",
"-",
color="C3",
linewidth=2,
label="Nonmax Entangled " + r"($\sqrt{\mu_x + \mu_z}$)",
label=r"$S^\star_{\mathrm{CHSH}}(\tilde{\rho}_{\lambda^\star,\gamma})$",
)
ax1.plot(
(gamma_c_nonmax_ent_plot,) = ax1.plot(
[crit_gamma, crit_gamma],
[0, 2 * np.sqrt(2)],
[1, 2 * np.sqrt(2)],
":",
linewidth=2,
color="magenta",
label="Optimal State Crossover",
color="C3",
label=r"$\gamma_{c,\lambda^\star}$",
)
ax1.plot(
(gamma_0_max_ent_plot,) = ax1.plot(
[1 - 1 / np.sqrt(2), 1 - 1 / np.sqrt(2)],
[0, 2 * np.sqrt(2)],
":",
[1, 2 * np.sqrt(2)],
"-.",
linewidth=2,
color="C2",
label="Max Entangled\nNonlocality Broken",
label=r"$\gamma_{0,\frac{1}{2}}$",
)
ax1.plot(
(gamma_0_non_max_ent_plot,) = ax1.plot(
[1 / 3, 1 / 3],
[0, 2 * np.sqrt(2)],
":",
[1, 2 * np.sqrt(2)],
"-.",
linewidth=2,
color="C3",
label="Nonmax Entangled\nNonlocality Broken",
label=r"$\gamma_{0,\lambda^\star}$",
)
ax1.plot(
(gamma_c_max_ent_plot,) = ax1.plot(
[1 / 2, 1 / 2],
[1, 2 * np.sqrt(2)],
":",
linewidth=2,
color="C2",
label=r"$\gamma_{c,\frac{1}{2}}$",
)
(vqo_max_ent_plot,) = ax1.plot(
noise_params,
ghz_max_chsh_uniform_ad,
marker="d",
color="C2",
markersize=5,
markersize=6,
markerfacecolor="None",
linewidth=2,
linestyle="None",
label="VQO Max Entangled",
alpha=0.6,
)
ax1.plot(
(vqo_nonmax_ent_plot,) = ax1.plot(
noise_params,
ryrz_cnot_max_chsh_uniform_ad,
color="C3",
marker="o",
markersize=5,
markersize=6,
markerfacecolor="None",
linewidth=2,
linestyle="None",
Expand All @@ -238,7 +254,28 @@ def nonmax_entangled_score(gamma):
ax1.set_xlabel(r"Noise Parameter ($\gamma$)", size=18)
ax1.set_ylabel(ylabel, size=18)

plt.figlegend(ncol=2, loc="lower center", fontsize=16, bbox_to_anchor=(0, -0.01, 1, 1,))
plt.figlegend(
[
qbound_plot,
cbound_plot,
(max_ent_theory_plot, vqo_max_ent_plot),
(nonmax_ent_theory_plot, vqo_nonmax_ent_plot),
gamma_c_max_ent_plot,
gamma_c_nonmax_ent_plot,
gamma_0_max_ent_plot,
gamma_0_non_max_ent_plot,
],
[
"Quantum Bound", "Classical Bound",
r"Max CHSH Score $S^\star_{\mathrm{CHSH}}(\tilde{\rho}_{\frac{1}{2},\gamma})$",
r"Max CHSH Score $S^\star_{\mathrm{CHSH}}(\tilde{\rho}_{\lambda^\star,\gamma})$",
r"Crossover Parameter $\gamma_{c,\frac{1}{2}}$",
r"Crossover Parameter $\gamma_{c,\lambda^\star}$",
r"Nonlocality Broken $\gamma_{0,\frac{1}{2}}$",
r"Nonlocality Broken $\gamma_{0,\lambda^\star}$",
],
ncol=2, loc="lower center", fontsize=18, bbox_to_anchor=(0, 0.05, 1, 1,)
)

ax2.plot(
noise_params_inset,
Expand All @@ -259,23 +296,23 @@ def nonmax_entangled_score(gamma):
ax2.plot(
noise_params_inset,
nonmax_entangled_theory_inset,
"-.",
"-",
color="C3",
linewidth=2,
label="Nonmaximally Entangled\nState Preparation",
)
ax2.plot(
[1 - 1 / np.sqrt(2), 1 - 1 / np.sqrt(2)],
[1.84, 2.12],
":",
"-.",
color="C2",
label="Max Entangled\nNonlocality Broken",
linewidth=2,
)
ax2.plot(
[1 / 3, 1 / 3],
[1.84, 2.12],
":",
"-.",
color="C3",
label="Nonmax Entanglement\nNonlocality Broken",
linewidth=2,
Expand All @@ -284,7 +321,7 @@ def nonmax_entangled_score(gamma):
[crit_gamma, crit_gamma],
[1.84, 2.12],
":",
color="magenta",
color="C3",
label="Nonmax Entanglement\nNonlocality Broken",
linewidth=2,
)
Expand All @@ -293,7 +330,7 @@ def nonmax_entangled_score(gamma):
ghz_max_chsh_uniform_ad_inset,
color="C2",
marker="d",
markersize=5,
markersize=6,
markerfacecolor="None",
label=r"Bell State Preparation ($|\Phi^+\rangle$)",
alpha=0.6,
Expand All @@ -303,7 +340,7 @@ def nonmax_entangled_score(gamma):
ryrz_cnot_max_chsh_uniform_ad_inset,
color="C3",
marker="o",
markersize=5,
markersize=6,
markerfacecolor="None",
linewidth=1,
label="Nonmaximally Entangled\nState Preparation",
Expand Down
1 change: 1 addition & 0 deletions script/plots/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
import sys

sys.path.insert(0, os.path.abspath("./"))
# sys.path.insert(0, os.path.abspath("../../"))

import src
Loading

0 comments on commit 77e3e43

Please sign in to comment.