TDCRPy 1.12.15__py3-none-any.whl → 1.13.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.12.15.dist-info → TDCRPy-1.13.0.dist-info}/METADATA +1 -1
- {TDCRPy-1.12.15.dist-info → TDCRPy-1.13.0.dist-info}/RECORD +7 -7
- {TDCRPy-1.12.15.dist-info → TDCRPy-1.13.0.dist-info}/WHEEL +1 -1
- tdcrpy/TDCRPy.py +213 -133
- tdcrpy/TDCR_model_lib.py +115 -0
- {TDCRPy-1.12.15.dist-info → TDCRPy-1.13.0.dist-info}/LICENCE.md +0 -0
- {TDCRPy-1.12.15.dist-info → TDCRPy-1.13.0.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
tdcrpy/TDCRPy.py,sha256=
|
|
1
|
+
tdcrpy/TDCRPy.py,sha256=i16smPjN2GhbMfhdnTYNXwnyM0rncCszxjK5XCASPh0,69480
|
|
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=GLxnYEmB-U-kIsrSwwvawKsltbMyOZESiE_DdRodxjQ,119180
|
|
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.0.dist-info/LICENCE.md,sha256=ZTpWyGU3qv_iwEpgvCijoCuCYpOPpyzJCgOk46WpUKU,1066
|
|
1085
|
+
TDCRPy-1.13.0.dist-info/METADATA,sha256=369qvRM9JVEZlkH7YAB5j-DzZG8rmVnUVBQCp7QfVzY,15832
|
|
1086
|
+
TDCRPy-1.13.0.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
|
|
1087
|
+
TDCRPy-1.13.0.dist-info/top_level.txt,sha256=f4vzFFcKSEnonAACs0ZXuRczmroLLqtPTqXFymU_VU0,14
|
|
1088
|
+
TDCRPy-1.13.0.dist-info/RECORD,,
|
tdcrpy/TDCRPy.py
CHANGED
|
@@ -83,7 +83,7 @@ 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 TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=False, barp=False, Smodel=True, syst = "TDCR", record = False, uncData=False):
|
|
86
|
+
def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=False, barp=False, Smodel=True, syst = "TDCR", record = False, readRecHist = False, uncData=False):
|
|
87
87
|
"""
|
|
88
88
|
This is the main function of the TDCRPy package running the Monte-Carlo Triple-to-Double Coincidence Ratio model.
|
|
89
89
|
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.
|
|
@@ -241,7 +241,85 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
241
241
|
return out
|
|
242
242
|
if mode == "eff":
|
|
243
243
|
return out[0], 0, out[1], 0, out[2], 0
|
|
244
|
+
|
|
245
|
+
elif readRecHist:
|
|
246
|
+
efficiency_A2 = []
|
|
247
|
+
efficiency_B2 = []
|
|
248
|
+
efficiency_S = []
|
|
249
|
+
efficiency_D = []
|
|
250
|
+
efficiency_D2 = []
|
|
251
|
+
efficiency_T = []
|
|
252
|
+
efficiency_AB = []
|
|
253
|
+
efficiency_BC = []
|
|
254
|
+
efficiency_AC = []
|
|
255
|
+
|
|
256
|
+
temp_dir = tempfile.gettempdir()
|
|
257
|
+
recfile3 = os.path.join(temp_dir, "Temp_E2.txt")
|
|
258
|
+
|
|
259
|
+
with open(recfile3, "r") as file:
|
|
260
|
+
|
|
261
|
+
decaym = -1
|
|
262
|
+
e_quenching = []; e_quenching2 = []; evenement=1; t1=0
|
|
263
|
+
for line in file:
|
|
264
|
+
if line[0] != "#":
|
|
265
|
+
line = line.split(' ')
|
|
266
|
+
line = [element for element in line if element != ""]
|
|
267
|
+
decay = int(line[2])
|
|
268
|
+
|
|
269
|
+
if decay != decaym:
|
|
270
|
+
if decay>0:
|
|
271
|
+
# print(decay-1,e_quenching,e_quenching2, evenement)
|
|
272
|
+
efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, mode2, extDT, measTime)
|
|
273
|
+
efficiency_S.append(efficiency0_S)
|
|
274
|
+
efficiency_T.append(efficiency0_T)
|
|
275
|
+
efficiency_D.append(efficiency0_D)
|
|
276
|
+
efficiency_D2.append(efficiency0_D2)
|
|
277
|
+
|
|
278
|
+
# print(efficiency0_D, "\n")
|
|
279
|
+
|
|
280
|
+
energy = float(line[1])*1e-3
|
|
281
|
+
t1 = float(line[4])
|
|
282
|
+
decaym = decay
|
|
283
|
+
# print(decay, energy, t1, extDT)
|
|
284
|
+
e_quenching = []; e_quenching2 = []
|
|
285
|
+
evenement=1
|
|
286
|
+
e_quenching.append(energy)
|
|
287
|
+
else:
|
|
288
|
+
energy = float(line[1])*1e-3
|
|
289
|
+
t1 = float(line[4])
|
|
290
|
+
# print(decay, energy, t1, extDT)
|
|
291
|
+
if t1 > tau*1e-9:
|
|
292
|
+
evenement = evenement + 1
|
|
293
|
+
e_quenching2.append(energy)
|
|
294
|
+
else:
|
|
295
|
+
e_quenching.append(energy)
|
|
296
|
+
|
|
297
|
+
efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, mode2, extDT, measTime)
|
|
298
|
+
efficiency_S.append(efficiency0_S)
|
|
299
|
+
efficiency_T.append(efficiency0_T)
|
|
300
|
+
efficiency_D.append(efficiency0_D)
|
|
301
|
+
efficiency_D2.append(efficiency0_D2)
|
|
302
|
+
|
|
303
|
+
# print(efficiency_D)
|
|
304
|
+
outEff = tl.efficienciesEstimates(efficiency_S, efficiency_D, efficiency_T, efficiency_D2, N)
|
|
305
|
+
return outEff
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
# temp1, temp2, temp3, temp4 = tl.read_temp_files()
|
|
309
|
+
# ee_vec = tl.energyVectors3(temp3)
|
|
310
|
+
# # to be continued
|
|
311
|
+
|
|
244
312
|
else:
|
|
313
|
+
efficiency_A2 = []
|
|
314
|
+
efficiency_B2 = []
|
|
315
|
+
efficiency_S = []
|
|
316
|
+
efficiency_D = []
|
|
317
|
+
efficiency_D2 = []
|
|
318
|
+
efficiency_T = []
|
|
319
|
+
efficiency_AB = []
|
|
320
|
+
efficiency_BC = []
|
|
321
|
+
efficiency_AC = []
|
|
322
|
+
|
|
245
323
|
nE_electron = config["Inputs"].getint("nE_electron")
|
|
246
324
|
nE_alpha = config["Inputs"].getint("nE_alpha")
|
|
247
325
|
Rad=Rad.replace(" ","")
|
|
@@ -295,18 +373,7 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
295
373
|
u_prob_trans.append(out_PenNuc[16])
|
|
296
374
|
trans_halfLife.append(out_PenNuc[15])
|
|
297
375
|
# 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
|
-
|
|
376
|
+
|
|
310
377
|
if barp and not Display: NN = tqdm(range(N), desc="Processing", unit=" decays")
|
|
311
378
|
else: NN = range(N)
|
|
312
379
|
for idec in NN: # Main Loop - Monte Carlo trials
|
|
@@ -888,104 +955,113 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
888
955
|
====================
|
|
889
956
|
V. LE MESURE TDCR
|
|
890
957
|
====================
|
|
891
|
-
'''
|
|
892
|
-
if
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
958
|
+
'''
|
|
959
|
+
if evenement == 1: e_quenching2 = 0; t1=0
|
|
960
|
+
efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, mode2, extDT, measTime)
|
|
961
|
+
efficiency_S.append(efficiency0_S)
|
|
962
|
+
efficiency_T.append(efficiency0_T)
|
|
963
|
+
efficiency_D.append(efficiency0_D)
|
|
964
|
+
efficiency_D2.append(efficiency0_D2)
|
|
965
|
+
# print(e_quenching,efficiency0_D)
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
# if mode2=="sym":
|
|
969
|
+
# if evenement !=1 and t1 > extDT*1e-6 and t1 < measTime*60:
|
|
970
|
+
# p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
971
|
+
# p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
|
|
972
|
+
# p_nosingle2 = np.exp(-L*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
973
|
+
# p_single2 = 1-p_nosingle2
|
|
974
|
+
# efficiency_S.append(1-p_nosingle**3+1-p_nosingle2**3)
|
|
975
|
+
# efficiency_T.append(p_single**3+p_single2**3)
|
|
976
|
+
# efficiency_D.append(3*(p_single)**2-2*p_single**3+(3*(p_single2)**2-2*p_single2**3))
|
|
977
|
+
# efficiency_D2.append(p_single**2+p_single2**2)
|
|
978
|
+
# if Display: print(f"\n\t COUNTING--Sym \n\t\t Free parameter = {L} keV-1 \n\t Summary of TDCR measurement (prompt)")
|
|
979
|
+
# if Display: print("\t\t Free parameter = ", L, "keV-1")
|
|
980
|
+
# if Display: print("\t\t Efficiency of single events = ", round(1-p_nosingle**3,5))
|
|
981
|
+
# if Display: print("\t\t Efficiency of double events = ", round(3*(p_single)**2-2*p_single**3,5))
|
|
982
|
+
# if Display: print("\t\t Efficiency of triple events = ", round(p_single**3,5))
|
|
983
|
+
# if Display: print("\t Summary of TDCR measurement (delayed)")
|
|
984
|
+
# if Display: print("\t\t Efficiency of single events = ", round(1-p_nosingle2**3,5))
|
|
985
|
+
# if Display: print("\t\t Efficiency of double events = ", round(3*(p_single2)**2-2*p_single2**3,5))
|
|
986
|
+
# if Display: print("\t\t Efficiency of triple events = ", round(p_single2**3,5))
|
|
987
|
+
# if Display: print("\t Summary of TDCR measurement (prompt + delayed)")
|
|
988
|
+
# if Display: print("\t\t Efficiency of single events = ", round(1-p_nosingle**3+1-p_nosingle2**3,5))
|
|
989
|
+
# 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))
|
|
990
|
+
# if Display: print("\t\t Efficiency of triple events = ", round(p_single**3+p_single2**3,5))
|
|
991
|
+
# else:
|
|
992
|
+
# p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
993
|
+
# p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
|
|
994
|
+
# efficiency_S.append(1-p_nosingle**3)
|
|
995
|
+
# efficiency_T.append(p_single**3)
|
|
996
|
+
# efficiency_D.append(3*(p_single)**2-2*efficiency_T[-1])
|
|
997
|
+
# efficiency_D2.append(p_single**2)
|
|
998
|
+
# if Display: print(f"\n\t COUNTING--Sym \n\t\t Free parameter = {L} keV-1 \n\t Summary of TDCR measurement (prompt)")
|
|
999
|
+
# if Display: print("\t\t Efficiency of single events = ", round(efficiency_S[-1],5))
|
|
1000
|
+
# if Display: print("\t\t Efficiency of double events = ", round(efficiency_D[-1],5))
|
|
1001
|
+
# if Display: print("\t\t Efficiency of triple events = ", round(efficiency_T[-1],5))
|
|
926
1002
|
|
|
927
|
-
elif mode2=="asym":
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1003
|
+
# elif mode2=="asym":
|
|
1004
|
+
# if evenement !=1 and t1 > extDT*1e-6 and t1 < measTime*60:
|
|
1005
|
+
# pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
1006
|
+
# pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
|
|
1007
|
+
# pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
1008
|
+
# pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
|
|
1009
|
+
# pC_nosingle = np.exp(-L[2]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
1010
|
+
# pC_single = 1-pC_nosingle # probability to have at least 1 electrons in a PMT
|
|
935
1011
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1012
|
+
# pA_nosingle2 = np.exp(-L[0]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
1013
|
+
# pA_single2 = 1-pA_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
1014
|
+
# pB_nosingle2 = np.exp(-L[1]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
1015
|
+
# pB_single2 = 1-pB_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
1016
|
+
# pC_nosingle2 = np.exp(-L[2]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
1017
|
+
# pC_single2 = 1-pC_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
942
1018
|
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1019
|
+
# efficiency_A2.append(pA_single+pA_single2)
|
|
1020
|
+
# efficiency_B2.append(pB_single+pB_single2)
|
|
1021
|
+
# efficiency_AB.append(pA_single*pB_single+pA_single2*pB_single2)
|
|
1022
|
+
# efficiency_BC.append(pB_single*pC_single+pB_single2*pC_single2)
|
|
1023
|
+
# efficiency_AC.append(pA_single*pC_single+pA_single2*pC_single2)
|
|
1024
|
+
# efficiency_T.append(pA_single*pB_single*pC_single+pA_single2*pB_single2*pC_single2)
|
|
1025
|
+
# 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))
|
|
1026
|
+
# #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))
|
|
1027
|
+
# efficiency_S.append(1-pA_nosingle*pB_nosingle*pC_nosingle+1-pA_nosingle2*pB_nosingle2*pC_nosingle2)
|
|
1028
|
+
# efficiency_D2.append(pA_single*pB_single+pA_single2*pB_single2)
|
|
953
1029
|
|
|
954
1030
|
|
|
955
1031
|
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1032
|
+
# 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)")
|
|
1033
|
+
# #if Display: print("\t Summary of TDCR measurement (prompt)")
|
|
1034
|
+
# 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))
|
|
1035
|
+
# 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))
|
|
1036
|
+
# if Display: print("\t\t Efficiency of triple events: ", round(pA_single*pB_single*pC_single,5))
|
|
1037
|
+
# if Display: print("\t Summary of TDCR measurement (delayed)")
|
|
1038
|
+
# 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))
|
|
1039
|
+
# 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))
|
|
1040
|
+
# if Display: print("\t\t Efficiency of triple events: ", round(efficiency_S[-1],5))
|
|
1041
|
+
# else:
|
|
1042
|
+
# pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
1043
|
+
# pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
|
|
1044
|
+
# pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
1045
|
+
# pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
|
|
1046
|
+
# pC_nosingle = np.exp(-L[2]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
1047
|
+
# pC_single = 1-pC_nosingle # probability to have at least 1 electrons in a PMT
|
|
972
1048
|
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1049
|
+
# efficiency_A2.append(pA_single)
|
|
1050
|
+
# efficiency_B2.append(pB_single)
|
|
1051
|
+
# efficiency_AB.append(pA_single*pB_single)
|
|
1052
|
+
# efficiency_BC.append(pB_single*pC_single)
|
|
1053
|
+
# efficiency_AC.append(pA_single*pC_single)
|
|
1054
|
+
# efficiency_T.append(pA_single*pB_single*pC_single)
|
|
1055
|
+
# efficiency_D.append(efficiency_AB[-1]+efficiency_BC[-1]+efficiency_AC[-1]-2*efficiency_T[-1])
|
|
1056
|
+
# efficiency_S.append(1-pA_nosingle*pB_nosingle*pC_nosingle)
|
|
1057
|
+
# efficiency_D2.append(pA_single*pB_single)
|
|
1058
|
+
# 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)")
|
|
1059
|
+
# if Display: print("\t\t Free parameter PMT A: ", L[0], "keV-1")
|
|
1060
|
+
# if Display: print("\t\t Free parameter PMT B: ", L[1], "keV-1")
|
|
1061
|
+
# if Display: print("\t\t Free parameter PMT C: ", L[2], "keV-1")
|
|
1062
|
+
# if Display: print("\t\t Efficiency of single events: ", round(efficiency_S[-1],5))
|
|
1063
|
+
# if Display: print("\t\t Efficiency of double events: ", round(efficiency_D[-1],5))
|
|
1064
|
+
# if Display: print("\t\t Efficiency of triple events: ", round(efficiency_T[-1],5))
|
|
989
1065
|
|
|
990
1066
|
"""
|
|
991
1067
|
==========================================================
|
|
@@ -1004,18 +1080,20 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
1004
1080
|
VI. CALCULATION OF THE FINAL ESTIMATORS
|
|
1005
1081
|
====================
|
|
1006
1082
|
'''
|
|
1007
|
-
mean_efficiency_T =
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1083
|
+
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)
|
|
1084
|
+
|
|
1085
|
+
# mean_efficiency_T = np.mean(efficiency_T) # average
|
|
1086
|
+
# std_efficiency_T = np.std(efficiency_T)/np.sqrt(N) # standard deviation
|
|
1087
|
+
# std_efficiency_T = np.sqrt(std_efficiency_T**2+1e-8) # combined with uncertainty due to quenching calculation
|
|
1088
|
+
# mean_efficiency_D = np.mean(efficiency_D)
|
|
1089
|
+
# std_efficiency_D = np.std(efficiency_D)/np.sqrt(N)
|
|
1090
|
+
# std_efficiency_D = np.sqrt(std_efficiency_D**2+1e-8)
|
|
1091
|
+
# mean_efficiency_D2 = np.mean(efficiency_D2)
|
|
1092
|
+
# std_efficiency_D2 = np.std(efficiency_D2)/np.sqrt(N)
|
|
1093
|
+
# std_efficiency_D2 = np.sqrt(std_efficiency_D2**2+1e-8)
|
|
1094
|
+
# mean_efficiency_S = np.mean(efficiency_S)
|
|
1095
|
+
# std_efficiency_S = np.std(efficiency_S)/np.sqrt(N)
|
|
1096
|
+
# std_efficiency_S = np.sqrt(std_efficiency_S**2+1e-8)
|
|
1019
1097
|
|
|
1020
1098
|
if mode2=="sym":
|
|
1021
1099
|
TDCR_calcul = mean_efficiency_T/mean_efficiency_D
|
|
@@ -1039,17 +1117,14 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
1039
1117
|
if mode == "res":
|
|
1040
1118
|
return res
|
|
1041
1119
|
if mode == "eff":
|
|
1042
|
-
if N<200:
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
else:
|
|
1049
|
-
|
|
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
|
|
1120
|
+
# if N<200:
|
|
1121
|
+
# print("Warning. too low number of MC trials - inaccurate estimation")
|
|
1122
|
+
# if syst == "TDCR":
|
|
1123
|
+
# return mean_efficiency_S, 1, mean_efficiency_D, 1, mean_efficiency_T, 1
|
|
1124
|
+
# elif syst =="CN":
|
|
1125
|
+
# return mean_efficiency_D2, 1
|
|
1126
|
+
# else:
|
|
1127
|
+
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
1128
|
if mode =="dis":
|
|
1054
1129
|
return efficiency_S, efficiency_D, efficiency_T, efficiency_D2
|
|
1055
1130
|
|
|
@@ -1075,17 +1150,22 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
|
|
|
1075
1150
|
# TAB = 0.992232838598821
|
|
1076
1151
|
# TBC = 0.992343419459002
|
|
1077
1152
|
# TAC = 0.99275350064608
|
|
1078
|
-
# Rad="
|
|
1153
|
+
# Rad="Co-60"
|
|
1079
1154
|
# pmf_1="1"
|
|
1080
|
-
# N =
|
|
1155
|
+
# N = 5
|
|
1081
1156
|
# kB =1.0e-5
|
|
1082
1157
|
# V = 10
|
|
1083
1158
|
# mode = "eff"
|
|
1084
1159
|
# mode2 = "sym"
|
|
1085
1160
|
|
|
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])
|
|
1161
|
+
# # # out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=True, barp=False,uncData=False)
|
|
1162
|
+
# # # print("TDCR", out[4]/out[2])
|
|
1163
|
+
# # # print("Eff D", out[2])
|
|
1164
|
+
|
|
1089
1165
|
|
|
1166
|
+
# # 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
1167
|
|
|
1091
|
-
# out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1,
|
|
1168
|
+
# out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display = False, record = True, readRecHist = False)
|
|
1169
|
+
# print("result", out)
|
|
1170
|
+
# out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display = False, record = False, readRecHist = True)
|
|
1171
|
+
# print("result", out)
|
tdcrpy/TDCR_model_lib.py
CHANGED
|
@@ -2830,7 +2830,122 @@ def buildBetaSpectra(rad, V, N, prt=False):
|
|
|
2830
2830
|
else: file.write(f"{b}\t{p2[i]}\n")
|
|
2831
2831
|
print("file written in local")
|
|
2832
2832
|
|
|
2833
|
+
def detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, mode2, extDT, measTime):
|
|
2834
|
+
if mode2=="sym":
|
|
2835
|
+
# print(evenement !=1, t1 > extDT*1e-6, t1 < measTime*60)
|
|
2836
|
+
if evenement !=1 and t1 > extDT*1e-6 and t1 < measTime*60:
|
|
2837
|
+
# TDCR
|
|
2838
|
+
p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2839
|
+
p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
|
|
2840
|
+
p_nosingle2 = np.exp(-L*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
2841
|
+
p_single2 = 1-p_nosingle2
|
|
2842
|
+
efficiency0_S = 1-p_nosingle**3+1-p_nosingle2**3
|
|
2843
|
+
efficiency0_T = p_single**3+p_single2**3
|
|
2844
|
+
efficiency0_D = 3*(p_single)**2-2*p_single**3+(3*(p_single2)**2-2*p_single2**3)
|
|
2845
|
+
|
|
2846
|
+
# CN
|
|
2847
|
+
p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2848
|
+
p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
|
|
2849
|
+
p_nosingle2 = np.exp(-L*np.sum(np.asarray(e_quenching2))/2) # probability to have 0 electrons in a PMT
|
|
2850
|
+
p_single2 = 1-p_nosingle2
|
|
2851
|
+
efficiency0_D2 = p_single**2+p_single2**2
|
|
2852
|
+
else:
|
|
2853
|
+
# TDCR
|
|
2854
|
+
p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2855
|
+
p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
|
|
2856
|
+
efficiency0_S = 1-p_nosingle**3
|
|
2857
|
+
efficiency0_T = p_single**3
|
|
2858
|
+
efficiency0_D = 3*(p_single)**2-2*efficiency0_T
|
|
2859
|
+
|
|
2860
|
+
# CN
|
|
2861
|
+
p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2862
|
+
p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
|
|
2863
|
+
efficiency0_D2 = p_single**2
|
|
2864
|
+
|
|
2865
|
+
|
|
2866
|
+
elif mode2=="asym":
|
|
2867
|
+
if evenement !=1 and t1 > extDT*1e-6 and t1 < measTime*60:
|
|
2868
|
+
# TDCR
|
|
2869
|
+
pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2870
|
+
pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
|
|
2871
|
+
pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2872
|
+
pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
|
|
2873
|
+
pC_nosingle = np.exp(-L[2]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2874
|
+
pC_single = 1-pC_nosingle # probability to have at least 1 electrons in a PMT
|
|
2875
|
+
|
|
2876
|
+
pA_nosingle2 = np.exp(-L[0]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
2877
|
+
pA_single2 = 1-pA_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
2878
|
+
pB_nosingle2 = np.exp(-L[1]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
2879
|
+
pB_single2 = 1-pB_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
2880
|
+
pC_nosingle2 = np.exp(-L[2]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
|
|
2881
|
+
pC_single2 = 1-pC_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
2882
|
+
|
|
2883
|
+
efficiency0_A2 = pA_single+pA_single2
|
|
2884
|
+
efficiency0_B2 = pB_single+pB_single2
|
|
2885
|
+
efficiency0_AB = pA_single*pB_single+pA_single2*pB_single2
|
|
2886
|
+
efficiency0_BC = pB_single*pC_single+pB_single2*pC_single2
|
|
2887
|
+
efficiency0_AC = pA_single*pC_single+pA_single2*pC_single2
|
|
2888
|
+
efficiency0_T = pA_single*pB_single*pC_single+pA_single2*pB_single2*pC_single2
|
|
2889
|
+
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)
|
|
2890
|
+
#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)
|
|
2891
|
+
efficiency0_S = 1-pA_nosingle*pB_nosingle*pC_nosingle+1-pA_nosingle2*pB_nosingle2*pC_nosingle2
|
|
2892
|
+
|
|
2893
|
+
|
|
2894
|
+
# CN
|
|
2895
|
+
pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2896
|
+
pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
|
|
2897
|
+
pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2898
|
+
pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
|
|
2899
|
+
|
|
2900
|
+
pA_nosingle2 = np.exp(-L[0]*np.sum(np.asarray(e_quenching2))/2) # probability to have 0 electrons in a PMT
|
|
2901
|
+
pA_single2 = 1-pA_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
2902
|
+
pB_nosingle2 = np.exp(-L[1]*np.sum(np.asarray(e_quenching2))/2) # probability to have 0 electrons in a PMT
|
|
2903
|
+
pB_single2 = 1-pB_nosingle2 # probability to have at least 1 electrons in a PMT
|
|
2904
|
+
|
|
2905
|
+
efficiency0_D2 = pA_single*pB_single+pA_single2*pB_single2
|
|
2906
|
+
else:
|
|
2907
|
+
# TDCR
|
|
2908
|
+
pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2909
|
+
pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
|
|
2910
|
+
pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2911
|
+
pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
|
|
2912
|
+
pC_nosingle = np.exp(-L[2]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
|
|
2913
|
+
pC_single = 1-pC_nosingle # probability to have at least 1 electrons in a PMT
|
|
2833
2914
|
|
|
2915
|
+
efficiency0_A2 = pA_single
|
|
2916
|
+
efficiency0_B2 = pB_single
|
|
2917
|
+
efficiency0_AB = pA_single*pB_single
|
|
2918
|
+
efficiency0_BC = pB_single*pC_single
|
|
2919
|
+
efficiency0_AC = pA_single*pC_single
|
|
2920
|
+
efficiency0_T = pA_single*pB_single*pC_single
|
|
2921
|
+
efficiency0_D = efficiency0_AB+efficiency0_BC+efficiency0_AC-2*efficiency0_T
|
|
2922
|
+
efficiency0_S = 1-pA_nosingle*pB_nosingle*pC_nosingle
|
|
2923
|
+
|
|
2924
|
+
# CN
|
|
2925
|
+
pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2926
|
+
pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
|
|
2927
|
+
pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching))/2) # probability to have 0 electrons in a PMT
|
|
2928
|
+
pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
|
|
2929
|
+
efficiency0_D2 = pA_single*pB_single
|
|
2930
|
+
|
|
2931
|
+
return efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2
|
|
2932
|
+
|
|
2933
|
+
|
|
2934
|
+
def efficienciesEstimates(efficiency_S, efficiency_D, efficiency_T, efficiency_D2,N):
|
|
2935
|
+
mean_efficiency_T = np.mean(efficiency_T) # average
|
|
2936
|
+
std_efficiency_T = np.std(efficiency_T)/np.sqrt(N) # standard deviation
|
|
2937
|
+
mean_efficiency_D = np.mean(efficiency_D)
|
|
2938
|
+
std_efficiency_D = np.std(efficiency_D)/np.sqrt(N)
|
|
2939
|
+
mean_efficiency_D2 = np.mean(efficiency_D2)
|
|
2940
|
+
std_efficiency_D2 = np.std(efficiency_D2)/np.sqrt(N)
|
|
2941
|
+
mean_efficiency_S = np.mean(efficiency_S)
|
|
2942
|
+
std_efficiency_S = np.std(efficiency_S)/np.sqrt(N)
|
|
2943
|
+
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
|
|
2944
|
+
|
|
2945
|
+
|
|
2946
|
+
|
|
2947
|
+
|
|
2948
|
+
|
|
2834
2949
|
# N = 1e7
|
|
2835
2950
|
# buildBetaSpectra('H-3', 16, N, prt=True); print('H-3 - done')
|
|
2836
2951
|
# buildBetaSpectra('C-14', 16, N, prt=True); print('C-14 - done')
|
|
File without changes
|
|
File without changes
|