forked from navjotk/error_propagation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_stacking.py
More file actions
31 lines (24 loc) · 1.29 KB
/
plot_stacking.py
File metadata and controls
31 lines (24 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pandas as pd
import matplotlib.pyplot as plt
import tikzplotlib
import click
@click.command()
@click.option('--filename', help='File containing the results to plot')
def draw_plots(filename):
stacking_results = pd.read_csv(filename)
results_1 = stacking_results[stacking_results["atol"]==1e-1][["shot", "angle"]].sort_values("shot")
results_4 = stacking_results[stacking_results["atol"]==1e-4][["shot", "angle"]].sort_values("shot")
results_8 = stacking_results[stacking_results["atol"]==1e-8][["shot", "angle"]].sort_values("shot")
results_16 = stacking_results[stacking_results["atol"]==1e-16][["shot", "angle"]].sort_values("shot")
plt.plot(results_1["shot"], results_1["angle"], "-", label="atol=1e-1")
plt.plot(results_4["shot"], results_4["angle"], "--", label="atol=1e-4")
plt.plot(results_8["shot"], results_8["angle"], ":", label="atol=1e-8")
plt.plot(results_16["shot"], results_16["angle"], ".-", label="atol=1e-16")
plt.xlabel("shots")
plt.ylabel("Angle with perfect gradient (radians)")
plt.title("Angular deviation of gradient as a function of number of shots stacked")
plt.legend()
plt.savefig("stacking_experiment.pdf", bbox_inches='tight')
tikzplotlib.save("stacking_experiment.tex")
if __name__ == '__main__':
draw_plots()