TDCRPy 0.0.6__py3-none-any.whl → 0.0.8__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.
Code/TDCRPy.py CHANGED
@@ -9,7 +9,7 @@ Bureau International des Poids et Mesures
9
9
  """
10
10
 
11
11
  ## IMPORT PYTHON MODULES
12
- import TDCR_model_lib as tl
12
+ import TDCRPy.TDCR_model_lib as tl
13
13
  import numpy as np
14
14
 
15
15
  def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, RHO, nE, mode, mode2, Display=False):
@@ -296,7 +296,7 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, RHO, nE, mode, mode2, Displa
296
296
  energy_vec.append(511)
297
297
 
298
298
  if p == "gamma" or p == "XKA" or p == "XKB" or p == "XL":
299
- energy_vec[i] = tl.energie_dep_gamma(energy_vec[i]) # sampling energy free from photon
299
+ energy_vec[i] = tl.energie_dep_gamma(energy_vec[i],v=10) # sampling energy free from photon
300
300
  particle_vec[i] = "electron"
301
301
  if p == "Auger K" or p == "Auger L":
302
302
  particle_vec[i] = "electron"
Code/TDCR_model_lib.py CHANGED
@@ -1266,14 +1266,18 @@ def E_quench_a(e,kB,nE):
1266
1266
  #========================= énergie gamma ===================================================
1267
1267
  #'''
1268
1268
  if absolutePath:
1269
- fp1 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/matrice_p_1_200k.txt' #gamma-10ml-1-200keV-niveau 0
1270
- fp2 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/matrice_p_200_2000k.txt' #gamma-10ml-200-2000keV-niveau 0
1271
- fp3 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/matrice_p_2000_10000k.txt' #gamma-10ml-2000-10000keV-niveau 0
1269
+ fp1 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/matrice_10ml-photon_1_200k.txt' #gamma-10ml-1-200keV-niveau 0
1270
+ fp2 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/matrice_10ml-photon_200_2000k.txt' #gamma-10ml-200-2000keV-niveau 0
1271
+ fp3 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/matrice_10ml-photon_2000_10000k.txt' #gamma-10ml-2000-10000keV-niveau 0
1272
+ fp4 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/matrice_16ml-photon_1_200k.txt' #gamma-10ml-1-200keV-niveau 0
1273
+ fp5 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/matrice_16ml-photon_200_2000k.txt' #gamma-10ml-1-200keV-niveau 0
1272
1274
  fe = "G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/E_depose.txt"
1273
1275
  else:
1274
- fp1 = 'MCNP-MATRIX/matrice/fichier/matrice_p_1_200k.txt' #gamma-10ml-1-200keV-niveau 0
1275
- fp2 = 'MCNP-MATRIX/matrice/fichier/matrice_p_200_2000k.txt' #gamma-10ml-200-2000keV-niveau 0
1276
- fp3 = 'MCNP-MATRIX/matrice/fichier/matrice_p_2000_10000k.txt' #gamma-10ml-2000-10000keV-niveau 0
1276
+ fp1 = 'MCNP-MATRIX/matrice/fichier/matrice_10ml-photon_1_200k.txt' #gamma-10ml-1-200keV-niveau 0
1277
+ fp2 = 'MCNP-MATRIX/matrice/fichier/matrice_10ml-photon_200_2000k.txt' #gamma-10ml-200-2000keV-niveau 0
1278
+ fp3 = 'MCNP-MATRIX/matrice/fichier/matrice_10ml-photon_2000_10000k.txt' #gamma-10ml-2000-10000keV-niveau 0
1279
+ fp4 = 'MCNP-MATRIX/matrice/fichier/matrice_16ml-photon_1_200k.txt' #gamma-10ml-1-200keV-niveau 0
1280
+ fp5 = 'MCNP-MATRIX/matrice/fichier/matrice_16ml-photon_200_2000k.txt' #gamma-10ml-1-200keV-niveau 0
1277
1281
  fe = "MCNP-MATRIX/matrice/fichier/E_depose.txt"
1278
1282
  '''
1279
1283
  data1 = f1.readlines()
@@ -1329,9 +1333,11 @@ def read_matrice(path,niveau):
1329
1333
  Matrice10_p_1 = read_matrice(fp1,0)
1330
1334
  Matrice10_p_2 = read_matrice(fp2,1)
1331
1335
  Matrice10_p_3 = read_matrice(fp3,2)
1336
+ Matrice16_p_1 = read_matrice(fp4,0)
1337
+ Matrice16_p_2 = read_matrice(fp5,1)
1332
1338
  Matrice_e = read_matrice(fe,'e')
1333
1339
 
1334
- def energie_dep_gamma(e_inci,*,matrice10_1=Matrice10_p_1,matrice10_2=Matrice10_p_2,matrice10_3=Matrice10_p_3,ed=Matrice_e):
1340
+ def energie_dep_gamma(e_inci,v,matrice10_1=Matrice10_p_1,matrice10_2=Matrice10_p_2,matrice10_3=Matrice10_p_3,matrice16_1=Matrice16_p_1,matrice16_2=Matrice16_p_2,ed=Matrice_e):
1335
1341
  """
1336
1342
  ----------
1337
1343
  Parameters
@@ -1357,16 +1363,19 @@ def energie_dep_gamma(e_inci,*,matrice10_1=Matrice10_p_1,matrice10_2=Matrice10_p
1357
1363
  """
1358
1364
  ## sort keV / entrée : keV
1359
1365
  if e_inci <= 200:
1360
- index = int(e_inci) # index de colonne de la matrice de l'énergie incidente la plus proche
1361
- #doc = 'MCNP-MATRIX/matrice/matrice_p_1_200k.txt'
1362
- matrice = matrice1
1363
- #taille_x = 200
1366
+ index = int(e_inci) # index de colonne de la matrice de l'énergie incidente la plus proche
1367
+ if v == 10:
1368
+ matrice = matrice10_1
1369
+ elif v == 16:
1370
+ matrice = matrice16_1
1364
1371
  e = ed[:,0]
1365
1372
 
1366
1373
  elif e_inci <= 2000:
1367
1374
  index = int((e_inci-200)/2)
1368
- #doc = 'MCNP-MATRIX/matrice/matrice_p_200_2000k.txt'
1369
- matrice = matrice2
1375
+ if v == 10:
1376
+ matrice = matrice10_2
1377
+ elif v == 16:
1378
+ matrice = matrice16_2
1370
1379
  #taille_x = 901
1371
1380
  e = ed[:,1]
1372
1381
 
@@ -1395,8 +1404,8 @@ def energie_dep_gamma(e_inci,*,matrice10_1=Matrice10_p_1,matrice10_2=Matrice10_p
1395
1404
  if result > e_inci: result = e_inci
1396
1405
  return result
1397
1406
 
1398
- #for i in range(50):
1399
- #print(energie_dep_gamma(511))
1407
+ #for i in range(10):
1408
+ # print(energie_dep_gamma(511,16))
1400
1409
 
1401
1410
 
1402
1411
  if absolutePath:
Code/test.py CHANGED
@@ -7,3 +7,6 @@ Created on Thu Jul 13 19:15:23 2023
7
7
  import TDCRPy
8
8
 
9
9
  TDCRPy.TDCRPy(1, 0.5, 0.5, 0.5, 0.5, "H-3", "1", 10, 0.00001, 1,10, "eff", "sym", Display=True)
10
+
11
+
12
+ TDCRPy.TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, RHO, nE, mode, mode2)
@@ -0,0 +1,305 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created on Fri Apr 14 20:43:26 2023
4
+
5
+ @author: romain.coulon
6
+ """
7
+ import matplotlib.pyplot as plt
8
+ import numpy as np
9
+ import scipy.signal as sg
10
+ import scipy.optimize as opt
11
+ import sys
12
+ sys.path.insert(1, 'G:\Python_modules\BIPM_RI_PyModules')
13
+ import TDCRcalculation as dtc
14
+
15
+
16
+ def readEff(Rad, kB, SDT):
17
+ file = open("G:\Python_modules\TDCRPy\TDCRPy\Code\\EfficiencyCurves/"+''.join(Rad)+"/Eff"+SDT+"_"+''.join(Rad)+'_[1]_'+str(kB)+".txt","r")
18
+ L=[]
19
+ p=[]
20
+ up=[]
21
+ for row in file:
22
+ H=row.split(" ")
23
+ L.append(float(H[0]))
24
+ p.append(float(H[1]))
25
+ up.append(float(H[2]))
26
+ return L, p, up
27
+
28
+ def readProfil(Rad,kB,SDT):
29
+ Lv, pSv, upSv = readEff(Rad, kB, SDT)
30
+ pSv = sg.savgol_filter(pSv, 7, 2)
31
+ return Lv, np.asarray(pSv), upSv
32
+
33
+ def res(L, TD, Lv, pDv, pTv):
34
+ return (np.interp(L, Lv, pTv)/np.interp(L, Lv, pDv)-TD)**2
35
+
36
+ def effTDCR(TD, Rad, kB):
37
+ kBv = [0.8e-5, 0.9e-5, 1.0e-5, 1.1e-5, 1.2e-5]
38
+ Lv0 = readProfil(Rad,0.8e-5,"D")[0]
39
+ pDv=[]; pTv=[]; Lv1=[]; effD1=[]; effT1=[]
40
+ for i in kBv:
41
+ pDv.append(readProfil(Rad,i,"D")[1])
42
+ pTv.append(readProfil(Rad,i,"T")[1])
43
+ Lv1.append(opt.minimize_scalar(res, args=(TD, Lv0, pDv[-1], pTv[-1]), method='golden').x)
44
+ effD1.append(np.interp(Lv1[-1], Lv0, pDv[-1]))
45
+ effT1.append(np.interp(Lv1[-1], Lv0, pTv[-1]))
46
+ L = np.interp(kB, kBv, Lv1)
47
+ effD = np.interp(kB, kBv, effD1)
48
+ effT = np.interp(kB, kBv, effT1)
49
+
50
+ # plt.figure("eff_D = f(kB)")
51
+ # plt.clf()
52
+ # plt.title(' ')
53
+ # plt.plot(kBv, effD1,'-b')
54
+ # plt.plot(kB, effD, 'or')
55
+ # plt.xlabel(r"$kB$ /(cm keV$^{-1}$)", fontsize = 14)
56
+ # plt.ylabel(r"$\epsilon_D$", fontsize = 14)
57
+ # plt.legend(fontsize = 12)
58
+ # # plt.close()
59
+
60
+ # plt.figure("eff_T = f(kB)")
61
+ # plt.clf()
62
+ # plt.title(' ')
63
+ # plt.plot(kBv, effT1,'-b')
64
+ # plt.plot(kB, effT, 'or')
65
+ # plt.xlabel(r"$kB$ /(cm keV$^{-1}$)", fontsize = 14)
66
+ # plt.ylabel(r"$\epsilon_T$", fontsize = 14)
67
+ # plt.legend(fontsize = 12)
68
+ # # plt.close()
69
+
70
+ # plt.figure("L = f(kB)")
71
+ # plt.clf()
72
+ # plt.title(' ')
73
+ # plt.plot(kBv, Lv1,'-b')
74
+ # plt.plot(kB, L, 'or')
75
+ # plt.xlabel(r"$kB$ /(cm keV$^{-1}$)", fontsize = 14)
76
+ # plt.ylabel(r"$L$ /keV$^{-1}$", fontsize = 14)
77
+ # plt.legend(fontsize = 12)
78
+ # # plt.close()
79
+
80
+ return L, effD, effT
81
+
82
+ def plotEffProfil(Rad,kB):
83
+ kBv = [0.8e-5, 0.9e-5, 1.0e-5, 1.1e-5, 1.2e-5]
84
+ Lv0 = readProfil(Rad,0.8e-5,"D")[0]
85
+ pDv=[]; pTv=[]; pSv=[]
86
+ for i in kBv:
87
+ pDv.append(readProfil(Rad,i,"D")[1])
88
+ pTv.append(readProfil(Rad,i,"T")[1])
89
+ pSv.append(readProfil(Rad,i,"S")[1])
90
+ effS=[]; effD=[]; effT=[]
91
+ print("S",np.asarray(pSv)[:,0])
92
+ for i in range(len(Lv0)):
93
+ effS.append(np.interp(kB, kBv, np.asarray(pSv)[:,i]))
94
+ effD.append(np.interp(kB, kBv, np.asarray(pDv)[:,i]))
95
+ effT.append(np.interp(kB, kBv, np.asarray(pTv)[:,i]))
96
+ tdcr = np.asarray(effT)/np.asarray(effD)
97
+
98
+ plt.figure("Efficiency curve eff = f(L)")
99
+ plt.clf()
100
+ plt.title(' ')
101
+ plt.plot(Lv0, effS,'-b', label = r"$\epsilon_{S}$, $kB$ = "+str(kB)+" cm/keV")
102
+ plt.plot(Lv0, effD,'-k', label = r"$\epsilon_{D}$, $kB$ = "+str(kB)+" cm/keV")
103
+ plt.plot(Lv0, effT,'-r', label = r"$\epsilon_{T}$, $kB$ = "+str(kB)+" cm/keV")
104
+ plt.xscale("log")
105
+ plt.xlabel(r"$L$ /keV$^{-1}$", fontsize = 14)
106
+ plt.ylabel(r"$\epsilon$", fontsize = 14)
107
+ plt.legend(fontsize = 12)
108
+ # plt.close()
109
+
110
+ plt.figure("Efficiency curve eff = f(TDCR)")
111
+ plt.clf()
112
+ plt.title(' ')
113
+ plt.plot(tdcr, effS,'-b', label = r"$\epsilon_{S}$, $kB$ = "+str(kB)+" cm/keV")
114
+ plt.plot(tdcr, effD,'-k', label = r"$\epsilon_{D}$, $kB$ = "+str(kB)+" cm/keV")
115
+ plt.plot(tdcr, effT,'-r', label = r"$\epsilon_{T}$, $kB$ = "+str(kB)+" cm/keV")
116
+ # plt.xscale("log")
117
+ plt.xlabel(r"$\epsilon_T/\epsilon_D$", fontsize = 14)
118
+ plt.ylabel(r"$\epsilon$", fontsize = 14)
119
+ # bbox_inches = "tight", format = "png", dpi = 500
120
+ plt.legend(fontsize = 12)
121
+ # plt.close()
122
+
123
+
124
+ def plotEffProfilkB(Rad,SDT): # plot the fitted efficiecny curves for a range of kB
125
+ kBv = [0.8e-5, 0.9e-5, 1.0e-5, 1.1e-5, 1.2e-5] # kB vector
126
+ plt.figure("Efficiency curve eff = f(TDCR)")
127
+ plt.clf()
128
+ plt.title(' ')
129
+ for i in kBv: # loop in the kB vector
130
+ pDv = readProfil(Rad,i,"D")[1] # probability vector of events
131
+ pTv = readProfil(Rad,i,"T")[1] # probability vector of triple coincidence events
132
+ pSv = readProfil(Rad,i,"S")[1] # probability vector of single events
133
+ tdcr = np.asarray(pTv)/np.asarray(pDv) # tdcr vector
134
+ if SDT == "S":
135
+ plt.plot(tdcr, pSv, label = r"$kB$ = "+str(i)+" cm/keV")
136
+ plt.ylabel(r"$\epsilon_S$", fontsize = 14)
137
+ if SDT == "D":
138
+ plt.plot(tdcr, pDv, label = r"$kB$ = "+str(i)+" cm/keV")
139
+ plt.ylabel(r"$\epsilon_D$", fontsize = 14)
140
+ if SDT == "T":
141
+ plt.plot(tdcr, pDv, label = r"$kB$ = "+str(i)+" cm/keV")
142
+ plt.ylabel(r"$\epsilon$", fontsize = 14)
143
+ # plt.xscale("log")
144
+ plt.xlabel(r"$\epsilon_T/\epsilon_D$", fontsize = 14)
145
+ # bbox_inches = "tight", format = "png", dpi = 500
146
+ plt.legend(fontsize = 12)
147
+ plt.savefig("EfficiencyCurves/"+Rad+"/tdcr_"+Rad+".png")
148
+ # plt.close()
149
+
150
+ def plotSmoothing(Rad,SDT): # plot the fitted efficiecny curves for a range of kB
151
+ kB = 1.0e-5
152
+ plt.figure(r"Fitting of calculated points - $kB$ = "+str(kB)+" cm/keV")
153
+ plt.clf()
154
+ plt.title(' ')
155
+ pDv = readProfil(Rad,kB,"D")[1] # probability vector of events
156
+ pts_D = readEff(Rad, kB, "D")
157
+ pTv = readProfil(Rad,kB,"T")[1] # probability vector of triple coincidence events
158
+ pts_T = readEff(Rad, kB, "T")
159
+ pSv = readProfil(Rad,kB,"S")[1] # probability vector of single events
160
+ pts_S = readEff(Rad, kB, "S")
161
+ tdcr = np.asarray(pTv)/np.asarray(pDv) # tdcr vector fit
162
+ tdcr_x = np.asarray(pts_T[1])/np.asarray(pts_D[1]) # calculated points
163
+ if SDT == "S":
164
+ plt.plot(tdcr_x, pts_S[1], "ok", label = r"calculated points")
165
+ plt.plot(tdcr, pSv, label = r"fitted function")
166
+ plt.ylabel(r"$\epsilon_S$", fontsize = 14)
167
+ if SDT == "D":
168
+ plt.plot(tdcr_x, pts_D[1], "ok", label = r"calculated points")
169
+ plt.plot(tdcr, pDv, label = r"fitted function")
170
+ plt.ylabel(r"$\epsilon_D$", fontsize = 14)
171
+ if SDT == "T":
172
+ plt.plot(tdcr_x, pts_T[1], "ok", label = r"calculated points")
173
+ plt.plot(tdcr, pDv, label = r"fitted function")
174
+ plt.ylabel(r"$\epsilon$", fontsize = 14)
175
+ # plt.xscale("log")
176
+ plt.xlabel(r"$\epsilon_T/\epsilon_D$", fontsize = 14)
177
+ # bbox_inches = "tight", format = "png", dpi = 500
178
+ plt.legend(fontsize = 12)
179
+ plt.savefig("EfficiencyCurves/"+Rad+"/tdcr_"+Rad+"_fit.png")
180
+ # plt.close()
181
+
182
+ def plotL(radv,kB,L): # plot the fitted efficiecny curves for a range of kB
183
+
184
+ effD = []; effT = []
185
+ for Rad in radv:
186
+ out = readProfil(Rad,kB,"D") # probability vector of double events
187
+ effD.append(np.interp(L, out[0], np.asarray(out[1])))
188
+ out = readProfil(Rad,kB,"T") # probability vector of triple events
189
+ effT.append(np.interp(L, out[0], np.asarray(out[1])))
190
+
191
+ effD = np.asarray(effD)
192
+ effT = np.asarray(effT)
193
+
194
+ x = effT/effD
195
+ plt.figure(r"Fitting of calculated points")#" - $kB$ = "+str(kB)+" cm/keV - $L$ = "+str(L)+" keV$^{-1}$")
196
+ plt.clf()
197
+ plt.title(' ')
198
+ plt.plot(x, effD, "ok", label="TDCR model")
199
+ for ix, c in enumerate(x):
200
+ plt.text(c, effD[ix]+0.000, radv[ix], color="b")
201
+ plt.errorbar(0.9788, 0.9767, xerr=0.0012, yerr=0.011, fmt="or", label="experiemental result")
202
+ plt.text(0.9788, 0.9767, "Co-60", color = "r")
203
+ plt.ylabel(r"$\epsilon_D$", fontsize = 14)
204
+ plt.xlabel(r"$\epsilon_T/\epsilon_D$", fontsize = 14)
205
+ # plt.xscale("log")
206
+ plt.legend(fontsize = 12)
207
+ plt.savefig("EfficiencyCurves/ESIRIC/EfficiencyCurve.png")
208
+ plt.show()
209
+
210
+ # plt.xscale("log")
211
+
212
+ # bbox_inches = "tight", format = "png", dpi = 500
213
+
214
+ # plt.close()
215
+
216
+ ## PLOT EFFICIENCY CURVES FOR SEVERAL KB VALUES
217
+ # plotEffProfilkB("C-14","D")
218
+
219
+ ## PLOT EFFICIENCY CURVE A GIVEN KB VALUE
220
+ # plotEffProfil("Fe-55", 1.05E-5)
221
+
222
+ ## PLOT THE FIT OF THE EFFICIENCY FUNCTION
223
+ # plotSmoothing("C-14","D")
224
+
225
+ ## PLOT THE EFFICIENCY FOR A GIVEN FREE PARAMETER
226
+ # plotSmoothing("C-14","D")
227
+
228
+ ## CALCULATION OF THE EFFICIENCY
229
+ # Reference Point Co-60 => TDCR=0.9788 Eff_D = 0.9767 => L =
230
+
231
+ # radv = ["H-3", "He-6", "Be-7", "C-11", "C-14", "N-13", "O-15", "F-18", "Na-22", \
232
+ # "Na-24", "Al-26", "P-32", "P-33", "S-35", "Cl-36", "Ar-41", "K-40", \
233
+ # "Ca-41", "Ca-45", "Sc-44", "Sc-46", "Sc-47", "Ti-44", "Cr-51", \
234
+ # "Mn-52", "Mn-52m", "Mn-54", "Mn-56", "Fe-52", "Fe-55", "Fe-59", "Co-56", \
235
+ # "Co-57", "Co-58", "Co-60", "Ga-66", "Ni-57", "Ni-59", "Ni-63", "Zn-65", \
236
+ # "I-123", "Sb-124", "Sb-125", "Te-123m", "Te-127", "Te-127m", "Te-132", \
237
+ # "Pu-241"]
238
+
239
+
240
+ radv = ["Fe-55"]
241
+ kB = 1.0e-5
242
+ L = 1.13
243
+ plotL(radv, kB, L)
244
+
245
+ # AB = 657.296
246
+ # BC = 695.919
247
+ # AC = 693.579
248
+ # T = 448.868
249
+ # D = AB+BC+AC-2*T
250
+ # out = effTDCR(T/D, "H-3", 1.05E-5) # H-3
251
+ # plotEffProfil("H-3", 1.05E-5)
252
+
253
+ # AB = 864.95
254
+ # BC = 1006.58
255
+ # AC = 968.45
256
+ # T = 700
257
+ # D = 1000
258
+ # XX = (D + 2*T)/3
259
+ # print(XX)
260
+ # print(T/D)
261
+ # D = AB+BC+AC-2*T
262
+
263
+ # TDCR = [0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
264
+ # kB = 0.8E-5
265
+ # rad = "C-14"
266
+ # TDCR.reverse()
267
+ # for t in TDCR:
268
+ # eff = effTDCR(t, rad, kB)[1] # H-3
269
+ # eff2 = dtc.I2calc(t, 0, 0, 0, rad, kB*1e3)[2]
270
+ # digRound = 2
271
+ # print("Efficiency of double coincidences = ", round(100*eff2, digRound),"% - ", round(100*eff, digRound),"%")
272
+
273
+
274
+
275
+
276
+
277
+ # DT = 0.977784348 # Co-60 NIST
278
+ # uDT = 0.000711023 # Co-60 NIST
279
+ # D = 84679.21179
280
+ # nMc = 1e3
281
+ # eff_v = []
282
+ # kB1 = 0.8e-5
283
+ # kB2 = 1.2e-5
284
+ # for i in range(int(nMc)):
285
+ # dti = np.random.normal(DT,uDT)
286
+ # kBi = np.random.uniform(kB1,kB2)
287
+ # eff_v.append(effTDCR(dti, "Co-60", kBi)[1]) # Co-60 NIST
288
+ # eff = np.median(eff_v)
289
+ # u_eff = np.std(eff_v)
290
+ # A = D/eff
291
+ # uA = D*u_eff/eff**2
292
+ # result 87099 67 (err = 0.0002) kB = 0.01
293
+ # result 87045 88 kB = [0.008 - 0.012]
294
+ # I2 86640.31523 14.64334414
295
+ # A_NIST = 86920 200
296
+
297
+ # out = effTDCR(657.296, 695.919, 693.579, 448.868) # Co-60
298
+ # print("Efficiency of double coincidences = ", round(100*eff, digRound),"+/-", round(100*u_eff, digRound),"%")
299
+ # print("Efficiency of triple coincidences = ", round(100*out[2], digRound),"%")
300
+ # print("Activity from double coincidences = ", round(A, digRound), "+/-", round(uA, digRound) ,"Bq")
301
+ # print("Activity of triple coincidences = ", round(T/out[2], digRound), "Bq")
302
+ # print("Efficiency of double coincidences (asym) = ", round(100*out[3], digRound),"%")
303
+ # print("Efficiency of triple coincidences (asym) = ", round(100*out[5], digRound),"%")
304
+ # print("Activity from double coincidences (asym) = ", round(D/out[3], digRound), "Bq")
305
+ # print("Activity of triple coincidences (asym) = ", round(T/out[5], digRound), "Bq")
@@ -0,0 +1,96 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created on Wed Jul 5 10:04:23 2023
4
+
5
+ @author: romain.coulon
6
+ """
7
+ import TDCR_model_lib as tl
8
+ import TDCRPy as td
9
+ import matplotlib.pyplot as plt
10
+
11
+ ## INPUT OF THE MODEL
12
+ # N=1 # number of simulated decay (MC trials)
13
+ N= 10000
14
+ Rad="Co-60, H-3" # list of radionuclides (Na-24)
15
+ # Rad = ["Cs-137"]
16
+ pmf_1="0.5, 0.5" # relative abondance (pmf)
17
+ kB =[1.0e-5]
18
+ # kB = [0.8e-5, 0.9e-5, 1.0e-5, 1.1e-5, 1.2e-5] # Birks constant in cm/keV
19
+ L=[1.13]
20
+ # L = np.logspace(-3,1,50) # Free paramete in keV-1
21
+
22
+ Record = False # to record the efficiency curves
23
+ # Record = True # to record the efficiency curves
24
+ # Display = False # to display calculation results on the console
25
+ Display = True # to display calculation results on the console
26
+ # RHO = 0.96 #density of absorber (Toluene) g/cm3
27
+ RHO = 0.98 #density of absorber (UG + H20) g/cm3
28
+ nE = 1000 #number of bin to discretize the energy vector for scintillation quenching calculation
29
+ mode = "eff"
30
+ #meta_vec = ["Am-242m","Pa-234m","Pm-148m","Pr-144m","Xe-133m","Te-127m","Ag-110m","Ag-108m","Tc-99m","Nb-95m","Y-90m","Mn-52m"]
31
+
32
+ TDCR_measure = 0.977784 # Measured TDCR value
33
+ u_TDCR_measure = 0.000711 # standard uncertainty
34
+ TAB=0.8
35
+ TBC=0.8
36
+ TAC=0.8
37
+
38
+ for kB_i in kB: # Loop on the kB
39
+ mean_efficiency_S = [] # efficiency of single counte rate
40
+ std_efficiency_S = [] # std
41
+ mean_efficiency_T = [] # efficiency of triple coincidence counte rate
42
+ std_efficiency_T = [] # std
43
+ mean_efficiency_D = [] # efficiency of double coincidence counte rate
44
+ std_efficiency_D = [] # std
45
+ TDCR_calcul = []
46
+ for L_i in L: # loop on the free parameter values
47
+ efficiency_S = [] # results calculated efficiency for single events
48
+ efficiency_D = [] # results calculated efficiency for double coincidence
49
+ efficiency_T = [] # results calculated efficiency for triple coincidence
50
+
51
+ out=td.TDCRPy(L_i,TDCR_measure,TAB, TBC, TAC, Rad,pmf_1,10,kB_i,RHO,nE,mode="eff",mode2="sym",Display=True)
52
+ efficiency_S.append(out[0])
53
+ std_efficiency_S.append(out[1])
54
+ efficiency_D.append(out[2])
55
+ std_efficiency_D.append(out[3])
56
+ efficiency_T.append(out[4])
57
+ std_efficiency_T.append(out[5])
58
+
59
+ if len(L) > 1: print("\n\t\t Progress = ", round(100*(L.tolist().index(L_i)+1)/len(L), 1), " %")
60
+ print("\t\tradionuclide(s): ", Rad)
61
+ print("\t\t TDCR calculation _ kB = ", kB_i, "cm/keV")
62
+ print("\t\t Free parameter = ", L_i, " keV-1")
63
+ print("\t\t Efficiency of Triple coincident events = ", round(100*efficiency_T[-1],3), "+/-", round(100*std_efficiency_T[-1],3), " %")
64
+ print("\t\t Efficiency of Double coincident events = ", round(100*efficiency_D[-1],3), "+/-", round(100*std_efficiency_D[-1],3), " %")
65
+ print("\t\t Efficiency of Single events = ", round(100*efficiency_S[-1],3), "+/-", round(100*std_efficiency_S[-1],3), " %")
66
+
67
+ if len(mean_efficiency_S)>1:
68
+ plt.figure("Efficiency curve I")
69
+ plt.clf()
70
+ plt.title(''.join(Rad))
71
+ plt.errorbar(L, mean_efficiency_S, yerr = std_efficiency_S, fmt=".b", label = "S")
72
+ plt.errorbar(L, mean_efficiency_D, yerr = std_efficiency_D, fmt=".k", label = "D")
73
+ plt.errorbar(L, mean_efficiency_T, yerr = std_efficiency_T, fmt=".r", label = "T")
74
+ plt.xscale("log")
75
+ plt.xlabel(r"$L$ /keV$^{-1}$", fontsize = 14)
76
+ plt.ylabel(r"$\epsilon$", fontsize = 14)
77
+ plt.legend(fontsize = 12)
78
+ if Record: plt.savefig("EfficiencyCurves/"+''.join(Rad)+"/fom_"+''.join(Rad)+"_"+str(kB_i)+".png")
79
+ plt.close()
80
+
81
+ plt.figure("Efficiency curve II")
82
+ plt.clf()
83
+ plt.title(''.join(Rad))
84
+ plt.errorbar(TDCR_calcul, mean_efficiency_S, yerr=std_efficiency_S, fmt=".b", label = "S")
85
+ plt.errorbar(TDCR_calcul, mean_efficiency_D, yerr=std_efficiency_D, fmt=".k", label = "D")
86
+ plt.errorbar(TDCR_calcul, mean_efficiency_T, yerr=std_efficiency_T, fmt=".r", label = "T")
87
+ plt.xlabel(r"$\epsilon_T/\epsilon_D$", fontsize = 14)
88
+ plt.ylabel(r"$\epsilon_D$", fontsize = 14)
89
+ plt.legend(fontsize = 12)
90
+ if Record: plt.savefig("EfficiencyCurves/"+''.join(Rad)+"/tdcr_"+''.join(Rad)+"_"+str(kB_i)+".png")
91
+ plt.close()
92
+
93
+ if Record:
94
+ tl.writeEffcurves(L, mean_efficiency_S, std_efficiency_S, Rad, pmf_1, kB_i, "S")
95
+ tl.writeEffcurves(L, mean_efficiency_D, std_efficiency_D, Rad, pmf_1, kB_i, "D")
96
+ tl.writeEffcurves(L, mean_efficiency_T, std_efficiency_T, Rad, pmf_1, kB_i, "T")