TDCRPy 1.2.0__py3-none-any.whl → 1.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of TDCRPy might be problematic. Click here for more details.
- {TDCRPy-1.2.0.dist-info → TDCRPy-1.4.0.dist-info}/METADATA +2 -1
- {TDCRPy-1.2.0.dist-info → TDCRPy-1.4.0.dist-info}/RECORD +8 -7
- tdcrpy/TDCRPy.py +221 -89
- tdcrpy/TDCRPy1.py +946 -0
- tdcrpy/TDCR_model_lib.py +71 -31
- {TDCRPy-1.2.0.dist-info → TDCRPy-1.4.0.dist-info}/LICENCE.md +0 -0
- {TDCRPy-1.2.0.dist-info → TDCRPy-1.4.0.dist-info}/WHEEL +0 -0
- {TDCRPy-1.2.0.dist-info → TDCRPy-1.4.0.dist-info}/top_level.txt +0 -0
tdcrpy/TDCR_model_lib.py
CHANGED
|
@@ -13,6 +13,7 @@ Bureau International des Poids et Mesures
|
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
15
|
import importlib.resources
|
|
16
|
+
from importlib.resources import files
|
|
16
17
|
import pkg_resources
|
|
17
18
|
import configparser
|
|
18
19
|
import numpy as np
|
|
@@ -21,14 +22,16 @@ import time
|
|
|
21
22
|
import re
|
|
22
23
|
import os
|
|
23
24
|
import scipy.interpolate as interp
|
|
25
|
+
import matplotlib.pyplot as plt
|
|
24
26
|
|
|
25
27
|
"""
|
|
26
28
|
======= Import ressource data =======
|
|
27
29
|
"""
|
|
28
30
|
|
|
29
31
|
# import advanced configuration data
|
|
32
|
+
|
|
30
33
|
config = configparser.ConfigParser()
|
|
31
|
-
with importlib.resources.
|
|
34
|
+
with importlib.resources.as_file(files('tdcrpy').joinpath('config.toml')) as data_path:
|
|
32
35
|
file_conf = data_path
|
|
33
36
|
config.read(file_conf)
|
|
34
37
|
RHO = config["Inputs"].getfloat("density")
|
|
@@ -38,22 +41,26 @@ depthSpline = config["Inputs"].getint("depthSpline")
|
|
|
38
41
|
Einterp = config["Inputs"].getfloat("Einterp")
|
|
39
42
|
|
|
40
43
|
# import PenNuc data
|
|
41
|
-
with importlib.resources.
|
|
44
|
+
with importlib.resources.as_file(files('tdcrpy').joinpath('decayData')) as data_path:
|
|
45
|
+
#with importlib.resources.path('tdcrpy', 'decayData') as data_path:
|
|
42
46
|
file_pennuc = data_path / "All-nuclides_PenNuc.zip"
|
|
43
47
|
z_PenNuc = zf.ZipFile(file_pennuc)
|
|
44
48
|
|
|
45
49
|
# import BetaShape data
|
|
46
|
-
with importlib.resources.
|
|
50
|
+
with importlib.resources.as_file(files('tdcrpy').joinpath('decayData')) as data_path:
|
|
51
|
+
#with importlib.resources.path('tdcrpy', 'decayData') as data_path:
|
|
47
52
|
file_betashape = data_path / "All-nuclides_BetaShape.zip"
|
|
48
53
|
z_betashape = zf.ZipFile(file_betashape)
|
|
49
54
|
|
|
50
55
|
# import ENSDF data
|
|
51
|
-
with importlib.resources.
|
|
56
|
+
with importlib.resources.as_file(files('tdcrpy').joinpath('decayData')) as data_path:
|
|
57
|
+
#with importlib.resources.path('tdcrpy', 'decayData') as data_path:
|
|
52
58
|
file_ensdf = data_path / 'All-nuclides_Ensdf.zip'
|
|
53
59
|
z_ensdf = zf.ZipFile(file_ensdf)
|
|
54
60
|
|
|
55
61
|
# import photon interaction data (MCNP6 calculation)
|
|
56
|
-
with importlib.resources.
|
|
62
|
+
with importlib.resources.as_file(files('tdcrpy').joinpath('MCNP-MATRIX')) as data_path:
|
|
63
|
+
#with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
|
|
57
64
|
fp1 = data_path / 'matrice/fichier/matrice_10ml-photon_1_200k.txt' #gamma-10ml-1-200keV-niveau 0
|
|
58
65
|
fp2 = data_path / 'matrice/fichier/matrice_10ml-photon_200_2000k.txt' #gamma-10ml-200-2000keV-niveau 1
|
|
59
66
|
fp3 = data_path / 'matrice/fichier/matrice_10ml-photon_2000_10000k.txt' #gamma-10ml-2000-10000keV-niveau 2
|
|
@@ -63,7 +70,8 @@ with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
|
|
|
63
70
|
fe = data_path / 'matrice/fichier/E_depose.txt'
|
|
64
71
|
|
|
65
72
|
# import electron interaction data (MCNP6 calculation)
|
|
66
|
-
with importlib.resources.
|
|
73
|
+
with importlib.resources.as_file(files('tdcrpy').joinpath('MCNP-MATRIX')) as data_path:
|
|
74
|
+
#with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
|
|
67
75
|
fe1 = data_path / 'matrice/fichier/matrice_10ml-beta-_1_200k.txt' # electron-10ml-1-200keV-niveau 0
|
|
68
76
|
fe2 = data_path / 'matrice/fichier/matrice_10ml-beta-_200_2000k.txt' # electron-10ml-200-2000keV-niveau 1
|
|
69
77
|
fe3 = data_path / 'matrice/fichier/matrice_10ml-beta-_2000_10000k.txt' # electron-10ml-2000-10000keV-niveau 2
|
|
@@ -72,7 +80,8 @@ with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
|
|
|
72
80
|
fe = data_path / 'matrice/fichier/E_depose.txt' # electron-10ml-énergie-niveau 'e'
|
|
73
81
|
|
|
74
82
|
# import beta spectra calculated for the analytical model (BetaShape + MCNP6 calculation)
|
|
75
|
-
with importlib.resources.
|
|
83
|
+
with importlib.resources.as_file(files('tdcrpy').joinpath('MCNP-MATRIX')) as data_path:
|
|
84
|
+
#with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
|
|
76
85
|
sH3 = data_path / 'Spectra_for_analytical_model/dep_spectrum_H-3.txt'
|
|
77
86
|
sC14 = data_path / 'Spectra_for_analytical_model/dep_spectrum_C-14.txt'
|
|
78
87
|
sS35 = data_path / 'Spectra_for_analytical_model/dep_spectrum_S-35.txt'
|
|
@@ -85,7 +94,8 @@ with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
|
|
|
85
94
|
sPu241 = data_path / 'Spectra_for_analytical_model/dep_spectrum_Pu-241.txt'
|
|
86
95
|
|
|
87
96
|
# import stopping power data for electron
|
|
88
|
-
with importlib.resources.
|
|
97
|
+
with importlib.resources.as_file(files('tdcrpy').joinpath('Quenching')) as data_path:
|
|
98
|
+
#with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
|
|
89
99
|
file_TanXia = open(data_path / "TandataUG.txt")
|
|
90
100
|
|
|
91
101
|
data_TanXia=file_TanXia.read(); file_TanXia.close()
|
|
@@ -94,9 +104,10 @@ for i, x in enumerate(data_TanXia):
|
|
|
94
104
|
if i<len(data_TanXia)-1: data_TanXia_f[i]=float(x)
|
|
95
105
|
|
|
96
106
|
# import stopping power data for electron for alpha particle (ASTAR data)
|
|
97
|
-
with importlib.resources.
|
|
107
|
+
with importlib.resources.as_file(files('tdcrpy').joinpath('Quenching')) as data_path:
|
|
108
|
+
#with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
|
|
98
109
|
f_alpha = open(data_path / "alpha_toulene.txt")
|
|
99
|
-
|
|
110
|
+
|
|
100
111
|
data_ASTAR = f_alpha.readlines()
|
|
101
112
|
f_alpha.close()
|
|
102
113
|
energy_alph = []
|
|
@@ -110,7 +121,8 @@ for i in range(np.size(data_ASTAR)):
|
|
|
110
121
|
|
|
111
122
|
# import pre-calculated quenched energy tables
|
|
112
123
|
kB_a = [6e-6, 7e-6, 8e-6, 9e-6, 1e-5, 1.1e-5, 1.2e-5, 1.3e-5, 1.4e-5, 1.5e-5] # cm/MeV
|
|
113
|
-
with importlib.resources.
|
|
124
|
+
with importlib.resources.as_file(files('tdcrpy').joinpath('Quenching')) as data_path:
|
|
125
|
+
#with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
|
|
114
126
|
Ei_alpha_fid = open(data_path / "inputVecteurAlpha.txt")
|
|
115
127
|
Ei_alpha = Ei_alpha_fid.readlines()
|
|
116
128
|
Ei_alpha = Ei_alpha[0].split(" ")
|
|
@@ -118,7 +130,8 @@ Ei_alpha = [float(x) for x in Ei_alpha[:-1]]
|
|
|
118
130
|
|
|
119
131
|
Em_alpha = []
|
|
120
132
|
for ikB in kB_a:
|
|
121
|
-
with importlib.resources.
|
|
133
|
+
with importlib.resources.as_file(files('tdcrpy').joinpath('Quenching')) as data_path:
|
|
134
|
+
#with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
|
|
122
135
|
tamptxt = "QuenchEnergyAlpha_"+str(ikB)+".txt"
|
|
123
136
|
fid = open(data_path / tamptxt)
|
|
124
137
|
line = fid.readlines()
|
|
@@ -127,7 +140,8 @@ for ikB in kB_a:
|
|
|
127
140
|
Em_alpha.append(line)
|
|
128
141
|
|
|
129
142
|
kB_e = [0.006, 0.007, 0.008, 0.009, 0.010, 0.011, 0.012, 0.013, 0.014, 0.015] # cm/MeV
|
|
130
|
-
with importlib.resources.
|
|
143
|
+
with importlib.resources.as_file(files('tdcrpy').joinpath('Quenching')) as data_path:
|
|
144
|
+
#with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
|
|
131
145
|
Ei_electron_fid = open(data_path / "inputVecteurElectron.txt")
|
|
132
146
|
Ei_electron = Ei_electron_fid.readlines()
|
|
133
147
|
Ei_electron = Ei_electron[0].split(" ")
|
|
@@ -135,7 +149,8 @@ Ei_electron = [float(x) for x in Ei_electron[:-1]]
|
|
|
135
149
|
|
|
136
150
|
Em_electron = []
|
|
137
151
|
for ikB in kB_e:
|
|
138
|
-
with importlib.resources.
|
|
152
|
+
with importlib.resources.as_file(files('tdcrpy').joinpath('Quenching')) as data_path:
|
|
153
|
+
#with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
|
|
139
154
|
tamptxt = "QuenchEnergyElectron_"+str(ikB)+".txt"
|
|
140
155
|
fid = open(data_path / tamptxt)
|
|
141
156
|
line = fid.readlines()
|
|
@@ -143,6 +158,7 @@ for ikB in kB_e:
|
|
|
143
158
|
line = [float(x) for x in line[:-1]]
|
|
144
159
|
Em_electron.append(line)
|
|
145
160
|
|
|
161
|
+
|
|
146
162
|
"""
|
|
147
163
|
======= Library of functions =======
|
|
148
164
|
"""
|
|
@@ -231,18 +247,18 @@ def readPenNuc2(rad,z1=z_PenNuc):
|
|
|
231
247
|
list of energy associated with transitions -- indice 9. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
|
|
232
248
|
tran_prob_tot : list[list]
|
|
233
249
|
list of probability associated with transitions -- indice 10. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
|
|
234
|
-
uncertainty_tot : list[list]
|
|
235
|
-
list of uncertainty of probability associated with transitions -- indice 11. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
|
|
236
250
|
tran_level_tot : list[list]
|
|
237
|
-
list of corresponding branch levels -- indice
|
|
251
|
+
list of corresponding branch levels -- indice 11. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to the level before the transition.
|
|
238
252
|
tran_level_end_tot : list[list]
|
|
239
|
-
list of level following given transitions -- indice
|
|
253
|
+
list of level following given transitions -- indice 12. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to the level after the transition.
|
|
240
254
|
level_energy_tot : list[list]
|
|
241
|
-
list of energy levels -- indice
|
|
255
|
+
list of energy levels -- indice 13. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
|
|
242
256
|
prob_tran_tot : list[list]
|
|
243
|
-
list of sum of transition of each branches -- indice
|
|
257
|
+
list of sum of transition of each branches -- indice 14. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
|
|
244
258
|
half_life : list
|
|
245
|
-
list of half_life of meta state -- indice
|
|
259
|
+
list of half_life of meta state -- indice 15.
|
|
260
|
+
uncertainty_tot : list[list]
|
|
261
|
+
list of uncertainty of probability associated with transitions -- indice 16. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
|
|
246
262
|
'''
|
|
247
263
|
doc = rad + ".PenNuc.txt"
|
|
248
264
|
with z1.open(doc) as file_P:
|
|
@@ -365,11 +381,6 @@ def readPenNuc2(rad,z1=z_PenNuc):
|
|
|
365
381
|
uncertainty = []
|
|
366
382
|
half_life = []
|
|
367
383
|
|
|
368
|
-
meta = False
|
|
369
|
-
meta_rad = ['Mn-52m','Y-90m','Nb-93m','Nb-95m','Tc-99m','Ag-108m','Ag-110m','Te-123m','Te-127m','Xe-131m','Xe-133m','Xe-135m','Ba-137m','Pr-144m','Pm-148m','Pa-234m','Am-242m']
|
|
370
|
-
if rad in meta_rad:
|
|
371
|
-
meta = True
|
|
372
|
-
meta = True
|
|
373
384
|
|
|
374
385
|
for i3 in range(len(posi_end_i)-1):
|
|
375
386
|
start_p1 = posi_end_i[i3]
|
|
@@ -429,10 +440,8 @@ def readPenNuc2(rad,z1=z_PenNuc):
|
|
|
429
440
|
if "LED" == i4[0]:
|
|
430
441
|
tran_level_b.append(int(i4[-1]))
|
|
431
442
|
level_energy_b.append(float(i4[1]))
|
|
432
|
-
|
|
433
|
-
half_life_b.append(float(i4[4]))
|
|
443
|
+
half_life_b.append(float(i4[4]))
|
|
434
444
|
if i4[0] == "GA" or i4[0] == "EK" or i4[0] == "EL" or i4[0] == "EL1" or i4[0] == "EL2" or i4[0] == "EL3" or i4[0] == "EM" or i4[0] == "EN":
|
|
435
|
-
#print(i4)
|
|
436
445
|
tran_type_b.append(i4[0])
|
|
437
446
|
tran_prob_b.append(float(i4[1]))
|
|
438
447
|
uncertainty_b.append(float(i4[2]))
|
|
@@ -474,11 +483,13 @@ def readPenNuc2(rad,z1=z_PenNuc):
|
|
|
474
483
|
|
|
475
484
|
tran_type_daug.append([])
|
|
476
485
|
tran_prob_daug.append([])
|
|
486
|
+
uncertainty.append([])
|
|
477
487
|
tran_energy_daug.append([])
|
|
478
488
|
tran_level_end_daug.append([])
|
|
479
489
|
tran_level_daug.append([])
|
|
480
490
|
level_energy_daug.append([])
|
|
481
491
|
prob_tran_daug.append(0)
|
|
492
|
+
half_life.append([])
|
|
482
493
|
|
|
483
494
|
desin_type_tot.append(desin_type_daug)
|
|
484
495
|
desin_energy_tot.append(desin_energy_daug)
|
|
@@ -501,7 +512,6 @@ def readPenNuc2(rad,z1=z_PenNuc):
|
|
|
501
512
|
|
|
502
513
|
|
|
503
514
|
|
|
504
|
-
|
|
505
515
|
#================================== StoppingPower for alpha particle ===========================================
|
|
506
516
|
|
|
507
517
|
def stoppingpowerA(e,rho=RHO,energy_alpha=energy_alph,dEdx_alpha=dEdx_alph):
|
|
@@ -1637,6 +1647,36 @@ distribution: https://pypi.org/project/TDCRPy \n\
|
|
|
1637
1647
|
developement: https://github.com/RomainCoulon/TDCRPy \n\n\
|
|
1638
1648
|
start calculation..."
|
|
1639
1649
|
|
|
1640
|
-
|
|
1650
|
+
# Start Calculation
|
|
1641
1651
|
print(header_text)
|
|
1642
1652
|
print(header_text2)
|
|
1653
|
+
|
|
1654
|
+
def display_distrib(S, D, T):
|
|
1655
|
+
n=len(D)
|
|
1656
|
+
x = np.arange(0,1.1,0.01)
|
|
1657
|
+
D=np.asarray(D)
|
|
1658
|
+
T=np.asarray(T)
|
|
1659
|
+
meanD=np.mean(D)
|
|
1660
|
+
meanT=np.mean(T)
|
|
1661
|
+
# tdcr=T/D
|
|
1662
|
+
plt.figure("efficiency distribution")
|
|
1663
|
+
plt.clf()
|
|
1664
|
+
plt.hist(np.asarray(D),bins=x,label="Double coincidences")[0]
|
|
1665
|
+
plt.hist(np.asarray(T),bins=x,label="Triple coincidences")[0]
|
|
1666
|
+
plt.scatter(meanD,n,marker='o',s=200,color='orange',label="mean value for Double coincidences")
|
|
1667
|
+
plt.scatter(meanT,n,marker='o',s=200,color='blue',label="mean value for Triple coincidences")
|
|
1668
|
+
plt.yscale("log")
|
|
1669
|
+
plt.xlabel("Efficiency", fontsize = 14)
|
|
1670
|
+
plt.ylabel(r"Number of counts", fontsize = 14)
|
|
1671
|
+
plt.legend(fontsize = 12)
|
|
1672
|
+
plt.show()
|
|
1673
|
+
# plt.savefig('Effdistribution.png')
|
|
1674
|
+
|
|
1675
|
+
# plt.figure("TDCR distribution")
|
|
1676
|
+
# plt.clf()
|
|
1677
|
+
# plt.hist(np.asarray(tdcr),bins=x,label="calculated TDCR")[0]
|
|
1678
|
+
# # plt.plot(x,st.norm.pdf(x, TDCR_measure, u_TDCR_measure),label="measured TDCR")[0]
|
|
1679
|
+
# plt.xlabel("Efficiency", fontsize = 14)
|
|
1680
|
+
# plt.ylabel(r"Number of counts", fontsize = 14)
|
|
1681
|
+
# plt.legend(fontsize = 12)
|
|
1682
|
+
# # plt.savefig('TDCRdistribution.png')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|