TDCRPy 1.9.2__py3-none-any.whl → 1.9.4__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.9.2.dist-info → TDCRPy-1.9.4.dist-info}/METADATA +1 -1
- {TDCRPy-1.9.2.dist-info → TDCRPy-1.9.4.dist-info}/RECORD +18 -18
- tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_C-14.txt +311 -999
- tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Ca-45.txt +325 -1000
- tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_H-3.txt +309 -1000
- tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Ni-63.txt +334 -1000
- tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Pm-147.txt +320 -1000
- tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Pu-241.txt +346 -1000
- tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_S-35.txt +333 -999
- tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Sr-89.txt +300 -1000
- tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Sr-90.txt +545 -1000
- tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Tc-99.txt +295 -1000
- tdcrpy/TDCRPy.py +6 -0
- tdcrpy/TDCR_model_lib.py +197 -3
- tdcrpy/decayData/All-nuclides_BetaShape.zip +0 -0
- {TDCRPy-1.9.2.dist-info → TDCRPy-1.9.4.dist-info}/LICENCE.md +0 -0
- {TDCRPy-1.9.2.dist-info → TDCRPy-1.9.4.dist-info}/WHEEL +0 -0
- {TDCRPy-1.9.2.dist-info → TDCRPy-1.9.4.dist-info}/top_level.txt +0 -0
tdcrpy/TDCRPy.py
CHANGED
|
@@ -180,6 +180,12 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
180
180
|
return out[0], 0, out[1], 0, out[2], 0
|
|
181
181
|
elif (not Smodel) and (not Rad in radListPureBeta):
|
|
182
182
|
print("cannot be processed by the analytical model.")
|
|
183
|
+
# print(f"Analytical model used for {Rad}")
|
|
184
|
+
out=tl.modelAnalytical(L,TD,TAB,TBC,TAC,Rad,kB,V,mode,mode2,10000)
|
|
185
|
+
if mode == "res":
|
|
186
|
+
return out
|
|
187
|
+
if mode == "eff":
|
|
188
|
+
return out[0], 0, out[1], 0, out[2], 0
|
|
183
189
|
else:
|
|
184
190
|
nE_electron = config["Inputs"].getint("nE_electron")
|
|
185
191
|
nE_alpha = config["Inputs"].getint("nE_alpha")
|
tdcrpy/TDCR_model_lib.py
CHANGED
|
@@ -23,6 +23,7 @@ import re
|
|
|
23
23
|
import os
|
|
24
24
|
import scipy.interpolate as interp
|
|
25
25
|
import matplotlib.pyplot as plt
|
|
26
|
+
import toml
|
|
26
27
|
|
|
27
28
|
"""
|
|
28
29
|
======= Import ressource data =======
|
|
@@ -34,6 +35,10 @@ config = configparser.ConfigParser()
|
|
|
34
35
|
with importlib.resources.as_file(files('tdcrpy').joinpath('config.toml')) as data_path:
|
|
35
36
|
file_conf = data_path
|
|
36
37
|
config.read(file_conf)
|
|
38
|
+
|
|
39
|
+
nE_electron = config["Inputs"].getint("nE_electron")
|
|
40
|
+
nE_alpha = config["Inputs"].getint("nE_alpha")
|
|
41
|
+
tau = config["Inputs"].getint("tau")
|
|
37
42
|
RHO = config["Inputs"].getfloat("density")
|
|
38
43
|
Z = config["Inputs"].getfloat("Z")
|
|
39
44
|
A = config["Inputs"].getfloat("A")
|
|
@@ -43,6 +48,96 @@ Einterp_e = config["Inputs"].getfloat("Einterp_e")
|
|
|
43
48
|
diam_micelle = config["Inputs"].getfloat("diam_micelle")
|
|
44
49
|
fAq = config["Inputs"].getfloat("fAq")
|
|
45
50
|
|
|
51
|
+
def readParameters():
|
|
52
|
+
print(f"number of integration bins for electrons = {nE_electron}")
|
|
53
|
+
print(f"number of integration bins for alpha = {nE_alpha}")
|
|
54
|
+
print(f"density = {RHO} g/cm3")
|
|
55
|
+
print(f"Z = {Z}")
|
|
56
|
+
print(f"A = {A}")
|
|
57
|
+
print(f"depth of spline interp. = {depthSpline}")
|
|
58
|
+
print(f"energy above which interp. in implemented (for alpha) = {Einterp_a} keV")
|
|
59
|
+
print(f"energy above which interp. in implemented (for electron) = {Einterp_e} keV")
|
|
60
|
+
print(f"diameter of micelle = {diam_micelle} nm")
|
|
61
|
+
print(f"acqueous fraction = {fAq}")
|
|
62
|
+
return nE_electron, nE_alpha, RHO, Z, A, depthSpline, Einterp_a, Einterp_e, diam_micelle, fAq, tau
|
|
63
|
+
|
|
64
|
+
def readConfigAsstr():
|
|
65
|
+
path2config = str(config.read(file_conf)[0])
|
|
66
|
+
with open(path2config, 'r') as file:
|
|
67
|
+
data0 = file.read()
|
|
68
|
+
return data0
|
|
69
|
+
|
|
70
|
+
def writeConfifAsstr(data):
|
|
71
|
+
path2config = str(config.read(file_conf)[0])
|
|
72
|
+
with open(path2config, 'w') as file:
|
|
73
|
+
file.write(data)
|
|
74
|
+
|
|
75
|
+
def modifynE_electron(x):
|
|
76
|
+
data0 = readConfigAsstr()
|
|
77
|
+
x0 = readParameters()[0]
|
|
78
|
+
data1 = data0.replace(f"nE_electron = {x0}",f"nE_electron = {x}")
|
|
79
|
+
writeConfifAsstr(data1)
|
|
80
|
+
|
|
81
|
+
def modifynE_alpha(x):
|
|
82
|
+
data0 = readConfigAsstr()
|
|
83
|
+
x0 = readParameters()[1]
|
|
84
|
+
data1 = data0.replace(f"nE_alpha = {x0}",f"nE_alpha = {x}")
|
|
85
|
+
writeConfifAsstr(data1)
|
|
86
|
+
|
|
87
|
+
def modifyDensity(x):
|
|
88
|
+
data0 = readConfigAsstr()
|
|
89
|
+
x0 = readParameters()[2]
|
|
90
|
+
data1 = data0.replace(f"density = {x0}",f"density = {x}")
|
|
91
|
+
writeConfifAsstr(data1)
|
|
92
|
+
|
|
93
|
+
def modifyZ(x):
|
|
94
|
+
data0 = readConfigAsstr()
|
|
95
|
+
x0 = readParameters()[3]
|
|
96
|
+
data1 = data0.replace(f"Z = {x0}",f"Z = {x}")
|
|
97
|
+
writeConfifAsstr(data1)
|
|
98
|
+
|
|
99
|
+
def modifyA(x):
|
|
100
|
+
data0 = readConfigAsstr()
|
|
101
|
+
x0 = readParameters()[4]
|
|
102
|
+
data1 = data0.replace(f"A = {x0}",f"A = {x}")
|
|
103
|
+
writeConfifAsstr(data1)
|
|
104
|
+
|
|
105
|
+
def modifyDepthSpline(x):
|
|
106
|
+
data0 = readConfigAsstr()
|
|
107
|
+
x0 = readParameters()[5]
|
|
108
|
+
data1 = data0.replace(f"depthSpline = {x0}",f"depthSpline = {x}")
|
|
109
|
+
writeConfifAsstr(data1)
|
|
110
|
+
|
|
111
|
+
def modifyEinterp_a(x):
|
|
112
|
+
data0 = readConfigAsstr()
|
|
113
|
+
x0 = readParameters()[6]
|
|
114
|
+
data1 = data0.replace(f"Einterp_a = {int(x0)}",f"Einterp_a = {int(x)}")
|
|
115
|
+
writeConfifAsstr(data1)
|
|
116
|
+
|
|
117
|
+
def modifyEinterp_e(x):
|
|
118
|
+
data0 = readConfigAsstr()
|
|
119
|
+
x0 = readParameters()[7]
|
|
120
|
+
data1 = data0.replace(f"Einterp_e = {x0}",f"Einterp_e = {x}")
|
|
121
|
+
writeConfifAsstr(data1)
|
|
122
|
+
|
|
123
|
+
def modifyDiam_micelle(x):
|
|
124
|
+
data0 = readConfigAsstr()
|
|
125
|
+
x0 = readParameters()[8]
|
|
126
|
+
data1 = data0.replace(f"diam_micelle = {int(x0)}",f"diam_micelle = {int(x)}")
|
|
127
|
+
writeConfifAsstr(data1)
|
|
128
|
+
|
|
129
|
+
def modifyfAq(x):
|
|
130
|
+
data0 = readConfigAsstr()
|
|
131
|
+
x0 = readParameters()[9]
|
|
132
|
+
data1 = data0.replace(f"fAq = {x0}",f"fAq = {x}")
|
|
133
|
+
writeConfifAsstr(data1)
|
|
134
|
+
|
|
135
|
+
def modifyTau(x):
|
|
136
|
+
data0 = readConfigAsstr()
|
|
137
|
+
x0 = readParameters()[10]
|
|
138
|
+
data1 = data0.replace(f"tau = {x0}",f"tau = {x}")
|
|
139
|
+
writeConfifAsstr(data1)
|
|
140
|
+
|
|
46
141
|
# import PenNuc data
|
|
47
142
|
with importlib.resources.as_file(files('tdcrpy').joinpath('decayData')) as data_path:
|
|
48
143
|
#with importlib.resources.path('tdcrpy', 'decayData') as data_path:
|
|
@@ -732,6 +827,48 @@ def readBetaShape(rad,mode,level,z=z_betashape):
|
|
|
732
827
|
p = list(p); e = list(e)
|
|
733
828
|
return e, p
|
|
734
829
|
|
|
830
|
+
def readBetaShapeInfo(rad,mode,level,z=z_betashape):
|
|
831
|
+
"""
|
|
832
|
+
Read information about how the spectrum was built
|
|
833
|
+
|
|
834
|
+
Parameters
|
|
835
|
+
----------
|
|
836
|
+
rad : TYPE
|
|
837
|
+
DESCRIPTION.
|
|
838
|
+
|
|
839
|
+
Returns
|
|
840
|
+
-------
|
|
841
|
+
None.
|
|
842
|
+
|
|
843
|
+
"""
|
|
844
|
+
Rad = rad.replace('-','')
|
|
845
|
+
if level == 'tot':
|
|
846
|
+
name_doc = Rad+'/'+mode+'_'+Rad+'_tot.bs'
|
|
847
|
+
else:
|
|
848
|
+
name_doc = Rad+'/'+mode+'_'+Rad+'_'+ "trans" + str(level) +'.bs'
|
|
849
|
+
with z.open(name_doc) as file_trans:
|
|
850
|
+
data = file_trans.readlines()
|
|
851
|
+
|
|
852
|
+
for i in range(np.size(data)):
|
|
853
|
+
data[i] = str(data[i])
|
|
854
|
+
data[i] = data[i].replace("b'",'')
|
|
855
|
+
data[i] = data[i].replace("\\r\\n",'')
|
|
856
|
+
data[i] = data[i].replace("'",'')
|
|
857
|
+
for i in range(np.size(data)):
|
|
858
|
+
data[i] = data[i].split()
|
|
859
|
+
|
|
860
|
+
while [] in data:
|
|
861
|
+
data.remove([])
|
|
862
|
+
out = ""
|
|
863
|
+
for i in range(len(data)):
|
|
864
|
+
if "Total" in data[i][0] : break
|
|
865
|
+
out += str(np.ravel(data[i]))
|
|
866
|
+
out = out.replace('--','')
|
|
867
|
+
out = out.replace('[','')
|
|
868
|
+
out = out.replace(']','')
|
|
869
|
+
out = out.replace('\'','')
|
|
870
|
+
return out
|
|
871
|
+
|
|
735
872
|
|
|
736
873
|
def readBetaSpectra(rad):
|
|
737
874
|
"""
|
|
@@ -2379,8 +2516,8 @@ def modelAnalytical(L,TD,TAB,TBC,TAC,rad,kB,V,mode,mode2,ne):
|
|
|
2379
2516
|
|
|
2380
2517
|
"""
|
|
2381
2518
|
|
|
2382
|
-
e, p = readBetaShape(rad, 'beta-', 'tot')
|
|
2383
|
-
|
|
2519
|
+
# e, p = readBetaShape(rad, 'beta-', 'tot')
|
|
2520
|
+
e, p = readBetaSpectra(rad)
|
|
2384
2521
|
em=np.empty(len(e))
|
|
2385
2522
|
for i, ei in enumerate(e):
|
|
2386
2523
|
# ed = energie_dep_beta2(ei,V)
|
|
@@ -2479,4 +2616,61 @@ def display_distrib(S, D, T):
|
|
|
2479
2616
|
# plt.xlabel("Efficiency", fontsize = 14)
|
|
2480
2617
|
# plt.ylabel(r"Number of counts", fontsize = 14)
|
|
2481
2618
|
# plt.legend(fontsize = 12)
|
|
2482
|
-
# # plt.savefig('TDCRdistribution.png')
|
|
2619
|
+
# # plt.savefig('TDCRdistribution.png')
|
|
2620
|
+
|
|
2621
|
+
def buildBetaSpectra(rad, V, N, prt=False):
|
|
2622
|
+
"""
|
|
2623
|
+
Build beta spectra to be used in the analitical model
|
|
2624
|
+
|
|
2625
|
+
Returns
|
|
2626
|
+
-------
|
|
2627
|
+
None.
|
|
2628
|
+
|
|
2629
|
+
"""
|
|
2630
|
+
e, p = readBetaShape(rad,"beta-",'tot')
|
|
2631
|
+
N = int(N)
|
|
2632
|
+
ev=[]
|
|
2633
|
+
for i in range(N):
|
|
2634
|
+
ind = sampling(p)
|
|
2635
|
+
ev.append(energie_dep_beta2(e[ind],V))
|
|
2636
|
+
counts, bins = np.histogram(ev, bins=e, density=True)
|
|
2637
|
+
p2=counts/sum(counts)
|
|
2638
|
+
|
|
2639
|
+
bin_centers = (bins[:-1] + bins[1:]) / 2
|
|
2640
|
+
plt.figure(rad)
|
|
2641
|
+
plt.clf()
|
|
2642
|
+
plt.bar(bin_centers, p2, width=(bins[1] - bins[0]), color='g', alpha=0.6, label="deposited")
|
|
2643
|
+
plt.plot(e, p,'-r', alpha=0.6, label="betaShape")
|
|
2644
|
+
plt.legend()
|
|
2645
|
+
plt.xlabel("$E$ /keV")
|
|
2646
|
+
plt.ylabel(r"$p$ /keV$^{-1}$")
|
|
2647
|
+
|
|
2648
|
+
if rad == "H-3": file_path = sH3
|
|
2649
|
+
elif rad == "C-14": file_path = sC14
|
|
2650
|
+
elif rad == "S-35": file_path = sS35
|
|
2651
|
+
elif rad == "Ca-45": file_path = sCa45
|
|
2652
|
+
elif rad == "Ni-63": file_path = sNi63
|
|
2653
|
+
elif rad == "Sr-89": file_path = sSr89
|
|
2654
|
+
elif rad == "Sr-90": file_path = sSr90
|
|
2655
|
+
elif rad == "Tc-99": file_path = sTc99
|
|
2656
|
+
elif rad == "Pm-147": file_path = sPm147
|
|
2657
|
+
elif rad == "Pu-241": file_path = sPu241
|
|
2658
|
+
|
|
2659
|
+
if prt:
|
|
2660
|
+
with open(file_path, "w") as file:
|
|
2661
|
+
for i, b in enumerate(bin_centers):
|
|
2662
|
+
file.write(f"{b}\t{p2[i]}\n")
|
|
2663
|
+
|
|
2664
|
+
|
|
2665
|
+
# N = 1e6
|
|
2666
|
+
# buildBetaSpectra('H-3', 16, N, prt=True); print('H-3 - done')
|
|
2667
|
+
# buildBetaSpectra('C-14', 16, N, prt=True); print('C-14 - done')
|
|
2668
|
+
# buildBetaSpectra('S-35', 16, N, prt=True); print('S-35 - done')
|
|
2669
|
+
# buildBetaSpectra('Ca-45', 16, N, prt=True); print('Ca-45 - done')
|
|
2670
|
+
# buildBetaSpectra('Ni-63', 16, N, prt=True); print('Ni-63 - done')
|
|
2671
|
+
# buildBetaSpectra('Sr-89', 16, N, prt=True); print('Sr-89 - done')
|
|
2672
|
+
# buildBetaSpectra('Sr-90', 16, N, prt=True); print('Sr-90 - done')
|
|
2673
|
+
# buildBetaSpectra('Tc-99', 16, N, prt=True); print('Tc-99 - done')
|
|
2674
|
+
# buildBetaSpectra('Pm-147', 16, N, prt=True); print('Pm-147 - done')
|
|
2675
|
+
# buildBetaSpectra('Pu-241', 16, N, prt=True); print('Pu-241 - done')
|
|
2676
|
+
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|