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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!/usr/bin/env python
"""
Script to plot the probabilities for atmospheric neutrino oscillations. To run
it:
$ ./plot-atmospheric-oscillations nue_osc_prob.txt
"""
from __future__ import print_function, division
import numpy as np
if __name__ == '__main__':
import argparse
from os.path import split, splitext
from sddm import setup_matplotlib
parser = argparse.ArgumentParser("script to plot atmospheric oscillations")
parser.add_argument("filenames", nargs='+', help="oscillation probability filenames")
parser.add_argument("--save", action="store_true", default=False, help="save plots")
args = parser.parse_args()
setup_matplotlib(args.save)
import matplotlib.pyplot as plt
for filename in args.filenames:
head, tail = split(filename)
root, ext = splitext(tail)
e, z, pnue, pnum, pnut = np.genfromtxt(filename).T
shape0 = len(np.unique(e))
ee = e.reshape((shape0,-1))
zz = z.reshape((shape0,-1))
pnue = pnue.reshape((shape0,-1))
pnum = pnum.reshape((shape0,-1))
pnut = pnut.reshape((shape0,-1))
levels = np.linspace(0,1,101)
plt.figure()
plt.contourf(ee,zz,pnue,levels=levels)
plt.gca().set_xscale('log')
plt.xlabel("Energy (GeV)")
plt.ylabel("Cos(Zenith)")
plt.colorbar()
plt.tight_layout()
if args.save:
plt.savefig("%s_nue.pdf" % root)
plt.savefig("%s_nue.eps" % root)
else:
plt.title(r"Probability to oscillate to $\nu_e$")
plt.figure()
plt.contourf(ee,zz,pnum,levels=levels)
plt.gca().set_xscale('log')
plt.xlabel("Energy (GeV)")
plt.ylabel("Cos(Zenith)")
plt.colorbar()
plt.tight_layout()
if args.save:
plt.savefig("%s_num.pdf" % root)
plt.savefig("%s_num.eps" % root)
else:
plt.title(r"Probability to oscillate to $\nu_\mu$")
plt.figure()
plt.contourf(ee,zz,pnut,levels=levels)
plt.gca().set_xscale('log')
plt.xlabel("Energy (GeV)")
plt.ylabel("Cos(Zenith)")
plt.colorbar()
plt.tight_layout()
if args.save:
plt.savefig("%s_nut.pdf" % root)
plt.savefig("%s_nut.eps" % root)
else:
plt.title(r"Probability to oscillate to $\nu_\tau$")
plt.show()
|