TDCRPy 1.13.1__py3-none-any.whl → 2.0.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.13.1.dist-info → TDCRPy-2.0.0.dist-info}/METADATA +1 -1
- {TDCRPy-1.13.1.dist-info → TDCRPy-2.0.0.dist-info}/RECORD +8 -8
- {TDCRPy-1.13.1.dist-info → TDCRPy-2.0.0.dist-info}/WHEEL +1 -1
- tdcrpy/TDCRPy.py +204 -109
- tdcrpy/TDCR_model_lib.py +123 -8
- tdcrpy/__init__.py +0 -1
- {TDCRPy-1.13.1.dist-info → TDCRPy-2.0.0.dist-info}/LICENCE.md +0 -0
- {TDCRPy-1.13.1.dist-info → TDCRPy-2.0.0.dist-info}/top_level.txt +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
tdcrpy/TDCRPy.py,sha256=
|
|
1
|
+
tdcrpy/TDCRPy.py,sha256=MBIIarFldIoz1BOyWlB_5rKA_5NMed2QQfM-2xqJnUg,61031
|
|
2
2
|
tdcrpy/TDCRPy1.py,sha256=QTBZh5B5JWnGB0BQfD-cFmwA9W080OD4sG-aj50-ejo,38106
|
|
3
|
-
tdcrpy/TDCR_model_lib.py,sha256=
|
|
3
|
+
tdcrpy/TDCR_model_lib.py,sha256=I8AOboq9sgCnkMpu871RTABgxvUg-OwBNzL20EARJpo,124068
|
|
4
4
|
tdcrpy/TDCRoptimize.py,sha256=c2XIGveeLdVYYek4Rg6dygMvVA2xIrIkMb3L-_jUucM,6496
|
|
5
|
-
tdcrpy/__init__.py,sha256=
|
|
5
|
+
tdcrpy/__init__.py,sha256=9Djir8dPNchcJVQvhl-oRHEOsoDkiZlkOhWT-eHR7wQ,95
|
|
6
6
|
tdcrpy/config.toml,sha256=d_olKEgxfobBHkZ2wEj9EgKE7I8Wbpim9ZAsi5ImFxk,1470
|
|
7
7
|
tdcrpy/test2.py,sha256=poLLXJyIaCeqh1VSkwgbi-udvY7lQjxz_YStKjJXGhU,501
|
|
8
8
|
tdcrpy/EfficiencyCurves/Ag-108/EffD_Ag-108_[1]_1e-05.txt,sha256=OUoMuqPTw3fXLu5qaHUFN2iW0dPJ9cRyh99a6mUcEus,43
|
|
@@ -1081,8 +1081,8 @@ tdcrpy/docs/_build/html/source/modules.html,sha256=Jf-qxVBId0UgpwyvYuyjtMNG-ezPO
|
|
|
1081
1081
|
tdcrpy/docs/_build/html/source/tdcrpy.html,sha256=-38lHMNFB22p1tWJEeN3yDqfDiCYE304vxDamO1-iRc,3779
|
|
1082
1082
|
tdcrpy/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1083
1083
|
tdcrpy/test/test_tdcrpy.py,sha256=JINqSEMFoNpptE4f3h6ZzTYW1rBx90KkaoQzltSg-No,4692
|
|
1084
|
-
TDCRPy-
|
|
1085
|
-
TDCRPy-
|
|
1086
|
-
TDCRPy-
|
|
1087
|
-
TDCRPy-
|
|
1088
|
-
TDCRPy-
|
|
1084
|
+
TDCRPy-2.0.0.dist-info/LICENCE.md,sha256=ZTpWyGU3qv_iwEpgvCijoCuCYpOPpyzJCgOk46WpUKU,1066
|
|
1085
|
+
TDCRPy-2.0.0.dist-info/METADATA,sha256=VHpxRhIMAyLRXOcwjFkhQ-E0bVBk5yIQ_YsevRQorcY,15831
|
|
1086
|
+
TDCRPy-2.0.0.dist-info/WHEEL,sha256=nCVcAvsfA9TDtwGwhYaRrlPhTLV9m-Ga6mdyDtuwK18,91
|
|
1087
|
+
TDCRPy-2.0.0.dist-info/top_level.txt,sha256=f4vzFFcKSEnonAACs0ZXuRczmroLLqtPTqXFymU_VU0,14
|
|
1088
|
+
TDCRPy-2.0.0.dist-info/RECORD,,
|
tdcrpy/TDCRPy.py
CHANGED
|
@@ -17,6 +17,7 @@ import numpy as np
|
|
|
17
17
|
from tqdm import tqdm
|
|
18
18
|
import tempfile
|
|
19
19
|
import os
|
|
20
|
+
import scipy.optimize as opt
|
|
20
21
|
|
|
21
22
|
def relaxAtom(daughter_relax,particle_vec,energy_vec,rad,Display=False,uncData=False):
|
|
22
23
|
|
|
@@ -83,61 +84,30 @@ def relaxAtom(daughter_relax,particle_vec,energy_vec,rad,Display=False,uncData=F
|
|
|
83
84
|
relaxation = False
|
|
84
85
|
return particle_vec, energy_vec
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, symm=True, mode="eff", Display=False, barp=False, Smodel=True, syst = "TDCR", record = False, readRecHist = False, uncData=False):
|
|
87
|
+
def TDCRPy(L, Rad, pmf_1, N, kB, V, mode="eff", Display=False, barp=False, Smodel=True, record = False, readRecHist = False, uncData=False):
|
|
89
88
|
"""
|
|
90
|
-
This is the main function of the TDCRPy package
|
|
89
|
+
This is the main function of the TDCRPy package.
|
|
91
90
|
The computation is made for a given solution containing a radionuclide (or a mixture of radionuclides), a given volume of scintillator V and a given Birks constant kB.
|
|
92
|
-
|
|
93
|
-
It can operates in two modes:
|
|
94
|
-
|
|
95
|
-
--> In mode="eff", it calculates the efficiency of the TDCR system as a function of a value (triplet) of free parameter(s) L, the measurement data is not used;
|
|
96
|
-
|
|
97
|
-
--> In mode="res", it calculates the residual of the TDCR model parametrized by a value (or triplet) of free parameter(s) L and the measurement data TD, TAB, TBC, TAC.
|
|
98
|
-
|
|
99
|
-
also, two configuration can be set:
|
|
100
91
|
|
|
101
|
-
--> mode2="sym", where symmetry is considered between the 3 photomultiplier tubes - here L is a scalar and only the global TDCR value TD is used as measurement data.
|
|
102
|
-
|
|
103
|
-
--> mode2="asym", where an asymmetry between the 3 photomultiplier tubes is possible - here L is a triplet and only the specific TDCR values TAB, TBC, TAC are used as measurement data.
|
|
104
|
-
|
|
105
92
|
The parmeter N sets the number of Monte-Carlo trails used for the estimation. Each MC trial corresponds to a simulated radiactive decay.
|
|
106
93
|
TDCRPY() used a set of fonctions from the tdcrpy.TDCR_model_lib module.
|
|
107
94
|
|
|
108
95
|
Advanced settings can be configured in the config.toml file.
|
|
109
96
|
|
|
110
|
-
--> By default Y = True so that the analytical model is applied for solution containing only pure beta emitting radionuclides. If you would like to apply the MC calculation also for these nuclides, set Y = False.
|
|
111
|
-
|
|
112
|
-
--> If you would like to change the number of bins nE to discretize the linear energy space for quenching calculation, you can change nE_electron and nE_alpha parameters for respectively electrons and alpha particles.
|
|
113
|
-
|
|
114
|
-
--> By default the calculation is set for Ultima-Gold cocktail mixed with a small amount of aqueous solution. You can adapt for a specific scintillator by changing the density, the mean charge number Z and the mean mass number A of the scintillator.
|
|
115
|
-
|
|
116
|
-
|
|
117
97
|
Parameters
|
|
118
98
|
----------
|
|
119
|
-
L : Float
|
|
120
|
-
|
|
121
|
-
TD : float
|
|
122
|
-
triple-to-double coincidence ratio. Not consider if mode2="asym". Not consider if mode2="asym".
|
|
123
|
-
TAB : float
|
|
124
|
-
triple-to-double coincidence ratio (coincidences between channel A and B). Not consider if mode2="sym".
|
|
125
|
-
TBC : float
|
|
126
|
-
triple-to-double coincidence ratio (coincidences between channel B and C). Not consider if mode2="sym".
|
|
127
|
-
TAC : float
|
|
128
|
-
triple-to-double coincidence ratio (coincidences between channel A and C). Not consider if mode2="sym".
|
|
99
|
+
L : Float or tuple
|
|
100
|
+
If L is float, then L is the global free parameter. If L is tuple, then L is a triplet of free parameters. unit keV-1
|
|
129
101
|
Rad : string
|
|
130
102
|
List of radionuclides (eg. "H-3, Co-60").
|
|
131
103
|
pmf_1 : string
|
|
132
104
|
list of probability of each radionuclide (eg. "0.8, 0.2").
|
|
133
105
|
N : integer
|
|
134
|
-
Number of Monte-Carlo trials. recommanded N>10000 (see JCGM 101). Not applied in the case of
|
|
106
|
+
Number of Monte-Carlo trials. recommanded N>10000 (see JCGM 101). Not applied in the case of the analytical model.
|
|
135
107
|
kB : float
|
|
136
108
|
Birks constant in cm/keV.
|
|
137
109
|
V : float
|
|
138
110
|
volume of the scintillator in ml.
|
|
139
|
-
symm : Boolean, optional
|
|
140
|
-
"False" to consider PMT asymmetry. the default is True.
|
|
141
111
|
mode : string
|
|
142
112
|
"eff" to return efficiencies, "dis" to return list of decay events.
|
|
143
113
|
Display : Boolean, optional
|
|
@@ -151,25 +121,42 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, symm=True, mode="eff", Di
|
|
|
151
121
|
|
|
152
122
|
Returns
|
|
153
123
|
-------
|
|
154
|
-
res : float
|
|
155
|
-
Residuals of the model compared the measurement data for (a) given free parmeters L. (only in mode="res")
|
|
156
124
|
mean_efficiency_S : float
|
|
157
|
-
Estimation of the efficiency of single counting events.
|
|
125
|
+
Estimation of the efficiency of single counting events.
|
|
158
126
|
std_efficiency_S : float
|
|
159
|
-
Standard uncertainty from calculation associated with the estimation of the efficiency of single counting events.
|
|
127
|
+
Standard uncertainty from calculation associated with the estimation of the efficiency of single counting events.
|
|
160
128
|
mean_efficiency_D : float
|
|
161
|
-
Estimation of the efficiency of logic sum of double coincidences.
|
|
129
|
+
Estimation of the efficiency of logic sum of double coincidences.
|
|
162
130
|
std_efficiency_D : float
|
|
163
|
-
Standard uncertainty from calculation associated with the estimation of the efficiency of logic sum of double coincidences.
|
|
131
|
+
Standard uncertainty from calculation associated with the estimation of the efficiency of logic sum of double coincidences.
|
|
164
132
|
mean_efficiency_T : float
|
|
165
|
-
Estimation of the efficiency of triple coincidences.
|
|
133
|
+
Estimation of the efficiency of triple coincidences.
|
|
166
134
|
std_efficiency_T : float
|
|
167
|
-
Standard uncertainty from calculation associated with the estimation of the efficiency of triple coincidences.
|
|
135
|
+
Standard uncertainty from calculation associated with the estimation of the efficiency of triple coincidences.
|
|
136
|
+
mean_efficiency_AB : float
|
|
137
|
+
detection efficiency of coincidences between channels A and B.
|
|
138
|
+
std_efficiency_AB : float
|
|
139
|
+
standard uncertainty of detection efficiency of coincidences between channels A and B.
|
|
140
|
+
mean_efficiency_BC : float
|
|
141
|
+
detection efficiency of coincidences between channels B and C.
|
|
142
|
+
std_efficiency_BC : float
|
|
143
|
+
standard uncertainty of Ddetection efficiency of coincidences between channels B and C.
|
|
144
|
+
mean_efficiency_AC : float
|
|
145
|
+
detection efficiency of coincidences between channels A and C.
|
|
146
|
+
std_efficiency_AC : float
|
|
147
|
+
standard uncertainty of detection efficiency of coincidences between channels A and C.
|
|
168
148
|
mean_efficiency_D2 : float
|
|
169
|
-
|
|
149
|
+
detection efficiency of coincidences in a C/N system.
|
|
170
150
|
std_efficiency_D2 : float
|
|
171
|
-
|
|
151
|
+
standard uncertainty of detection efficiency of coincidences in a C/N system.
|
|
172
152
|
"""
|
|
153
|
+
|
|
154
|
+
if isinstance(L, (tuple, list)):
|
|
155
|
+
symm = False
|
|
156
|
+
else:
|
|
157
|
+
symm = True
|
|
158
|
+
|
|
159
|
+
|
|
173
160
|
if record:
|
|
174
161
|
temp_dir = tempfile.gettempdir()
|
|
175
162
|
recfile1 = os.path.join(temp_dir, "Temp_E0.txt")
|
|
@@ -230,17 +217,13 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, symm=True, mode="eff", Di
|
|
|
230
217
|
inE = radListPureBeta.index(Rad)
|
|
231
218
|
nE = nElist[inE]
|
|
232
219
|
# print(f"Analytical model used for {Rad}")
|
|
233
|
-
out=tl.modelAnalytical(L,
|
|
234
|
-
if mode == "res":
|
|
235
|
-
return out
|
|
220
|
+
out=tl.modelAnalytical(L,1,1,1,1,Rad,kB,V,mode,symm,nE)
|
|
236
221
|
if mode == "eff":
|
|
237
222
|
return out[0], 0, out[1], 0, out[2], 0
|
|
238
223
|
elif (not Smodel) and (not Rad in radListPureBeta):
|
|
239
224
|
# print("cannot be processed by the analytical model.")
|
|
240
225
|
# print(f"Analytical model used for {Rad}")
|
|
241
|
-
out=tl.modelAnalytical(L,
|
|
242
|
-
if mode == "res":
|
|
243
|
-
return out
|
|
226
|
+
out=tl.modelAnalytical(L,1,1,1,1,Rad,kB,V,mode,symm,1000)
|
|
244
227
|
if mode == "eff":
|
|
245
228
|
return out[0], 0, out[1], 0, out[2], 0
|
|
246
229
|
|
|
@@ -271,10 +254,13 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, symm=True, mode="eff", Di
|
|
|
271
254
|
if decay != decaym:
|
|
272
255
|
if decay>0:
|
|
273
256
|
# print(decay-1,e_quenching,e_quenching2, evenement)
|
|
274
|
-
efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement,
|
|
257
|
+
efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_AB, efficiency0_BC, efficiency0_AC, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, extDT, measTime)
|
|
275
258
|
efficiency_S.append(efficiency0_S)
|
|
276
259
|
efficiency_T.append(efficiency0_T)
|
|
277
260
|
efficiency_D.append(efficiency0_D)
|
|
261
|
+
efficiency_AB.append(efficiency0_AB)
|
|
262
|
+
efficiency_BC.append(efficiency0_BC)
|
|
263
|
+
efficiency_AC.append(efficiency0_AC)
|
|
278
264
|
efficiency_D2.append(efficiency0_D2)
|
|
279
265
|
|
|
280
266
|
# print(efficiency0_D, "\n")
|
|
@@ -296,14 +282,17 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, symm=True, mode="eff", Di
|
|
|
296
282
|
else:
|
|
297
283
|
e_quenching.append(energy)
|
|
298
284
|
|
|
299
|
-
efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement,
|
|
285
|
+
efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_AB, efficiency0_BC, efficiency0_AC, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, extDT, measTime)
|
|
300
286
|
efficiency_S.append(efficiency0_S)
|
|
301
287
|
efficiency_T.append(efficiency0_T)
|
|
302
288
|
efficiency_D.append(efficiency0_D)
|
|
289
|
+
efficiency_AB.append(efficiency0_AB)
|
|
290
|
+
efficiency_BC.append(efficiency0_BC)
|
|
291
|
+
efficiency_AC.append(efficiency0_AC)
|
|
303
292
|
efficiency_D2.append(efficiency0_D2)
|
|
304
293
|
|
|
305
294
|
# print(efficiency_D)
|
|
306
|
-
outEff = tl.efficienciesEstimates(efficiency_S, efficiency_D, efficiency_T, efficiency_D2, N)
|
|
295
|
+
outEff = tl.efficienciesEstimates(efficiency_S, efficiency_D, efficiency_T, efficiency_AB, efficiency_BC, efficiency_AC, efficiency_D2, N)
|
|
307
296
|
if mode == "eff": return outEff
|
|
308
297
|
if mode == "dis": return efficiency_S, efficiency_D, efficiency_T, efficiency_D2
|
|
309
298
|
|
|
@@ -960,10 +949,13 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, symm=True, mode="eff", Di
|
|
|
960
949
|
====================
|
|
961
950
|
'''
|
|
962
951
|
if evenement == 1: e_quenching2 = 0; t1=0
|
|
963
|
-
efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement,
|
|
952
|
+
efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_AB, efficiency0_BC, efficiency0_AC, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, extDT, measTime)
|
|
964
953
|
efficiency_S.append(efficiency0_S)
|
|
965
954
|
efficiency_T.append(efficiency0_T)
|
|
966
955
|
efficiency_D.append(efficiency0_D)
|
|
956
|
+
efficiency_AB.append(efficiency0_AB)
|
|
957
|
+
efficiency_BC.append(efficiency0_BC)
|
|
958
|
+
efficiency_AC.append(efficiency0_AC)
|
|
967
959
|
efficiency_D2.append(efficiency0_D2)
|
|
968
960
|
|
|
969
961
|
|
|
@@ -984,71 +976,174 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, symm=True, mode="eff", Di
|
|
|
984
976
|
VI. CALCULATION OF THE FINAL ESTIMATORS
|
|
985
977
|
====================
|
|
986
978
|
'''
|
|
987
|
-
mean_efficiency_S, std_efficiency_S, mean_efficiency_D, std_efficiency_D, mean_efficiency_T, std_efficiency_T, mean_efficiency_D2, std_efficiency_D2 = tl.efficienciesEstimates(efficiency_S, efficiency_D, efficiency_T, efficiency_D2,N)
|
|
988
|
-
|
|
989
|
-
if symm:
|
|
990
|
-
TDCR_calcul = mean_efficiency_T/mean_efficiency_D
|
|
991
|
-
else:
|
|
992
|
-
mean_efficiency_AB = np.mean(efficiency_AB)
|
|
993
|
-
std_efficiency_AB = np.std(efficiency_AB)/np.sqrt(N)
|
|
994
|
-
mean_efficiency_BC = np.mean(efficiency_BC)
|
|
995
|
-
std_efficiency_BC = np.std(efficiency_BC)/np.sqrt(N)
|
|
996
|
-
mean_efficiency_AC = np.mean(efficiency_AC)
|
|
997
|
-
std_efficiency_AC = np.std(efficiency_AC)/np.sqrt(N)
|
|
998
|
-
TDCR_calcul = mean_efficiency_T/mean_efficiency_D
|
|
999
|
-
TABmodel = mean_efficiency_T/mean_efficiency_AB
|
|
1000
|
-
TBCmodel = mean_efficiency_T/mean_efficiency_BC
|
|
1001
|
-
TACmodel = mean_efficiency_T/mean_efficiency_AC
|
|
1002
|
-
|
|
1003
|
-
if symm:
|
|
1004
|
-
res=(TDCR_calcul-TD)**2
|
|
1005
|
-
else:
|
|
1006
|
-
res=(TAB-TABmodel)**2+(TBC-TBCmodel)**2+(TAC-TACmodel)**2
|
|
1007
|
-
|
|
1008
|
-
if mode == "res":
|
|
1009
|
-
return res
|
|
979
|
+
mean_efficiency_S, std_efficiency_S, mean_efficiency_D, std_efficiency_D, mean_efficiency_T, std_efficiency_T, mean_efficiency_AB, std_efficiency_AB, mean_efficiency_BC, std_efficiency_BC, mean_efficiency_AC, std_efficiency_AC, mean_efficiency_D2, std_efficiency_D2 = tl.efficienciesEstimates(efficiency_S, efficiency_D, efficiency_T, efficiency_AB, efficiency_BC, efficiency_AC, efficiency_D2, N)
|
|
980
|
+
|
|
1010
981
|
if mode == "eff":
|
|
1011
|
-
return mean_efficiency_S, std_efficiency_S, mean_efficiency_D, std_efficiency_D, mean_efficiency_T, std_efficiency_T, mean_efficiency_D2, std_efficiency_D2
|
|
982
|
+
return mean_efficiency_S, std_efficiency_S, mean_efficiency_D, std_efficiency_D, mean_efficiency_T, std_efficiency_T, mean_efficiency_AB, std_efficiency_AB, mean_efficiency_BC, std_efficiency_BC, mean_efficiency_AC, std_efficiency_AC, mean_efficiency_D2, std_efficiency_D2
|
|
1012
983
|
if mode =="dis":
|
|
1013
984
|
return efficiency_S, efficiency_D, efficiency_T, efficiency_D2
|
|
1014
985
|
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
# TBC = 0.992343419459002
|
|
1019
|
-
# TAC = 0.99275350064608
|
|
1020
|
-
# Rad="H-3"
|
|
1021
|
-
# pmf_1="1"
|
|
1022
|
-
# N = 100
|
|
1023
|
-
# kB =1.0e-5
|
|
1024
|
-
# V = 10
|
|
1025
|
-
# mode = "eff"
|
|
1026
|
-
# mode2 = "sym"
|
|
986
|
+
def objectFct(L, TD, Rad, pmf_1, N, kB, V):
|
|
987
|
+
"""
|
|
988
|
+
Objective function to minimize in order the estimate the detection efficiencies based on the measurements.
|
|
1027
989
|
|
|
1028
|
-
|
|
990
|
+
Parameters
|
|
991
|
+
----------
|
|
992
|
+
L : float or tuple
|
|
993
|
+
If L is float, then L is the global free parameter. If L is tuple, then L is a triplet of free parameters. unit keV-1
|
|
994
|
+
TD : float or tuple
|
|
995
|
+
measurements. If TD is float, then TD is the measured TDCR parameter. If TD is tuple, then TD must contain the global TDCR parameter followed by specific ones (T/B, T/AB, T/BC, T/AC)
|
|
996
|
+
Rad : string
|
|
997
|
+
List of radionuclides (eg. "H-3, Co-60").
|
|
998
|
+
pmf_1 : string
|
|
999
|
+
list of probability of each radionuclide (eg. "0.8, 0.2").
|
|
1000
|
+
N : integer
|
|
1001
|
+
Number of Monte-Carlo trials. recommanded N>10000 (see JCGM 101). Not applied in the case of the analytical model.
|
|
1002
|
+
kB : float
|
|
1003
|
+
Birks constant in cm/keV.
|
|
1004
|
+
V : float
|
|
1005
|
+
volume of the scintillator in ml.
|
|
1029
1006
|
|
|
1030
|
-
|
|
1007
|
+
Returns
|
|
1008
|
+
-------
|
|
1009
|
+
res : float
|
|
1010
|
+
The residual value.
|
|
1011
|
+
|
|
1012
|
+
"""
|
|
1013
|
+
|
|
1014
|
+
if isinstance(TD, (tuple, list)):
|
|
1015
|
+
symm = False
|
|
1016
|
+
else:
|
|
1017
|
+
symm = True
|
|
1018
|
+
|
|
1019
|
+
if symm:
|
|
1020
|
+
eff_model = TDCRPy(L, Rad, pmf_1, N, kB, V, readRecHist = True)
|
|
1021
|
+
TDCR_calcul = eff_model[4]/eff_model[2]
|
|
1022
|
+
res=(TDCR_calcul-TD)**2
|
|
1023
|
+
else:
|
|
1024
|
+
eff_model = TDCRPy(L, Rad, pmf_1, N, kB, V, readRecHist = True)
|
|
1025
|
+
TAB_calcul = eff_model[4]/eff_model[6]
|
|
1026
|
+
TBC_calcul = eff_model[4]/eff_model[8]
|
|
1027
|
+
TAC_calcul = eff_model[4]/eff_model[10]
|
|
1028
|
+
res=(TD[1]-TAB_calcul)**2+(TD[2]-TBC_calcul)**2+(TD[3]-TAC_calcul)**2
|
|
1029
|
+
|
|
1030
|
+
return res
|
|
1031
|
+
|
|
1032
|
+
def eff(TD, Rad, pmf_1, kB, V, N=10000, L=1, maxiter=20, xatol=1e-7, disp=False):
|
|
1033
|
+
"""
|
|
1034
|
+
Caclulation of the efficiency of a TDCR system based on the model TDCRPy.
|
|
1035
|
+
This function includes optimization procedures from scipy.
|
|
1031
1036
|
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
+
Parameters
|
|
1038
|
+
----------
|
|
1039
|
+
TD : float or tuple
|
|
1040
|
+
measurements. If TD is float, then TD is the measured TDCR parameter. If TD is tuple, then TD must contain the global TDCR parameter followed by specific ones (T/B, T/AB, T/BC, T/AC)
|
|
1041
|
+
Rad : string
|
|
1042
|
+
List of radionuclides (eg. "H-3, Co-60").
|
|
1043
|
+
pmf_1 : string
|
|
1044
|
+
list of probability of each radionuclide (eg. "0.8, 0.2").
|
|
1045
|
+
kB : float
|
|
1046
|
+
Birks constant in cm/keV.
|
|
1047
|
+
V : float
|
|
1048
|
+
volume of the scintillator in ml.
|
|
1049
|
+
N : interger, optional
|
|
1050
|
+
number of Monte-Carlo trials. The default is 10000.
|
|
1051
|
+
maxiter : interger, optional
|
|
1052
|
+
maximum number of iterations of the optimization procedures
|
|
1053
|
+
xatol : float
|
|
1054
|
+
convergence parameter of the Nelder Mead optimisation
|
|
1055
|
+
disp : Boolean
|
|
1056
|
+
to display detailed results of the procedure. Default is False.
|
|
1057
|
+
|
|
1058
|
+
Returns
|
|
1059
|
+
-------
|
|
1060
|
+
L0 : float
|
|
1061
|
+
global free parameter.
|
|
1062
|
+
L : tuple
|
|
1063
|
+
free parameters (relevant for the asymetric model).
|
|
1064
|
+
eff_S : float
|
|
1065
|
+
counting efficiency of single events.
|
|
1066
|
+
u_eff_S : float
|
|
1067
|
+
standard uncertainty of eff_S.
|
|
1068
|
+
eff_D : float
|
|
1069
|
+
counting efficiency of double coincidences.
|
|
1070
|
+
u_eff_D : float
|
|
1071
|
+
standard uncertainty of eff_D.
|
|
1072
|
+
eff_T : float
|
|
1073
|
+
counting efficiency of triple coincidences.
|
|
1074
|
+
u_eff_T : float
|
|
1075
|
+
standard uncertainty of eff_T.
|
|
1076
|
+
eff_AB : float
|
|
1077
|
+
counting efficiency of coincidences AB.
|
|
1078
|
+
u_eff_AB : float
|
|
1079
|
+
standard uncertainty of eff_AB.
|
|
1080
|
+
eff_BC : float
|
|
1081
|
+
counting efficiency of coincidences BC.
|
|
1082
|
+
u_eff_BC : float
|
|
1083
|
+
standard uncertainty of eff_BC.
|
|
1084
|
+
eff_AC : float
|
|
1085
|
+
counting efficiency of coincidences AC.
|
|
1086
|
+
u_eff_AC : float
|
|
1087
|
+
standard uncertainty of eff_AC.
|
|
1088
|
+
eff_D : float
|
|
1089
|
+
counting efficiency of double coincidences in C/N configuation (not relevant).
|
|
1090
|
+
u_eff_D : float
|
|
1091
|
+
standard uncertainty of eff_D in C/N configuation (not relevant).
|
|
1092
|
+
|
|
1093
|
+
"""
|
|
1094
|
+
if isinstance(TD, (tuple, list)):
|
|
1095
|
+
symm = False
|
|
1096
|
+
else:
|
|
1097
|
+
symm = True
|
|
1098
|
+
|
|
1099
|
+
if symm: r=opt.minimize_scalar(objectFct, args=(TD, Rad, pmf_1, N, kB, V), method='bounded', bounds = (0.1, 5), options={'disp': disp, 'maxiter':maxiter})
|
|
1100
|
+
else: r=opt.minimize_scalar(objectFct, args=(TD[0], Rad, pmf_1, N, kB, V), method='bounded', bounds = (0.1, 5), options={'disp': disp, 'maxiter':maxiter})
|
|
1101
|
+
L0=r.x
|
|
1102
|
+
L=(L0, L0, L0)
|
|
1103
|
+
print(f"global free parameter = {L0} keV-1")
|
|
1104
|
+
|
|
1105
|
+
if not symm:
|
|
1106
|
+
r=opt.minimize(objectFct, L, args=(TD, Rad, pmf_1, N, kB, V), method='nelder-mead',options={'xatol': xatol, 'disp': disp, 'maxiter':maxiter})
|
|
1107
|
+
L=r.x
|
|
1108
|
+
print(f"free parameters = {L} keV-1")
|
|
1109
|
+
|
|
1110
|
+
if symm: out=TDCRPy(L0, Rad, pmf_1, N, kB, V, readRecHist = True)
|
|
1111
|
+
else: out=TDCRPy(L, Rad, pmf_1, N, kB, V, readRecHist = True)
|
|
1112
|
+
eff_S = out[0]
|
|
1113
|
+
u_eff_S = out[1]
|
|
1114
|
+
eff_D = out[2]
|
|
1115
|
+
u_eff_D = out[3]
|
|
1116
|
+
eff_T = out[4]
|
|
1117
|
+
u_eff_T = out[5]
|
|
1118
|
+
eff_AB = out[6]
|
|
1119
|
+
u_eff_AB = out[7]
|
|
1120
|
+
eff_BC = out[8]
|
|
1121
|
+
u_eff_BC = out[9]
|
|
1122
|
+
eff_AC = out[10]
|
|
1123
|
+
u_eff_AC = out[11]
|
|
1124
|
+
eff_D2 = out[12]
|
|
1125
|
+
u_eff_D2 = out[13]
|
|
1126
|
+
|
|
1127
|
+
return L0, L, eff_S, u_eff_S, eff_D, u_eff_D, eff_T, u_eff_T, eff_AB, u_eff_AB, eff_BC, u_eff_BC, eff_AC, u_eff_AC, eff_D2, u_eff_D2
|
|
1128
|
+
|
|
1129
|
+
|
|
1130
|
+
# # L = 1
|
|
1131
|
+
# # L = (1.1, 1.05, 1.15)
|
|
1132
|
+
# # TD = 0.977667386529166
|
|
1133
|
+
# TD = (0.977667386529166, 0.992232838598821, 0.992343419459002, 0.99275350064608)
|
|
1134
|
+
# # TD = (0.977667386529166, 0.995232838598821, 0.990343419459002, 0.99275350064608)
|
|
1037
1135
|
# Rad="Co-60"
|
|
1038
1136
|
# pmf_1="1"
|
|
1039
|
-
# N =
|
|
1137
|
+
# N = 1000
|
|
1040
1138
|
# kB =1.0e-5
|
|
1041
1139
|
# V = 10
|
|
1042
1140
|
# mode = "eff"
|
|
1043
1141
|
|
|
1044
|
-
# # # # out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=True, barp=False,uncData=False)
|
|
1045
|
-
# # # # print("TDCR", out[4]/out[2])
|
|
1046
|
-
# # # # print("Eff D", out[2])
|
|
1047
|
-
|
|
1048
1142
|
|
|
1049
|
-
# #
|
|
1143
|
+
# # out = TDCRPy(L, Rad, pmf_1, N, kB, V, Display = False, record = True, readRecHist = False)
|
|
1144
|
+
# # print("result", out)
|
|
1145
|
+
# # out = TDCRPy(L, Rad, pmf_1, N, kB, V, Display = False, record = False, readRecHist = True)
|
|
1146
|
+
# # print("result", out)
|
|
1050
1147
|
|
|
1051
|
-
# out =
|
|
1052
|
-
# print(
|
|
1053
|
-
# out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, symm=True, Display = False, record = False, readRecHist = True)
|
|
1054
|
-
# print("result", out)
|
|
1148
|
+
# out = eff(TD, Rad, pmf_1, kB, V, N=1000, L=1, maxiter=20, xatol=1e-7)
|
|
1149
|
+
# print(out)
|
tdcrpy/TDCR_model_lib.py
CHANGED
|
@@ -2829,7 +2829,50 @@ def buildBetaSpectra(rad, V, N, prt=False):
|
|
|
2829
2829
|
else: file.write(f"{b}\t{p2[i]}\n")
|
|
2830
2830
|
print("file written in local")
|
|
2831
2831
|
|
|
2832
|
-
def detectProbabilities(L, e_quenching, e_quenching2, t1, evenement,
|
|
2832
|
+
def detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, extDT, measTime):
|
|
2833
|
+
"""
|
|
2834
|
+
Calculate detection probabilities for LS counting systems - see Broda, R., Cassette, P., Kossert, K., 2007. Radionuclide metrology using liquid scintillation counting. Metrologia 44. https://doi.org/10.1088/0026-1394/44/4/S06
|
|
2835
|
+
|
|
2836
|
+
Parameters
|
|
2837
|
+
----------
|
|
2838
|
+
L : float or tuple
|
|
2839
|
+
If L is float, then L is the global free parameter. If L is tuple, then L is a triplet of free parameters. unit keV-1
|
|
2840
|
+
e_quenching : list
|
|
2841
|
+
List of quenched deposited energies from prompt particles in keV.
|
|
2842
|
+
e_quenching2 : list
|
|
2843
|
+
List of quenched deposited energies from delayed particles in keV.
|
|
2844
|
+
t1 : float
|
|
2845
|
+
decay time of the delayed transitions in s.
|
|
2846
|
+
evenement : interger
|
|
2847
|
+
number of pulses per decay (prompt (1), prompt + delayed (2)).
|
|
2848
|
+
extDT : float
|
|
2849
|
+
extended dead time of the system in ns.
|
|
2850
|
+
measTime : float
|
|
2851
|
+
measurement time in minutes.
|
|
2852
|
+
|
|
2853
|
+
Returns
|
|
2854
|
+
-------
|
|
2855
|
+
efficiency0_S : float
|
|
2856
|
+
detection probability of single event.
|
|
2857
|
+
efficiency0_D : float
|
|
2858
|
+
detection probability of double coincidences.
|
|
2859
|
+
efficiency0_T : float
|
|
2860
|
+
detection probability of triple coincidences.
|
|
2861
|
+
efficiency0_AB : float
|
|
2862
|
+
detection probability of coincidences between channels A and B.
|
|
2863
|
+
efficiency0_BC : float
|
|
2864
|
+
detection probability of coincidences between channels B and C.
|
|
2865
|
+
efficiency0_AC : float
|
|
2866
|
+
detection probability of coincidences between channels A and C.
|
|
2867
|
+
efficiency0_D2 : float
|
|
2868
|
+
detection probability of coincidences in a C/N system.
|
|
2869
|
+
|
|
2870
|
+
"""
|
|
2871
|
+
if isinstance(L, (tuple, list)):
|
|
2872
|
+
symm = False
|
|
2873
|
+
else:
|
|
2874
|
+
symm = True
|
|
2875
|
+
|
|
2833
2876
|
if symm:
|
|
2834
2877
|
# print(evenement !=1, t1 > extDT*1e-6, t1 < measTime*60)
|
|
2835
2878
|
if evenement !=1 and t1 > extDT*1e-6 and t1 < measTime*60:
|
|
@@ -2841,12 +2884,17 @@ def detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, symm, extDT
|
|
|
2841
2884
|
efficiency0_S = 1-p_nosingle**3+1-p_nosingle2**3
|
|
2842
2885
|
efficiency0_T = p_single**3+p_single2**3
|
|
2843
2886
|
efficiency0_D = 3*(p_single)**2-2*p_single**3+(3*(p_single2)**2-2*p_single2**3)
|
|
2887
|
+
efficiency0_AB = (efficiency0_D+2*efficiency0_T)/3
|
|
2888
|
+
efficiency0_BC = efficiency0_AB
|
|
2889
|
+
efficiency0_AC = efficiency0_AB
|
|
2844
2890
|
|
|
2845
2891
|
# CN
|
|
2846
2892
|
p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2847
2893
|
p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
|
|
2848
2894
|
p_nosingle2 = np.exp(-L*np.sum(np.asarray(e_quenching2))/2) # probability to have 0 electrons in a PMT
|
|
2849
2895
|
p_single2 = 1-p_nosingle2
|
|
2896
|
+
efficiency0_A2 = p_single+p_single2
|
|
2897
|
+
efficiency0_B2 = efficiency0_A2
|
|
2850
2898
|
efficiency0_D2 = p_single**2+p_single2**2
|
|
2851
2899
|
else:
|
|
2852
2900
|
# TDCR
|
|
@@ -2855,10 +2903,15 @@ def detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, symm, extDT
|
|
|
2855
2903
|
efficiency0_S = 1-p_nosingle**3
|
|
2856
2904
|
efficiency0_T = p_single**3
|
|
2857
2905
|
efficiency0_D = 3*(p_single)**2-2*efficiency0_T
|
|
2906
|
+
efficiency0_AB = (efficiency0_D+2*efficiency0_T)/3
|
|
2907
|
+
efficiency0_BC = efficiency0_AB
|
|
2908
|
+
efficiency0_AC = efficiency0_AB
|
|
2858
2909
|
|
|
2859
2910
|
# CN
|
|
2860
2911
|
p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2861
2912
|
p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
|
|
2913
|
+
efficiency0_A2 = p_single
|
|
2914
|
+
efficiency0_B2 = efficiency0_A2
|
|
2862
2915
|
efficiency0_D2 = p_single**2
|
|
2863
2916
|
|
|
2864
2917
|
|
|
@@ -2927,19 +2980,81 @@ def detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, symm, extDT
|
|
|
2927
2980
|
pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
|
|
2928
2981
|
efficiency0_D2 = pA_single*pB_single
|
|
2929
2982
|
|
|
2930
|
-
return efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2
|
|
2983
|
+
return efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_AB, efficiency0_BC, efficiency0_AC, efficiency0_D2
|
|
2931
2984
|
|
|
2932
2985
|
|
|
2933
|
-
def efficienciesEstimates(efficiency_S, efficiency_D, efficiency_T, efficiency_D2,N):
|
|
2934
|
-
|
|
2935
|
-
|
|
2986
|
+
def efficienciesEstimates(efficiency_S, efficiency_D, efficiency_T, efficiency_AB, efficiency_BC, efficiency_AC, efficiency_D2, N):
|
|
2987
|
+
"""
|
|
2988
|
+
Calculate detection efficiencies from list of detection probabilities per decays.
|
|
2989
|
+
|
|
2990
|
+
Parameters
|
|
2991
|
+
----------
|
|
2992
|
+
efficiency0_S : float
|
|
2993
|
+
detection probability of single event.
|
|
2994
|
+
efficiency0_D : float
|
|
2995
|
+
detection probability of double coincidences.
|
|
2996
|
+
efficiency0_T : float
|
|
2997
|
+
detection probability of triple coincidences.
|
|
2998
|
+
efficiency0_AB : float
|
|
2999
|
+
detection probability of coincidences between channels A and B.
|
|
3000
|
+
efficiency0_BC : float
|
|
3001
|
+
detection probability of coincidences between channels B and C.
|
|
3002
|
+
efficiency0_AC : float
|
|
3003
|
+
detection probability of coincidences between channels A and C.
|
|
3004
|
+
efficiency0_D2 : float
|
|
3005
|
+
detection probability of coincidences in a C/N system.
|
|
3006
|
+
N : interger
|
|
3007
|
+
number of simulated decays.
|
|
3008
|
+
|
|
3009
|
+
Returns
|
|
3010
|
+
-------
|
|
3011
|
+
mean_efficiency_S : float
|
|
3012
|
+
detection efficiency of single event.
|
|
3013
|
+
std_efficiency_S : float
|
|
3014
|
+
standard uncertainty of detection efficiency of single event.
|
|
3015
|
+
mean_efficiency_D : float
|
|
3016
|
+
detection efficiency of double coincidences.
|
|
3017
|
+
std_efficiency_D : float
|
|
3018
|
+
standard uncertainty of detection efficiency of double coincidences.
|
|
3019
|
+
mean_efficiency_T : float
|
|
3020
|
+
detection efficiency of triple coincidences.
|
|
3021
|
+
std_efficiency_T : float
|
|
3022
|
+
standard uncertainty of detection efficiency of triple coincidences.
|
|
3023
|
+
mean_efficiency_AB : float
|
|
3024
|
+
detection efficiency of coincidences between channels A and B.
|
|
3025
|
+
std_efficiency_AB : float
|
|
3026
|
+
standard uncertainty of detection efficiency of coincidences between channels A and B.
|
|
3027
|
+
mean_efficiency_BC : float
|
|
3028
|
+
detection efficiency of coincidences between channels B and C.
|
|
3029
|
+
std_efficiency_BC : float
|
|
3030
|
+
standard uncertainty of Ddetection efficiency of coincidences between channels B and C.
|
|
3031
|
+
mean_efficiency_AC : float
|
|
3032
|
+
detection efficiency of coincidences between channels A and C.
|
|
3033
|
+
std_efficiency_AC : float
|
|
3034
|
+
standard uncertainty of detection efficiency of coincidences between channels A and C.
|
|
3035
|
+
mean_efficiency_D2 : float
|
|
3036
|
+
detection efficiency of coincidences in a C/N system.
|
|
3037
|
+
std_efficiency_D2 : float
|
|
3038
|
+
standard uncertainty of detection efficiency of coincidences in a C/N system.
|
|
3039
|
+
|
|
3040
|
+
"""
|
|
3041
|
+
mean_efficiency_S = np.mean(efficiency_S)
|
|
3042
|
+
std_efficiency_S = np.std(efficiency_S)/np.sqrt(N)
|
|
2936
3043
|
mean_efficiency_D = np.mean(efficiency_D)
|
|
2937
3044
|
std_efficiency_D = np.std(efficiency_D)/np.sqrt(N)
|
|
3045
|
+
mean_efficiency_T = np.mean(efficiency_T) # average
|
|
3046
|
+
std_efficiency_T = np.std(efficiency_T)/np.sqrt(N) # standard deviation
|
|
3047
|
+
mean_efficiency_AB = np.mean(efficiency_AB)
|
|
3048
|
+
std_efficiency_AB = np.std(efficiency_AB)/np.sqrt(N)
|
|
3049
|
+
mean_efficiency_BC = np.mean(efficiency_BC)
|
|
3050
|
+
std_efficiency_BC = np.std(efficiency_BC)/np.sqrt(N)
|
|
3051
|
+
mean_efficiency_AC = np.mean(efficiency_AC)
|
|
3052
|
+
std_efficiency_AC = np.std(efficiency_AC)/np.sqrt(N)
|
|
3053
|
+
|
|
2938
3054
|
mean_efficiency_D2 = np.mean(efficiency_D2)
|
|
2939
3055
|
std_efficiency_D2 = np.std(efficiency_D2)/np.sqrt(N)
|
|
2940
|
-
|
|
2941
|
-
std_efficiency_S
|
|
2942
|
-
return mean_efficiency_S, std_efficiency_S, mean_efficiency_D, std_efficiency_D, mean_efficiency_T, std_efficiency_T, mean_efficiency_D2, std_efficiency_D2
|
|
3056
|
+
|
|
3057
|
+
return mean_efficiency_S, std_efficiency_S, mean_efficiency_D, std_efficiency_D, mean_efficiency_T, std_efficiency_T, mean_efficiency_AB, std_efficiency_AB, mean_efficiency_BC, std_efficiency_BC, mean_efficiency_AC, std_efficiency_AC, mean_efficiency_D2, std_efficiency_D2
|
|
2943
3058
|
|
|
2944
3059
|
|
|
2945
3060
|
|
tdcrpy/__init__.py
CHANGED
|
File without changes
|
|
File without changes
|