-
Notifications
You must be signed in to change notification settings - Fork 1
/
angular_resolution_vs_energy.py
61 lines (45 loc) · 1.54 KB
/
angular_resolution_vs_energy.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Authors: S. Einecke <sabrina.einecke@adelaide.edu.au>
# K. Brueege <kai.bruegge@tu-dortmund.de>
import click
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import astropy.units as u
from utilities import read_data, make_energy_bins, add_theta
from plotting import plot_percentile
@click.command()
@click.argument('input_file', type=click.Path(exists=True))
@click.option('-o', '--output', type=click.Path(exists=False))
@click.option('-t', '--thresholds', multiple=True, default=0.0)
def main(input_file, output, thresholds):
df = read_data(input_file)
df = add_theta(df)
if not thresholds:
thresholds = [0.0]
bins, bin_centers, bin_widths = make_energy_bins(
e_min=0.08 * u.TeV,
e_max=300 * u.TeV,
bins=15,
centering='log'
)
ax = None
for t in thresholds:
x = df[df.gamma_score_mean > t].energy_mean.values
y = df[df.gamma_score_mean > t].theta
ax = plot_percentile(x, y, t, bins, bin_centers, bin_widths, ax=ax)
ref = np.loadtxt('references/South-SST-AngRes.txt')
plt.plot(10**ref[:,0], ref[:,1],
'--', label='SST sub-system', color='silver')
ax.set_xscale('log')
ax.set_xlim([0.5,300])
ax.set_ylim([0,0.5])
ax.set_ylabel('Angular Resolution / deg')
ax.set_xlabel(r'$\mathrm{Reconstructed}\ \mathrm{Energy}\ /\ \mathrm{TeV}$')
ax.legend()
plt.tight_layout()
if output:
plt.savefig(output)
else:
plt.show()
if __name__ == "__main__":
main()