TDCRPy 1.12.15__py3-none-any.whl → 1.13.1__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.12.15.dist-info → TDCRPy-1.13.1.dist-info}/METADATA +1 -1
- {TDCRPy-1.12.15.dist-info → TDCRPy-1.13.1.dist-info}/RECORD +7 -7
- {TDCRPy-1.12.15.dist-info → TDCRPy-1.13.1.dist-info}/WHEEL +1 -1
- tdcrpy/TDCRPy.py +115 -152
- tdcrpy/TDCR_model_lib.py +120 -6
- {TDCRPy-1.12.15.dist-info → TDCRPy-1.13.1.dist-info}/LICENCE.md +0 -0
- {TDCRPy-1.12.15.dist-info → TDCRPy-1.13.1.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
tdcrpy/TDCRPy.py,sha256=
|
|
1
|
+
tdcrpy/TDCRPy.py,sha256=1b3U-ChfXyvBK-QlVD7w8CZlbTA-ECSMYeBADluH65U,58251
|
|
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=_A7Nylho30mVRZ3BukrRiSIZWH2nDSAz-PwV16r8cdQ,119137
|
|
4
4
|
tdcrpy/TDCRoptimize.py,sha256=c2XIGveeLdVYYek4Rg6dygMvVA2xIrIkMb3L-_jUucM,6496
|
|
5
5
|
tdcrpy/__init__.py,sha256=vQslGLsoZPIceaitnSHOqN6lUdjEyJ3YhfJ6tYdXt-s,127
|
|
6
6
|
tdcrpy/config.toml,sha256=d_olKEgxfobBHkZ2wEj9EgKE7I8Wbpim9ZAsi5ImFxk,1470
|
|
@@ -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-1.
|
|
1085
|
-
TDCRPy-1.
|
|
1086
|
-
TDCRPy-1.
|
|
1087
|
-
TDCRPy-1.
|
|
1088
|
-
TDCRPy-1.
|
|
1084
|
+
TDCRPy-1.13.1.dist-info/LICENCE.md,sha256=ZTpWyGU3qv_iwEpgvCijoCuCYpOPpyzJCgOk46WpUKU,1066
|
|
1085
|
+
TDCRPy-1.13.1.dist-info/METADATA,sha256=8Qzn3ZzukIJ3n595zF9DFUMXaKXNpM9z_a3Of2TjqPM,15832
|
|
1086
|
+
TDCRPy-1.13.1.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
|
|
1087
|
+
TDCRPy-1.13.1.dist-info/top_level.txt,sha256=f4vzFFcKSEnonAACs0ZXuRczmroLLqtPTqXFymU_VU0,14
|
|
1088
|
+
TDCRPy-1.13.1.dist-info/RECORD,,
|
tdcrpy/TDCRPy.py
CHANGED
|
@@ -83,7 +83,9 @@ def relaxAtom(daughter_relax,particle_vec,energy_vec,rad,Display=False,uncData=F
|
|
|
83
83
|
relaxation = False
|
|
84
84
|
return particle_vec, energy_vec
|
|
85
85
|
|
|
86
|
-
def
|
|
86
|
+
# def objectFct()
|
|
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
89
|
"""
|
|
88
90
|
This is the main function of the TDCRPy package running the Monte-Carlo Triple-to-Double Coincidence Ratio model.
|
|
89
91
|
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.
|
|
@@ -134,10 +136,10 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
134
136
|
Birks constant in cm/keV.
|
|
135
137
|
V : float
|
|
136
138
|
volume of the scintillator in ml.
|
|
139
|
+
symm : Boolean, optional
|
|
140
|
+
"False" to consider PMT asymmetry. the default is True.
|
|
137
141
|
mode : string
|
|
138
|
-
"
|
|
139
|
-
mode2 : string
|
|
140
|
-
"sym" for symetrical model, "asym" for symetrical model.
|
|
142
|
+
"eff" to return efficiencies, "dis" to return list of decay events.
|
|
141
143
|
Display : Boolean, optional
|
|
142
144
|
"True" to display details on the decay sampling. The default is False.
|
|
143
145
|
barp : Boolean, optional
|
|
@@ -228,7 +230,7 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
228
230
|
inE = radListPureBeta.index(Rad)
|
|
229
231
|
nE = nElist[inE]
|
|
230
232
|
# print(f"Analytical model used for {Rad}")
|
|
231
|
-
out=tl.modelAnalytical(L,TD,TAB,TBC,TAC,Rad,kB,V,mode,
|
|
233
|
+
out=tl.modelAnalytical(L,TD,TAB,TBC,TAC,Rad,kB,V,mode,symm,nE)
|
|
232
234
|
if mode == "res":
|
|
233
235
|
return out
|
|
234
236
|
if mode == "eff":
|
|
@@ -236,12 +238,91 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
236
238
|
elif (not Smodel) and (not Rad in radListPureBeta):
|
|
237
239
|
# print("cannot be processed by the analytical model.")
|
|
238
240
|
# print(f"Analytical model used for {Rad}")
|
|
239
|
-
out=tl.modelAnalytical(L,TD,TAB,TBC,TAC,Rad,kB,V,mode,
|
|
241
|
+
out=tl.modelAnalytical(L,TD,TAB,TBC,TAC,Rad,kB,V,mode,symm,1000)
|
|
240
242
|
if mode == "res":
|
|
241
243
|
return out
|
|
242
244
|
if mode == "eff":
|
|
243
245
|
return out[0], 0, out[1], 0, out[2], 0
|
|
246
|
+
|
|
247
|
+
elif readRecHist:
|
|
248
|
+
efficiency_A2 = []
|
|
249
|
+
efficiency_B2 = []
|
|
250
|
+
efficiency_S = []
|
|
251
|
+
efficiency_D = []
|
|
252
|
+
efficiency_D2 = []
|
|
253
|
+
efficiency_T = []
|
|
254
|
+
efficiency_AB = []
|
|
255
|
+
efficiency_BC = []
|
|
256
|
+
efficiency_AC = []
|
|
257
|
+
|
|
258
|
+
temp_dir = tempfile.gettempdir()
|
|
259
|
+
recfile3 = os.path.join(temp_dir, "Temp_E2.txt")
|
|
260
|
+
|
|
261
|
+
with open(recfile3, "r") as file:
|
|
262
|
+
|
|
263
|
+
decaym = -1
|
|
264
|
+
e_quenching = []; e_quenching2 = []; evenement=1; t1=0
|
|
265
|
+
for line in file:
|
|
266
|
+
if line[0] != "#":
|
|
267
|
+
line = line.split(' ')
|
|
268
|
+
line = [element for element in line if element != ""]
|
|
269
|
+
decay = int(line[2])
|
|
270
|
+
|
|
271
|
+
if decay != decaym:
|
|
272
|
+
if decay>0:
|
|
273
|
+
# 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, symm, extDT, measTime)
|
|
275
|
+
efficiency_S.append(efficiency0_S)
|
|
276
|
+
efficiency_T.append(efficiency0_T)
|
|
277
|
+
efficiency_D.append(efficiency0_D)
|
|
278
|
+
efficiency_D2.append(efficiency0_D2)
|
|
279
|
+
|
|
280
|
+
# print(efficiency0_D, "\n")
|
|
281
|
+
|
|
282
|
+
energy = float(line[1])*1e-3
|
|
283
|
+
t1 = float(line[4])
|
|
284
|
+
decaym = decay
|
|
285
|
+
# print(decay, energy, t1, extDT)
|
|
286
|
+
e_quenching = []; e_quenching2 = []
|
|
287
|
+
evenement=1
|
|
288
|
+
e_quenching.append(energy)
|
|
289
|
+
else:
|
|
290
|
+
energy = float(line[1])*1e-3
|
|
291
|
+
t1 = float(line[4])
|
|
292
|
+
# print(decay, energy, t1, extDT)
|
|
293
|
+
if t1 > tau*1e-9:
|
|
294
|
+
evenement = evenement + 1
|
|
295
|
+
e_quenching2.append(energy)
|
|
296
|
+
else:
|
|
297
|
+
e_quenching.append(energy)
|
|
298
|
+
|
|
299
|
+
efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, symm, extDT, measTime)
|
|
300
|
+
efficiency_S.append(efficiency0_S)
|
|
301
|
+
efficiency_T.append(efficiency0_T)
|
|
302
|
+
efficiency_D.append(efficiency0_D)
|
|
303
|
+
efficiency_D2.append(efficiency0_D2)
|
|
304
|
+
|
|
305
|
+
# print(efficiency_D)
|
|
306
|
+
outEff = tl.efficienciesEstimates(efficiency_S, efficiency_D, efficiency_T, efficiency_D2, N)
|
|
307
|
+
if mode == "eff": return outEff
|
|
308
|
+
if mode == "dis": return efficiency_S, efficiency_D, efficiency_T, efficiency_D2
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
# temp1, temp2, temp3, temp4 = tl.read_temp_files()
|
|
312
|
+
# ee_vec = tl.energyVectors3(temp3)
|
|
313
|
+
# # to be continued
|
|
314
|
+
|
|
244
315
|
else:
|
|
316
|
+
efficiency_A2 = []
|
|
317
|
+
efficiency_B2 = []
|
|
318
|
+
efficiency_S = []
|
|
319
|
+
efficiency_D = []
|
|
320
|
+
efficiency_D2 = []
|
|
321
|
+
efficiency_T = []
|
|
322
|
+
efficiency_AB = []
|
|
323
|
+
efficiency_BC = []
|
|
324
|
+
efficiency_AC = []
|
|
325
|
+
|
|
245
326
|
nE_electron = config["Inputs"].getint("nE_electron")
|
|
246
327
|
nE_alpha = config["Inputs"].getint("nE_alpha")
|
|
247
328
|
Rad=Rad.replace(" ","")
|
|
@@ -295,18 +376,7 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
295
376
|
u_prob_trans.append(out_PenNuc[16])
|
|
296
377
|
trans_halfLife.append(out_PenNuc[15])
|
|
297
378
|
# print("\n",trans_halfLife)
|
|
298
|
-
|
|
299
|
-
efficiency_A2 = []
|
|
300
|
-
efficiency_B2 = []
|
|
301
|
-
efficiency_S = []
|
|
302
|
-
efficiency_D = []
|
|
303
|
-
efficiency_D2 = []
|
|
304
|
-
efficiency_T = []
|
|
305
|
-
efficiency_AB = []
|
|
306
|
-
efficiency_BC = []
|
|
307
|
-
efficiency_AC = []
|
|
308
|
-
|
|
309
|
-
|
|
379
|
+
|
|
310
380
|
if barp and not Display: NN = tqdm(range(N), desc="Processing", unit=" decays")
|
|
311
381
|
else: NN = range(N)
|
|
312
382
|
for idec in NN: # Main Loop - Monte Carlo trials
|
|
@@ -888,104 +958,14 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
888
958
|
====================
|
|
889
959
|
V. LE MESURE TDCR
|
|
890
960
|
====================
|
|
891
|
-
'''
|
|
892
|
-
if
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
efficiency_T.append(p_single**3+p_single2**3)
|
|
900
|
-
efficiency_D.append(3*(p_single)**2-2*p_single**3+(3*(p_single2)**2-2*p_single2**3))
|
|
901
|
-
efficiency_D2.append(p_single**2+p_single2**2)
|
|
902
|
-
if Display: print(f"\n\t COUNTING--Sym \n\t\t Free parameter = {L} keV-1 \n\t Summary of TDCR measurement (prompt)")
|
|
903
|
-
if Display: print("\t\t Free parameter = ", L, "keV-1")
|
|
904
|
-
if Display: print("\t\t Efficiency of single events = ", round(1-p_nosingle**3,5))
|
|
905
|
-
if Display: print("\t\t Efficiency of double events = ", round(3*(p_single)**2-2*p_single**3,5))
|
|
906
|
-
if Display: print("\t\t Efficiency of triple events = ", round(p_single**3,5))
|
|
907
|
-
if Display: print("\t Summary of TDCR measurement (delayed)")
|
|
908
|
-
if Display: print("\t\t Efficiency of single events = ", round(1-p_nosingle2**3,5))
|
|
909
|
-
if Display: print("\t\t Efficiency of double events = ", round(3*(p_single2)**2-2*p_single2**3,5))
|
|
910
|
-
if Display: print("\t\t Efficiency of triple events = ", round(p_single2**3,5))
|
|
911
|
-
if Display: print("\t Summary of TDCR measurement (prompt + delayed)")
|
|
912
|
-
if Display: print("\t\t Efficiency of single events = ", round(1-p_nosingle**3+1-p_nosingle2**3,5))
|
|
913
|
-
if Display: print("\t\t Efficiency of double events = ", round(3*(p_single)**2-2*p_single**3+(3*(p_single2)**2-2*p_single2**3),5))
|
|
914
|
-
if Display: print("\t\t Efficiency of triple events = ", round(p_single**3+p_single2**3,5))
|
|
915
|
-
else:
|
|
916
|
-
p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
917
|
-
p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
|
|
918
|
-
efficiency_S.append(1-p_nosingle**3)
|
|
919
|
-
efficiency_T.append(p_single**3)
|
|
920
|
-
efficiency_D.append(3*(p_single)**2-2*efficiency_T[-1])
|
|
921
|
-
efficiency_D2.append(p_single**2)
|
|
922
|
-
if Display: print(f"\n\t COUNTING--Sym \n\t\t Free parameter = {L} keV-1 \n\t Summary of TDCR measurement (prompt)")
|
|
923
|
-
if Display: print("\t\t Efficiency of single events = ", round(efficiency_S[-1],5))
|
|
924
|
-
if Display: print("\t\t Efficiency of double events = ", round(efficiency_D[-1],5))
|
|
925
|
-
if Display: print("\t\t Efficiency of triple events = ", round(efficiency_T[-1],5))
|
|
926
|
-
|
|
927
|
-
elif mode2=="asym":
|
|
928
|
-
if evenement !=1 and t1 > extDT*1e-6 and t1 < measTime*60:
|
|
929
|
-
pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
930
|
-
pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
|
|
931
|
-
pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
932
|
-
pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
|
|
933
|
-
pC_nosingle = np.exp(-L[2]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
934
|
-
pC_single = 1-pC_nosingle # probability to have at least 1 electrons in a PMT
|
|
935
|
-
|
|
936
|
-
pA_nosingle2 = np.exp(-L[0]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
937
|
-
pA_single2 = 1-pA_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
938
|
-
pB_nosingle2 = np.exp(-L[1]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
939
|
-
pB_single2 = 1-pB_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
940
|
-
pC_nosingle2 = np.exp(-L[2]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
941
|
-
pC_single2 = 1-pC_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
942
|
-
|
|
943
|
-
efficiency_A2.append(pA_single+pA_single2)
|
|
944
|
-
efficiency_B2.append(pB_single+pB_single2)
|
|
945
|
-
efficiency_AB.append(pA_single*pB_single+pA_single2*pB_single2)
|
|
946
|
-
efficiency_BC.append(pB_single*pC_single+pB_single2*pC_single2)
|
|
947
|
-
efficiency_AC.append(pA_single*pC_single+pA_single2*pC_single2)
|
|
948
|
-
efficiency_T.append(pA_single*pB_single*pC_single+pA_single2*pB_single2*pC_single2)
|
|
949
|
-
efficiency_D.append(pA_single*pB_single+pB_single*pC_single+pA_single*pC_single-2*pA_single*pB_single*pC_single+(pA_single2*pB_single2+pB_single2*pC_single2+pA_single2*pC_single2-2*pA_single2*pB_single2*pC_single2))
|
|
950
|
-
#efficiency_S.append(pA_single+pB_single+pC_single-pA_single*pB_single+pB_single*pC_single+pA_single*pC_single-2*pA_single*pB_single*pC_single-pA_single*pB_single*pC_single+(pA_single2+pB_single2+pC_single2-pA_single2*pB_single2+pB_single2*pC_single2+pA_single2*pC_single2-2*pA_single2*pB_single2*pC_single2-pA_single2*pB_single2*pC_single2))
|
|
951
|
-
efficiency_S.append(1-pA_nosingle*pB_nosingle*pC_nosingle+1-pA_nosingle2*pB_nosingle2*pC_nosingle2)
|
|
952
|
-
efficiency_D2.append(pA_single*pB_single+pA_single2*pB_single2)
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
if Display: print(f"\n\t COUNTING--Asym \n\t\t Free parameters (A,B,C) = {L[0]},{L[1]},{L[2]} keV-1 \n\t Summary of TDCR measurement (prompt)")
|
|
957
|
-
#if Display: print("\t Summary of TDCR measurement (prompt)")
|
|
958
|
-
if Display: print("\t\t Efficiency of single events: ", round(pA_single+pB_single+pC_single-pA_single*pB_single+pB_single*pC_single+pA_single*pC_single-2*pA_single*pB_single*pC_single-pA_single*pB_single*pC_single,5))
|
|
959
|
-
if Display: print("\t\t Efficiency of double events: ", round(pA_single*pB_single+pB_single*pC_single+pA_single*pC_single-2*pA_single*pB_single*pC_single,5))
|
|
960
|
-
if Display: print("\t\t Efficiency of triple events: ", round(pA_single*pB_single*pC_single,5))
|
|
961
|
-
if Display: print("\t Summary of TDCR measurement (delayed)")
|
|
962
|
-
if Display: print("\t\t Efficiency of single events: ", round(pA_single2+pB_single2+pC_single2-pA_single2*pB_single2+pB_single2*pC_single2+pA_single2*pC_single2-2*pA_single2*pB_single2*pC_single2-pA_single2*pB_single2*pC_single2,5))
|
|
963
|
-
if Display: print("\t\t Efficiency of double events: ", round(pA_single2*pB_single2+pB_single2*pC_single2+pA_single2*pC_single2-2*pA_single2*pB_single2*pC_single2,5))
|
|
964
|
-
if Display: print("\t\t Efficiency of triple events: ", round(efficiency_S[-1],5))
|
|
965
|
-
else:
|
|
966
|
-
pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
967
|
-
pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
|
|
968
|
-
pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
969
|
-
pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
|
|
970
|
-
pC_nosingle = np.exp(-L[2]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
971
|
-
pC_single = 1-pC_nosingle # probability to have at least 1 electrons in a PMT
|
|
972
|
-
|
|
973
|
-
efficiency_A2.append(pA_single)
|
|
974
|
-
efficiency_B2.append(pB_single)
|
|
975
|
-
efficiency_AB.append(pA_single*pB_single)
|
|
976
|
-
efficiency_BC.append(pB_single*pC_single)
|
|
977
|
-
efficiency_AC.append(pA_single*pC_single)
|
|
978
|
-
efficiency_T.append(pA_single*pB_single*pC_single)
|
|
979
|
-
efficiency_D.append(efficiency_AB[-1]+efficiency_BC[-1]+efficiency_AC[-1]-2*efficiency_T[-1])
|
|
980
|
-
efficiency_S.append(1-pA_nosingle*pB_nosingle*pC_nosingle)
|
|
981
|
-
efficiency_D2.append(pA_single*pB_single)
|
|
982
|
-
if Display: print(f"\n\t COUNTING--Asym \n\t\t Free parameters (A,B,C) = {L[0]},{L[1]},{L[2]} keV-1 \n\t Summary of TDCR measurement (prompt)")
|
|
983
|
-
if Display: print("\t\t Free parameter PMT A: ", L[0], "keV-1")
|
|
984
|
-
if Display: print("\t\t Free parameter PMT B: ", L[1], "keV-1")
|
|
985
|
-
if Display: print("\t\t Free parameter PMT C: ", L[2], "keV-1")
|
|
986
|
-
if Display: print("\t\t Efficiency of single events: ", round(efficiency_S[-1],5))
|
|
987
|
-
if Display: print("\t\t Efficiency of double events: ", round(efficiency_D[-1],5))
|
|
988
|
-
if Display: print("\t\t Efficiency of triple events: ", round(efficiency_T[-1],5))
|
|
961
|
+
'''
|
|
962
|
+
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, symm, extDT, measTime)
|
|
964
|
+
efficiency_S.append(efficiency0_S)
|
|
965
|
+
efficiency_T.append(efficiency0_T)
|
|
966
|
+
efficiency_D.append(efficiency0_D)
|
|
967
|
+
efficiency_D2.append(efficiency0_D2)
|
|
968
|
+
|
|
989
969
|
|
|
990
970
|
"""
|
|
991
971
|
==========================================================
|
|
@@ -994,9 +974,9 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
994
974
|
"""
|
|
995
975
|
if record:
|
|
996
976
|
with open(recfile4, "a") as file:
|
|
997
|
-
if
|
|
977
|
+
if symm:
|
|
998
978
|
file.write(f"{idec} {efficiency_S[-1]} {efficiency_D[-1]} {efficiency_T[-1]}\n")
|
|
999
|
-
|
|
979
|
+
else:
|
|
1000
980
|
file.write(f"{idec} {efficiency_S[-1]} {efficiency_D[-1]} {efficiency_T[-1]} {efficiency_AB[-1]} {efficiency_BC[-1]} {efficiency_AC[-1]}\n")
|
|
1001
981
|
|
|
1002
982
|
'''
|
|
@@ -1004,22 +984,11 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
1004
984
|
VI. CALCULATION OF THE FINAL ESTIMATORS
|
|
1005
985
|
====================
|
|
1006
986
|
'''
|
|
1007
|
-
mean_efficiency_T =
|
|
1008
|
-
std_efficiency_T = np.std(efficiency_T)/np.sqrt(N) # standard deviation
|
|
1009
|
-
std_efficiency_T = np.sqrt(std_efficiency_T**2+1e-8) # combined with uncertainty due to quenching calculation
|
|
1010
|
-
mean_efficiency_D = np.mean(efficiency_D)
|
|
1011
|
-
std_efficiency_D = np.std(efficiency_D)/np.sqrt(N)
|
|
1012
|
-
std_efficiency_D = np.sqrt(std_efficiency_D**2+1e-8)
|
|
1013
|
-
mean_efficiency_D2 = np.mean(efficiency_D2)
|
|
1014
|
-
std_efficiency_D2 = np.std(efficiency_D2)/np.sqrt(N)
|
|
1015
|
-
std_efficiency_D2 = np.sqrt(std_efficiency_D2**2+1e-8)
|
|
1016
|
-
mean_efficiency_S = np.mean(efficiency_S)
|
|
1017
|
-
std_efficiency_S = np.std(efficiency_S)/np.sqrt(N)
|
|
1018
|
-
std_efficiency_S = np.sqrt(std_efficiency_S**2+1e-8)
|
|
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)
|
|
1019
988
|
|
|
1020
|
-
if
|
|
989
|
+
if symm:
|
|
1021
990
|
TDCR_calcul = mean_efficiency_T/mean_efficiency_D
|
|
1022
|
-
|
|
991
|
+
else:
|
|
1023
992
|
mean_efficiency_AB = np.mean(efficiency_AB)
|
|
1024
993
|
std_efficiency_AB = np.std(efficiency_AB)/np.sqrt(N)
|
|
1025
994
|
mean_efficiency_BC = np.mean(efficiency_BC)
|
|
@@ -1031,25 +1000,15 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
1031
1000
|
TBCmodel = mean_efficiency_T/mean_efficiency_BC
|
|
1032
1001
|
TACmodel = mean_efficiency_T/mean_efficiency_AC
|
|
1033
1002
|
|
|
1034
|
-
if
|
|
1003
|
+
if symm:
|
|
1035
1004
|
res=(TDCR_calcul-TD)**2
|
|
1036
|
-
|
|
1005
|
+
else:
|
|
1037
1006
|
res=(TAB-TABmodel)**2+(TBC-TBCmodel)**2+(TAC-TACmodel)**2
|
|
1038
1007
|
|
|
1039
1008
|
if mode == "res":
|
|
1040
1009
|
return res
|
|
1041
1010
|
if mode == "eff":
|
|
1042
|
-
|
|
1043
|
-
print("Warning. too low number of MC trials - inaccurate estimation")
|
|
1044
|
-
if syst == "TDCR":
|
|
1045
|
-
return mean_efficiency_S, 1, mean_efficiency_D, 1, mean_efficiency_T, 1
|
|
1046
|
-
elif syst =="CN":
|
|
1047
|
-
return mean_efficiency_D2, 1
|
|
1048
|
-
else:
|
|
1049
|
-
if syst == "TDCR":
|
|
1050
|
-
return mean_efficiency_S, std_efficiency_S, mean_efficiency_D, std_efficiency_D, mean_efficiency_T, std_efficiency_T
|
|
1051
|
-
elif syst =="CN":
|
|
1052
|
-
return mean_efficiency_D2, std_efficiency_D2
|
|
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
|
|
1053
1012
|
if mode =="dis":
|
|
1054
1013
|
return efficiency_S, efficiency_D, efficiency_T, efficiency_D2
|
|
1055
1014
|
|
|
@@ -1075,17 +1034,21 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
1075
1034
|
# TAB = 0.992232838598821
|
|
1076
1035
|
# TBC = 0.992343419459002
|
|
1077
1036
|
# TAC = 0.99275350064608
|
|
1078
|
-
# Rad="
|
|
1037
|
+
# Rad="Co-60"
|
|
1079
1038
|
# pmf_1="1"
|
|
1080
|
-
# N =
|
|
1039
|
+
# N = 5
|
|
1081
1040
|
# kB =1.0e-5
|
|
1082
1041
|
# V = 10
|
|
1083
1042
|
# mode = "eff"
|
|
1084
|
-
# mode2 = "sym"
|
|
1085
1043
|
|
|
1086
|
-
# # out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=True, barp=False,uncData=False)
|
|
1087
|
-
# # print("TDCR", out[4]/out[2])
|
|
1088
|
-
# # print("Eff D", out[2])
|
|
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
|
+
|
|
1089
1048
|
|
|
1049
|
+
# # # out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, 20, kB, V, mode, mode2, Display=True, barp=False, Smodel=True, syst = "TDCR", record = "phf1", uncData=False)
|
|
1090
1050
|
|
|
1091
|
-
# out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1,
|
|
1051
|
+
# out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, symm=True, Display = False, record = True, readRecHist = False)
|
|
1052
|
+
# print("result", out)
|
|
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)
|
tdcrpy/TDCR_model_lib.py
CHANGED
|
@@ -2624,7 +2624,7 @@ def relaxation_atom_ph(lacune,element,v):
|
|
|
2624
2624
|
|
|
2625
2625
|
|
|
2626
2626
|
|
|
2627
|
-
def modelAnalytical(L,TD,TAB,TBC,TAC,rad,kB,V,mode,
|
|
2627
|
+
def modelAnalytical(L,TD,TAB,TBC,TAC,rad,kB,V,mode,symm,ne):
|
|
2628
2628
|
"""
|
|
2629
2629
|
TDCR analytical model that is used for pure beta emitting radionuclides
|
|
2630
2630
|
|
|
@@ -2648,8 +2648,8 @@ def modelAnalytical(L,TD,TAB,TBC,TAC,rad,kB,V,mode,mode2,ne):
|
|
|
2648
2648
|
volume of the scintillator in ml. run only for 10 ml
|
|
2649
2649
|
mode : string
|
|
2650
2650
|
"res" to return the residual, "eff" to return efficiencies.
|
|
2651
|
-
|
|
2652
|
-
"
|
|
2651
|
+
symm : boolean
|
|
2652
|
+
"True" for symetrical model, "False" for symetrical model.
|
|
2653
2653
|
nE : integer
|
|
2654
2654
|
Number of bins for the quenching function.
|
|
2655
2655
|
|
|
@@ -2675,14 +2675,13 @@ def modelAnalytical(L,TD,TAB,TBC,TAC,rad,kB,V,mode,mode2,ne):
|
|
|
2675
2675
|
em[i] = Em_e(ei*1e3,ei*1e3,kB*1e3,ne)*1e-3
|
|
2676
2676
|
|
|
2677
2677
|
|
|
2678
|
-
if
|
|
2678
|
+
if symm:
|
|
2679
2679
|
eff_S = sum(p*(1-np.exp(-L*em/3)))
|
|
2680
2680
|
eff_T = sum(p*(1-np.exp(-L*em/3))**3)
|
|
2681
2681
|
eff_D = sum(p*(3*(1-np.exp(-L*em/3))**2-2*(1-np.exp(-L*em/3))**3))
|
|
2682
2682
|
TDCR_calcul=eff_T/eff_D
|
|
2683
2683
|
res=(TDCR_calcul-TD)**2
|
|
2684
|
-
|
|
2685
|
-
if mode2=="asym":
|
|
2684
|
+
else:
|
|
2686
2685
|
# eff_A = sum(p*(1-np.exp(-L[0]*em/3)))
|
|
2687
2686
|
# eff_B = sum(p*(1-np.exp(-L[1]*em/3)))
|
|
2688
2687
|
# eff_C = sum(p*(1-np.exp(-L[2]*em/3)))
|
|
@@ -2830,7 +2829,122 @@ def buildBetaSpectra(rad, V, N, prt=False):
|
|
|
2830
2829
|
else: file.write(f"{b}\t{p2[i]}\n")
|
|
2831
2830
|
print("file written in local")
|
|
2832
2831
|
|
|
2832
|
+
def detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, symm, extDT, measTime):
|
|
2833
|
+
if symm:
|
|
2834
|
+
# print(evenement !=1, t1 > extDT*1e-6, t1 < measTime*60)
|
|
2835
|
+
if evenement !=1 and t1 > extDT*1e-6 and t1 < measTime*60:
|
|
2836
|
+
# TDCR
|
|
2837
|
+
p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2838
|
+
p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
|
|
2839
|
+
p_nosingle2 = np.exp(-L*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
2840
|
+
p_single2 = 1-p_nosingle2
|
|
2841
|
+
efficiency0_S = 1-p_nosingle**3+1-p_nosingle2**3
|
|
2842
|
+
efficiency0_T = p_single**3+p_single2**3
|
|
2843
|
+
efficiency0_D = 3*(p_single)**2-2*p_single**3+(3*(p_single2)**2-2*p_single2**3)
|
|
2844
|
+
|
|
2845
|
+
# CN
|
|
2846
|
+
p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2847
|
+
p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
|
|
2848
|
+
p_nosingle2 = np.exp(-L*np.sum(np.asarray(e_quenching2))/2) # probability to have 0 electrons in a PMT
|
|
2849
|
+
p_single2 = 1-p_nosingle2
|
|
2850
|
+
efficiency0_D2 = p_single**2+p_single2**2
|
|
2851
|
+
else:
|
|
2852
|
+
# TDCR
|
|
2853
|
+
p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2854
|
+
p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
|
|
2855
|
+
efficiency0_S = 1-p_nosingle**3
|
|
2856
|
+
efficiency0_T = p_single**3
|
|
2857
|
+
efficiency0_D = 3*(p_single)**2-2*efficiency0_T
|
|
2858
|
+
|
|
2859
|
+
# CN
|
|
2860
|
+
p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2861
|
+
p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
|
|
2862
|
+
efficiency0_D2 = p_single**2
|
|
2863
|
+
|
|
2864
|
+
|
|
2865
|
+
else:
|
|
2866
|
+
if evenement !=1 and t1 > extDT*1e-6 and t1 < measTime*60:
|
|
2867
|
+
# TDCR
|
|
2868
|
+
pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2869
|
+
pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
|
|
2870
|
+
pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2871
|
+
pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
|
|
2872
|
+
pC_nosingle = np.exp(-L[2]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2873
|
+
pC_single = 1-pC_nosingle # probability to have at least 1 electrons in a PMT
|
|
2874
|
+
|
|
2875
|
+
pA_nosingle2 = np.exp(-L[0]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
2876
|
+
pA_single2 = 1-pA_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
2877
|
+
pB_nosingle2 = np.exp(-L[1]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
2878
|
+
pB_single2 = 1-pB_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
2879
|
+
pC_nosingle2 = np.exp(-L[2]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
2880
|
+
pC_single2 = 1-pC_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
2881
|
+
|
|
2882
|
+
efficiency0_A2 = pA_single+pA_single2
|
|
2883
|
+
efficiency0_B2 = pB_single+pB_single2
|
|
2884
|
+
efficiency0_AB = pA_single*pB_single+pA_single2*pB_single2
|
|
2885
|
+
efficiency0_BC = pB_single*pC_single+pB_single2*pC_single2
|
|
2886
|
+
efficiency0_AC = pA_single*pC_single+pA_single2*pC_single2
|
|
2887
|
+
efficiency0_T = pA_single*pB_single*pC_single+pA_single2*pB_single2*pC_single2
|
|
2888
|
+
efficiency0_D = pA_single*pB_single+pB_single*pC_single+pA_single*pC_single-2*pA_single*pB_single*pC_single+(pA_single2*pB_single2+pB_single2*pC_single2+pA_single2*pC_single2-2*pA_single2*pB_single2*pC_single2)
|
|
2889
|
+
#efficiency_S = pA_single+pB_single+pC_single-pA_single*pB_single+pB_single*pC_single+pA_single*pC_single-2*pA_single*pB_single*pC_single-pA_single*pB_single*pC_single+(pA_single2+pB_single2+pC_single2-pA_single2*pB_single2+pB_single2*pC_single2+pA_single2*pC_single2-2*pA_single2*pB_single2*pC_single2-pA_single2*pB_single2*pC_single2)
|
|
2890
|
+
efficiency0_S = 1-pA_nosingle*pB_nosingle*pC_nosingle+1-pA_nosingle2*pB_nosingle2*pC_nosingle2
|
|
2891
|
+
|
|
2892
|
+
|
|
2893
|
+
# CN
|
|
2894
|
+
pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2895
|
+
pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
|
|
2896
|
+
pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2897
|
+
pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
|
|
2898
|
+
|
|
2899
|
+
pA_nosingle2 = np.exp(-L[0]*np.sum(np.asarray(e_quenching2))/2) # probability to have 0 electrons in a PMT
|
|
2900
|
+
pA_single2 = 1-pA_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
2901
|
+
pB_nosingle2 = np.exp(-L[1]*np.sum(np.asarray(e_quenching2))/2) # probability to have 0 electrons in a PMT
|
|
2902
|
+
pB_single2 = 1-pB_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
2903
|
+
|
|
2904
|
+
efficiency0_D2 = pA_single*pB_single+pA_single2*pB_single2
|
|
2905
|
+
else:
|
|
2906
|
+
# TDCR
|
|
2907
|
+
pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2908
|
+
pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
|
|
2909
|
+
pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2910
|
+
pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
|
|
2911
|
+
pC_nosingle = np.exp(-L[2]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2912
|
+
pC_single = 1-pC_nosingle # probability to have at least 1 electrons in a PMT
|
|
2833
2913
|
|
|
2914
|
+
efficiency0_A2 = pA_single
|
|
2915
|
+
efficiency0_B2 = pB_single
|
|
2916
|
+
efficiency0_AB = pA_single*pB_single
|
|
2917
|
+
efficiency0_BC = pB_single*pC_single
|
|
2918
|
+
efficiency0_AC = pA_single*pC_single
|
|
2919
|
+
efficiency0_T = pA_single*pB_single*pC_single
|
|
2920
|
+
efficiency0_D = efficiency0_AB+efficiency0_BC+efficiency0_AC-2*efficiency0_T
|
|
2921
|
+
efficiency0_S = 1-pA_nosingle*pB_nosingle*pC_nosingle
|
|
2922
|
+
|
|
2923
|
+
# CN
|
|
2924
|
+
pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2925
|
+
pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
|
|
2926
|
+
pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2927
|
+
pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
|
|
2928
|
+
efficiency0_D2 = pA_single*pB_single
|
|
2929
|
+
|
|
2930
|
+
return efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2
|
|
2931
|
+
|
|
2932
|
+
|
|
2933
|
+
def efficienciesEstimates(efficiency_S, efficiency_D, efficiency_T, efficiency_D2,N):
|
|
2934
|
+
mean_efficiency_T = np.mean(efficiency_T) # average
|
|
2935
|
+
std_efficiency_T = np.std(efficiency_T)/np.sqrt(N) # standard deviation
|
|
2936
|
+
mean_efficiency_D = np.mean(efficiency_D)
|
|
2937
|
+
std_efficiency_D = np.std(efficiency_D)/np.sqrt(N)
|
|
2938
|
+
mean_efficiency_D2 = np.mean(efficiency_D2)
|
|
2939
|
+
std_efficiency_D2 = np.std(efficiency_D2)/np.sqrt(N)
|
|
2940
|
+
mean_efficiency_S = np.mean(efficiency_S)
|
|
2941
|
+
std_efficiency_S = np.std(efficiency_S)/np.sqrt(N)
|
|
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
|
|
2943
|
+
|
|
2944
|
+
|
|
2945
|
+
|
|
2946
|
+
|
|
2947
|
+
|
|
2834
2948
|
# N = 1e7
|
|
2835
2949
|
# buildBetaSpectra('H-3', 16, N, prt=True); print('H-3 - done')
|
|
2836
2950
|
# buildBetaSpectra('C-14', 16, N, prt=True); print('C-14 - done')
|
|
File without changes
|
|
File without changes
|