diff --git a/data/plots/detector_biased_noise_robustness/Detector Biased Noise Robustness_max_scores_single_and_uniform_2022-05-03T16-53-44Z.png b/data/plots/detector_biased_noise_robustness/Detector Biased Noise Robustness_max_scores_single_and_uniform_2022-05-03T16-53-44Z.png deleted file mode 100644 index 8896aa9..0000000 Binary files a/data/plots/detector_biased_noise_robustness/Detector Biased Noise Robustness_max_scores_single_and_uniform_2022-05-03T16-53-44Z.png and /dev/null differ diff --git a/data/plots/detector_biased_noise_robustness/Detector Biased Noise Robustness_max_scores_single_and_uniform_2022-09-12T03-48-24Z.png b/data/plots/detector_biased_noise_robustness/Detector Biased Noise Robustness_max_scores_single_and_uniform_2022-09-12T03-48-24Z.png new file mode 100644 index 0000000..d96663f Binary files /dev/null and b/data/plots/detector_biased_noise_robustness/Detector Biased Noise Robustness_max_scores_single_and_uniform_2022-09-12T03-48-24Z.png differ diff --git a/data/plots/source_depolarizing_noise_robustness/Source Depolarizing Noise Robustness_max_scores_single_and_uniform_2022-08-31T16-46-45Z.png b/data/plots/source_depolarizing_noise_robustness/Source Depolarizing Noise Robustness_max_scores_single_and_uniform_2022-08-31T16-46-45Z.png deleted file mode 100644 index 388ae7b..0000000 Binary files a/data/plots/source_depolarizing_noise_robustness/Source Depolarizing Noise Robustness_max_scores_single_and_uniform_2022-08-31T16-46-45Z.png and /dev/null differ diff --git a/data/plots/source_depolarizing_noise_robustness/Source Depolarizing Noise Robustness_max_scores_single_and_uniform_2022-09-12T03-55-19Z.png b/data/plots/source_depolarizing_noise_robustness/Source Depolarizing Noise Robustness_max_scores_single_and_uniform_2022-09-12T03-55-19Z.png new file mode 100644 index 0000000..7f04e66 Binary files /dev/null and b/data/plots/source_depolarizing_noise_robustness/Source Depolarizing Noise Robustness_max_scores_single_and_uniform_2022-09-12T03-55-19Z.png differ diff --git a/script/plots/detector_biased_noise_robustness.py b/script/plots/detector_biased_noise_robustness.py index 1a4d024..4237dac 100644 --- a/script/plots/detector_biased_noise_robustness.py +++ b/script/plots/detector_biased_noise_robustness.py @@ -384,7 +384,7 @@ ], plot_dir="./data/plots/detector_biased_noise_robustness/", legend_labels=["Arbitrary VQO", "Max Entangled VQO"], - ncol_legend=2, - bottom_padding=0.45, - fig_height=7, + ncol_legend=4, + bottom_padding=0.3, + fig_height=5, ) diff --git a/script/plots/source_colored_noise_robustness.py b/script/plots/source_colored_noise_robustness.py index bdbd830..1f00bb4 100644 --- a/script/plots/source_colored_noise_robustness.py +++ b/script/plots/source_colored_noise_robustness.py @@ -430,52 +430,60 @@ def verify_data(theoretical_score, vqo_score, atol=1e-8): return theoretical_score >= vqo_score or np.isclose(theoretical_score, vqo_score, atol=atol) for u in range(21): - assert verify_data(phi_plus_theoretical_chsh, phi_plus_max_chsh_colored) - assert verify_data(phi_plus_theoretical_single_bilocal, phi_plus_max_bilocal_single_colored) + assert verify_data(phi_plus_theoretical_chsh[5 * u], phi_plus_max_chsh_colored[u]) assert verify_data( - phi_plus_theoretical_single_n3_chain, phi_plus_max_bilocal_single_colored + phi_plus_theoretical_single_bilocal[5 * u], phi_plus_max_bilocal_single_colored[u] ) assert verify_data( - phi_plus_theoretical_single_n4_chain, phi_plus_max_n4_chain_single_colored + phi_plus_theoretical_single_n3_chain[5 * u], phi_plus_max_n3_chain_single_colored[u] + ) + assert verify_data( + phi_plus_theoretical_single_n4_chain[5 * u], phi_plus_max_n4_chain_single_colored[u] + ) + assert verify_data( + phi_plus_theoretical_single_n3_star[5 * u], phi_plus_max_n3_star_single_colored[u] ) - assert verify_data(phi_plus_theoretical_single_n3_star, phi_plus_max_n3_star_single_colored) - assert verify_data(psi_plus_theoretical_chsh, psi_plus_max_chsh_colored) - assert verify_data(psi_plus_theoretical_single_bilocal, psi_plus_max_bilocal_single_colored) + assert verify_data(psi_plus_theoretical_chsh[5 * u], psi_plus_max_chsh_colored[u]) + assert verify_data( + psi_plus_theoretical_single_bilocal[5 * u], psi_plus_max_bilocal_single_colored[u] + ) + assert verify_data( + psi_plus_theoretical_single_n3_chain[5 * u], psi_plus_max_n3_chain_single_colored[u] + ) assert verify_data( - psi_plus_theoretical_single_n3_chain, psi_plus_max_bilocal_single_colored + psi_plus_theoretical_single_n4_chain[5 * u], psi_plus_max_n4_chain_single_colored[u] ) assert verify_data( - psi_plus_theoretical_single_n4_chain, psi_plus_max_n4_chain_single_colored + psi_plus_theoretical_single_n3_star[5 * u], psi_plus_max_n3_star_single_colored[u] ) - assert verify_data(psi_plus_theoretical_single_n3_star, psi_plus_max_n3_star_single_colored) - assert verify_data(phi_plus_theoretical_chsh, phi_plus_max_chsh_colored) + assert verify_data(phi_plus_theoretical_chsh[5 * u], phi_plus_max_chsh_colored[u]) assert verify_data( - phi_plus_theoretical_uniform_bilocal, phi_plus_max_bilocal_uniform_colored + phi_plus_theoretical_uniform_bilocal[5 * u], phi_plus_max_bilocal_uniform_colored[u] ) assert verify_data( - phi_plus_theoretical_uniform_n3_chain, phi_plus_max_bilocal_uniform_colored + phi_plus_theoretical_uniform_n3_chain[5 * u], phi_plus_max_n3_chain_uniform_colored[u] ) assert verify_data( - phi_plus_theoretical_uniform_n4_chain, phi_plus_max_n4_chain_uniform_colored + phi_plus_theoretical_uniform_n4_chain[5 * u], phi_plus_max_n4_chain_uniform_colored[u] ) assert verify_data( - phi_plus_theoretical_uniform_n3_star, phi_plus_max_n3_star_uniform_colored + phi_plus_theoretical_uniform_n3_star[5 * u], phi_plus_max_n3_star_uniform_colored[u] ) - assert verify_data(psi_plus_theoretical_chsh, psi_plus_max_chsh_colored) + assert verify_data(psi_plus_theoretical_chsh[5 * u], psi_plus_max_chsh_colored[u]) assert verify_data( - psi_plus_theoretical_uniform_bilocal, psi_plus_max_bilocal_uniform_colored + psi_plus_theoretical_uniform_bilocal[5 * u], psi_plus_max_bilocal_uniform_colored[u] ) assert verify_data( - psi_plus_theoretical_uniform_n3_chain, psi_plus_max_bilocal_uniform_colored + psi_plus_theoretical_uniform_n3_chain[5 * u], psi_plus_max_n3_chain_uniform_colored[u] ) assert verify_data( - psi_plus_theoretical_uniform_n4_chain, psi_plus_max_n4_chain_uniform_colored + psi_plus_theoretical_uniform_n4_chain[5 * u], psi_plus_max_n4_chain_uniform_colored[u] ) assert verify_data( - psi_plus_theoretical_uniform_n3_star, psi_plus_max_n3_star_uniform_colored + psi_plus_theoretical_uniform_n3_star[5 * u], psi_plus_max_n3_star_uniform_colored[u] ) """ diff --git a/script/plots/source_depolarizing_noise_robustness.py b/script/plots/source_depolarizing_noise_robustness.py index d867d79..16cf0ed 100644 --- a/script/plots/source_depolarizing_noise_robustness.py +++ b/script/plots/source_depolarizing_noise_robustness.py @@ -24,6 +24,8 @@ def bell_state_noise(gamma): if __name__ == "__main__": num_samples = 21 + theory_noise_params = np.arange(0, 1.0001, 0.001) + bell_state_noise_states = [bell_state_noise(gamma) for gamma in np.arange(0, 1.01, 0.05)] bell_state = np.array([[1, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0], [1, 0, 0, 1]]) / 2 @@ -55,7 +57,7 @@ def bell_state_noise(gamma): # ] theoretical_max_chsh = [ - np.sqrt(2) * np.abs((1 - gamma * 16 / 15)) for gamma in np.arange(0, 1.01, 0.05) + np.sqrt(2) * np.abs((1 - gamma * 16 / 15)) for gamma in theory_noise_params ] """ @@ -103,12 +105,11 @@ def bell_state_noise(gamma): # ] theoretical_max_uniform_bilocal = [ - np.sqrt(2) * np.sqrt(np.abs((1 - gamma * 16 / 15) ** 2)) - for gamma in np.arange(0, 1.01, 0.05) + np.sqrt(2) * np.sqrt(np.abs((1 - gamma * 16 / 15) ** 2)) for gamma in theory_noise_params ] theoretical_max_single_bilocal = [ - np.sqrt(2) * np.sqrt(np.abs((1 - gamma * 16 / 15))) for gamma in np.arange(0, 1.01, 0.05) + np.sqrt(2) * np.sqrt(np.abs((1 - gamma * 16 / 15))) for gamma in theory_noise_params ] """ @@ -152,12 +153,11 @@ def bell_state_noise(gamma): # ] theoretical_max_uniform_n3_chain = [ - np.sqrt(2) * np.sqrt(np.abs((1 - gamma * 16 / 15) ** 3)) - for gamma in np.arange(0, 1.01, 0.05) + np.sqrt(2) * np.sqrt(np.abs((1 - gamma * 16 / 15) ** 3)) for gamma in theory_noise_params ] theoretical_max_single_n3_chain = [ - np.sqrt(2) * np.sqrt(np.abs((1 - gamma * 16 / 15))) for gamma in np.arange(0, 1.01, 0.05) + np.sqrt(2) * np.sqrt(np.abs((1 - gamma * 16 / 15))) for gamma in theory_noise_params ] """ @@ -201,13 +201,12 @@ def bell_state_noise(gamma): # ] theoretical_max_single_n3_star = [ - np.sqrt(2) * np.power(np.abs((1 - gamma * 16 / 15)), 1 / 3) - for gamma in np.arange(0, 1.01, 0.05) + np.sqrt(2) * np.power(np.abs((1 - gamma * 16 / 15)), 1 / 3) for gamma in theory_noise_params ] theoretical_max_uniform_n3_star = [ np.sqrt(2) * np.power(np.abs((1 - gamma * 16 / 15) ** 3), 1 / 3) - for gamma in np.arange(0, 1.01, 0.05) + for gamma in theory_noise_params ] """ @@ -218,15 +217,15 @@ def verify_data(theoretical_score, vqo_score): return theoretical_score >= vqo_score or np.isclose(theoretical_score, vqo_score) for u in range(21): - assert verify_data(theoretical_max_chsh[u], max_chsh_dep[u]) - assert verify_data(theoretical_max_uniform_bilocal[u], max_bilocal_uniform_dep[u]) - assert verify_data(theoretical_max_uniform_n3_chain[u], max_n3_chain_uniform_dep[u]) - assert verify_data(theoretical_max_uniform_n3_star[u], max_n3_star_uniform_dep[u]) + assert verify_data(theoretical_max_chsh[50 * u], max_chsh_dep[u]) + assert verify_data(theoretical_max_uniform_bilocal[50 * u], max_bilocal_uniform_dep[u]) + assert verify_data(theoretical_max_uniform_n3_chain[50 * u], max_n3_chain_uniform_dep[u]) + assert verify_data(theoretical_max_uniform_n3_star[50 * u], max_n3_star_uniform_dep[u]) - assert verify_data(theoretical_max_chsh[u], max_chsh_dep[u]) - assert verify_data(theoretical_max_single_bilocal[u], max_bilocal_single_dep[u]) - assert verify_data(theoretical_max_single_n3_chain[u], max_n3_chain_single_dep[u]) - assert verify_data(theoretical_max_single_n3_star[u], max_n3_star_single_dep[u]) + assert verify_data(theoretical_max_chsh[50 * u], max_chsh_dep[u]) + assert verify_data(theoretical_max_single_bilocal[50 * u], max_bilocal_single_dep[u]) + assert verify_data(theoretical_max_single_n3_chain[50 * u], max_n3_chain_single_dep[u]) + assert verify_data(theoretical_max_single_n3_star[50 * u], max_n3_star_single_dep[u]) """ Plotting Data @@ -268,4 +267,5 @@ def verify_data(theoretical_score, vqo_score): plot_dir="./data/plots/source_depolarizing_noise_robustness/", # bottom_padding=0.4, ncol_legend=3, + theory_params=theory_noise_params, ) diff --git a/src/utilities.py b/src/utilities.py index 857145b..d0d5bf3 100644 --- a/src/utilities.py +++ b/src/utilities.py @@ -602,6 +602,7 @@ def plot_unital_single_and_uniform_max_scores_data( bottom_padding=0.3, fig_height=5, ncol_legend=4, + theory_params=[], ): """Plots the noise robustness for single and uniform qubit/source/measurement noise models. This method is intended for plotting the max score across many @@ -637,6 +638,9 @@ def plot_unital_single_and_uniform_max_scores_data( :param plot_dir: The directory to which the data will be plotted. :type plt_dir: String + + :param theory_params: Noise params for theoretical data. + :type theory_params: List """ fig, axes = plt.subplots(1, 2, figsize=(10, fig_height)) fig.suptitle(fig_title, fontsize=24, fontweight="bold") @@ -655,6 +659,9 @@ def plot_unital_single_and_uniform_max_scores_data( # line_widths = [5.5,5,4.5,4,3.5,3,2.5,2] dashes_list = [2, 3, 4, 5, 6, 7, 8, 9] + if len(theory_params) == 0: + theory_params = noise_params + ax_data_sets = [single_max_scores, uniform_max_scores] ax_theory_sets = [single_theoretical_scores, uniform_theoretical_scores] ax_match_sets = [single_match_scores, uniform_match_scores] @@ -692,7 +699,7 @@ def plot_unital_single_and_uniform_max_scores_data( if len(theory_set) != 0: (theory_plt,) = ax.plot( - noise_params, + theory_params, theory_set, color=line_colors[j], linestyle=":",