1- import datetime
1+ from dataclasses import dataclass
2+ from typing import List
23
3- def get_decay_lines (nuclides :list [str ])-> dict :
4- """ Creates dictionary of check source data
5- given a list of check source nuclides. """
6- # energy is the gamma energy in units of eV
7- # intensity is the percentage of decays that result in this energy gamma
8- all_decay_lines = {'Ba133' :{'energy' :[80.9979 , 276.3989 , 302.8508 , 356.0129 , 383.8485 ],
9- 'intensity' :[0.329 , 0.0716 , 0.1834 , 0.6205 , 0.0894 ],
10- 'half_life' :[10.551 * 365.25 * 24 * 3600 ],
11- 'activity_date' :datetime .date (2014 , 3 , 19 ),
12- 'activity' :1 * 3.7e4 },
13- 'Co60' :{'energy' :[1173.228 , 1332.492 ],
14- 'intensity' :[0.9985 , 0.999826 ],
15- 'half_life' :[1925.28 * 24 * 3600 ],
16- 'actvity_date' :datetime .date (2014 , 3 , 19 ),
17- 'activity' :0.872 * 3.7e4 },
18- 'Na22' :{'energy' :[511 , 1274.537 ],
19- 'intensity' :[1.80 , 0.9994 ],
20- 'half_life' :[2.6018 * 365.25 * 24 * 3600 ],
21- 'actvity_date' :datetime .date (2014 , 3 , 19 ),
22- 'activity' : 5 * 3.7e4 },
23- 'Cs137' :{'energy' :[661.657 ],
24- 'intensity' :[0.851 ],
25- 'half_life' :[30.08 * 365.25 * 24 * 3600 ],
26- 'actvity_date' :datetime .date (2014 , 3 , 19 ),
27- 'activity' :4.66 * 3.7e4 },
28- 'Mn54' :{'energy' :[834.848 ],
29- 'intensity' :[0.99976 ],
30- 'half_life' :[312.20 * 24 * 3600 ],
31- 'actvity_date' :datetime .date (2016 , 5 , 2 ),
32- 'activity' :6.27 * 3.7e4 }}
33- decay_lines = {}
34- for nuclide in nuclides :
35- if nuclide in all_decay_lines .keys ():
36- decay_lines [nuclide ] = all_decay_lines [nuclide ]
37- else :
38- raise ValueError (f'{ nuclide } not yet added to get_decay_lines()' )
39- return decay_lines
4+
5+ @dataclass
6+ class Nuclide :
7+ """
8+ Class to hold the information of a nuclide.
9+
10+ Attributes
11+ ----------
12+ name :
13+ The name of the nuclide.
14+ energy :
15+ The energy of the gamma rays emitted by the nuclide (in keV).
16+ intensity :
17+ The intensity of the gamma rays emitted by the nuclide.
18+ half_life :
19+ The half-life of the nuclide in seconds.
20+ """
21+
22+ name : str
23+ energy : List [float ]
24+ intensity : List [float ]
25+ half_life : float
26+
27+
28+ ba133 = Nuclide (
29+ name = "Ba133" ,
30+ energy = [80.9979 , 276.3989 , 302.8508 , 356.0129 , 383.8485 ],
31+ intensity = [0.329 , 0.0716 , 0.1834 , 0.6205 , 0.0894 ],
32+ half_life = 10.551 * 365.25 * 24 * 3600 ,
33+ )
34+ co60 = Nuclide (
35+ name = "Co60" ,
36+ energy = [1173.228 , 1332.492 ],
37+ intensity = [0.9985 , 0.999826 ],
38+ half_life = 1925.28 * 24 * 3600 ,
39+ )
40+ na22 = Nuclide (
41+ name = "Na22" ,
42+ energy = [511 , 1274.537 ],
43+ intensity = [1.80 , 0.9994 ],
44+ half_life = 2.6018 * 365.25 * 24 * 3600 ,
45+ )
46+ cs137 = Nuclide (
47+ name = "Cs137" ,
48+ energy = [661.657 ],
49+ intensity = [0.851 ],
50+ half_life = 30.08 * 365.25 * 24 * 3600 ,
51+ )
52+ mn54 = Nuclide (
53+ name = "Mn54" ,
54+ energy = [834.848 ],
55+ intensity = [0.99976 ],
56+ half_life = 312.20 * 24 * 3600 ,
57+ )
0 commit comments