-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsome_plot.py
48 lines (45 loc) · 1.45 KB
/
some_plot.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
# -*- coding: utf-8 -*-
__author__ = 'GRIDDIC'
import obr
import matplotlib.pyplot as plt
def main():
tallies = obr.construct_tallies("PN10a")
fig, ax = plt.subplots()
x = []
y = []
dy = []
for tally in tallies:
if tally.x == 0 and tally.y == 0 and tally.z < 100:
x.append(tally.z)
y_, dy_ = tally.get_value_from_diaposon(2.5)
y.append(y_)
dy.append(dy_ * y_)
pb = ax.bar(x, y, yerr=dy, align='center', alpha=0.4, width=3, color="blue")
x = []
y = []
dy = []
for tally in tallies:
if tally.x == 0 and tally.y == 0 and tally.z < 100:
x.append(tally.z)
y_, dy_ = tally.get_value_from_diaposon(5)
y.append(y_)
dy.append(dy_ * y_)
pr = ax.bar(x, y, yerr=dy, align='center', alpha=0.4, width=3, color="red")
x = []
y = []
dy = []
for tally in tallies:
if tally.x == 0 and tally.y == 0 and tally.z < 100:
x.append(tally.z)
y_, dy_ = tally.get_value_from_diaposon(7.5)
y.append(y_)
dy.append(dy_ * y_)
pg = ax.bar(x, y, yerr=dy, align='center', alpha=0.4, width=3, color="green")
ax.legend( (pb, pr, pg), (' > 2.5 MeV', ' > 5 MeV', ' > 7.5 MeV') )
#ax.set_ylabel('Particles fraction')
ax.set_ylabel(u'Доля частиц')
ax.set_title('Going back particles')
#plt.yscale('log')
plt.show()
if __name__ == "__main__":
main()