-
Notifications
You must be signed in to change notification settings - Fork 2
/
isotopeDecay.py
99 lines (60 loc) · 2.07 KB
/
isotopeDecay.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
from constantAndConversion import yearToSec, MeVToJoule, keVToJoule
class isotope():
def __init__(self, stable, name):
self.name = name
if stable:
self.halfLife = float('inf')
else:
self.halfLife = 0.0
self.decayProducts = []
self.decayEnergies_J = []
self.decayProbabilities = []
self.radiationType = []
def getBa137():
Ba137_stable = True
Ba137 = isotope(stable=Ba137_stable, name='Ba137')
return Ba137
def getBa137m():
Ba137m_stable = False
Ba137m = isotope(stable=Ba137m_stable, name='Ba137m')
Ba137m.halfLife = float(153)
decayProb1 = 0.9007
decayEnergy1_MeV = 0.661659
decayEnergy1_J = MeVToJoule * decayEnergy1_MeV
radiationType1 = 'gamma'
productName1 = 'Ba137'
decayProb1 = 0.0206
decayEnergy1_MeV = 31.8174
decayEnergy1_J = keVToJoule * decayEnergy1_MeV
radiationType1 = 'xRay'
productName1 = 'Ba137'
setattr(Ba137m, productName1, getBa137())
return Ba137m
def getCs137():
Cs137_stable = False
Cs137 = isotope(stable=Cs137_stable, name='Cs137')
Cs137_halfLife_yr = float(30.17)
Cs137.halfLife = Cs137_halfLife_yr * yearToSec
decayProb1 = 0.946
decayEnergy1_MeV = 0.5120
decayEnergy1_J = MeVToJoule * decayEnergy1_MeV
radiationType1 = '-Beta'
productName1 = 'Ba137m'
setattr(Cs137, productName1, getBa137m())
decayProb2 = 0.054
decayEnergy2_MeV = 1.174
decayEnergy2_J = MeVToJoule * decayEnergy2_MeV
radiationType2 = '-Beta'
productName2 = 'Ba137'
setattr(Cs137, productName2, getBa137())
Cs137.decayProducts.append(decayProb1)
Cs137.decayProducts.append(decayProb2)
Cs137.decayEnergies_J.append(decayEnergy1_J)
Cs137.decayEnergies_J.append(decayEnergy2_J)
Cs137.decayProbabilities.append(productName1)
Cs137.decayProbabilities.append(productName2)
Cs137.radiationType.append(radiationType1)
Cs137.radiationType.append(radiationType2)
return Cs137
if __name__ == "__main__":
print Cs137.halflife_yr