TDCRPy 1.13.0__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TDCRPy
3
- Version: 1.13.0
3
+ Version: 1.13.1
4
4
  Summary: TDCR model
5
5
  Home-page: https://pypi.org/project/TDCRPy/
6
6
  Author: RomainCoulon (Romain Coulon)
@@ -1,6 +1,6 @@
1
- tdcrpy/TDCRPy.py,sha256=i16smPjN2GhbMfhdnTYNXwnyM0rncCszxjK5XCASPh0,69480
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=GLxnYEmB-U-kIsrSwwvawKsltbMyOZESiE_DdRodxjQ,119180
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.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,,
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 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):
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
- "res" to return the residual, "eff" to return efficiencies.
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,mode2,nE)
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,7 +238,7 @@ 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,mode2,1000)
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":
@@ -269,7 +271,7 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
269
271
  if decay != decaym:
270
272
  if decay>0:
271
273
  # 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)
274
+ efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, symm, extDT, measTime)
273
275
  efficiency_S.append(efficiency0_S)
274
276
  efficiency_T.append(efficiency0_T)
275
277
  efficiency_D.append(efficiency0_D)
@@ -294,7 +296,7 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
294
296
  else:
295
297
  e_quenching.append(energy)
296
298
 
297
- efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, mode2, extDT, measTime)
299
+ efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, symm, extDT, measTime)
298
300
  efficiency_S.append(efficiency0_S)
299
301
  efficiency_T.append(efficiency0_T)
300
302
  efficiency_D.append(efficiency0_D)
@@ -302,7 +304,8 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
302
304
 
303
305
  # print(efficiency_D)
304
306
  outEff = tl.efficienciesEstimates(efficiency_S, efficiency_D, efficiency_T, efficiency_D2, N)
305
- return outEff
307
+ if mode == "eff": return outEff
308
+ if mode == "dis": return efficiency_S, efficiency_D, efficiency_T, efficiency_D2
306
309
 
307
310
 
308
311
  # temp1, temp2, temp3, temp4 = tl.read_temp_files()
@@ -957,111 +960,12 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
957
960
  ====================
958
961
  '''
959
962
  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)
963
+ efficiency0_S, efficiency0_D, efficiency0_T, efficiency0_D2 = tl.detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, symm, extDT, measTime)
961
964
  efficiency_S.append(efficiency0_S)
962
965
  efficiency_T.append(efficiency0_T)
963
966
  efficiency_D.append(efficiency0_D)
964
967
  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))
1002
-
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
1011
-
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
1018
-
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)
1029
-
1030
-
1031
-
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
1048
-
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))
968
+
1065
969
 
1066
970
  """
1067
971
  ==========================================================
@@ -1070,9 +974,9 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
1070
974
  """
1071
975
  if record:
1072
976
  with open(recfile4, "a") as file:
1073
- if mode2=="sym":
977
+ if symm:
1074
978
  file.write(f"{idec} {efficiency_S[-1]} {efficiency_D[-1]} {efficiency_T[-1]}\n")
1075
- elif mode2=="asym":
979
+ else:
1076
980
  file.write(f"{idec} {efficiency_S[-1]} {efficiency_D[-1]} {efficiency_T[-1]} {efficiency_AB[-1]} {efficiency_BC[-1]} {efficiency_AC[-1]}\n")
1077
981
 
1078
982
  '''
@@ -1081,23 +985,10 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
1081
985
  ====================
1082
986
  '''
1083
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)
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)
1097
988
 
1098
- if mode2=="sym":
989
+ if symm:
1099
990
  TDCR_calcul = mean_efficiency_T/mean_efficiency_D
1100
- elif mode2=="asym":
991
+ else:
1101
992
  mean_efficiency_AB = np.mean(efficiency_AB)
1102
993
  std_efficiency_AB = np.std(efficiency_AB)/np.sqrt(N)
1103
994
  mean_efficiency_BC = np.mean(efficiency_BC)
@@ -1109,21 +1000,14 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
1109
1000
  TBCmodel = mean_efficiency_T/mean_efficiency_BC
1110
1001
  TACmodel = mean_efficiency_T/mean_efficiency_AC
1111
1002
 
1112
- if mode2=="sym":
1003
+ if symm:
1113
1004
  res=(TDCR_calcul-TD)**2
1114
- elif mode2=="asym":
1005
+ else:
1115
1006
  res=(TAB-TABmodel)**2+(TBC-TBCmodel)**2+(TAC-TACmodel)**2
1116
1007
 
1117
1008
  if mode == "res":
1118
1009
  return res
1119
1010
  if mode == "eff":
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
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
1128
1012
  if mode =="dis":
1129
1013
  return efficiency_S, efficiency_D, efficiency_T, efficiency_D2
@@ -1156,16 +1040,15 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
1156
1040
  # kB =1.0e-5
1157
1041
  # V = 10
1158
1042
  # mode = "eff"
1159
- # mode2 = "sym"
1160
1043
 
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])
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])
1164
1047
 
1165
1048
 
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)
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)
1167
1050
 
1168
- # out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display = False, record = True, readRecHist = False)
1051
+ # out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, symm=True, Display = False, record = True, readRecHist = False)
1169
1052
  # 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)
1053
+ # out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, symm=True, Display = False, record = False, readRecHist = True)
1171
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,mode2,ne):
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
- mode2 : string
2652
- "sym" for symetrical model, "asym" for symetrical model.
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 mode2=="sym":
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,8 +2829,8 @@ 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
 
2833
- def detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, mode2, extDT, measTime):
2834
- if mode2=="sym":
2832
+ def detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, symm, extDT, measTime):
2833
+ if symm:
2835
2834
  # print(evenement !=1, t1 > extDT*1e-6, t1 < measTime*60)
2836
2835
  if evenement !=1 and t1 > extDT*1e-6 and t1 < measTime*60:
2837
2836
  # TDCR
@@ -2863,7 +2862,7 @@ def detectProbabilities(L, e_quenching, e_quenching2, t1, evenement, mode2, extD
2863
2862
  efficiency0_D2 = p_single**2
2864
2863
 
2865
2864
 
2866
- elif mode2=="asym":
2865
+ else:
2867
2866
  if evenement !=1 and t1 > extDT*1e-6 and t1 < measTime*60:
2868
2867
  # TDCR
2869
2868
  pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT