TDCRPy 1.3.0__py3-none-any.whl → 1.5.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/TDCRPy.py CHANGED
@@ -9,15 +9,15 @@ Bureau International des Poids et Mesures
9
9
  """
10
10
 
11
11
  ## IMPORT PYTHON MODULES
12
- import tdcrpy.TDCR_model_lib as tl
13
- # import TDCR_model_lib as tl
12
+ # import tdcrpy.TDCR_model_lib as tl
13
+ import TDCR_model_lib as tl
14
14
  import importlib.resources
15
+ from importlib.resources import files
15
16
  import configparser
16
17
  import numpy as np
17
18
  from tqdm import tqdm
18
- from importlib.resources import files
19
19
 
20
- def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=False, barp=False, uncData=False):
20
+ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=False, barp=False,uncData=False):
21
21
  """
22
22
  This is the main function of the TDCRPy package running the Monte-Carlo Triple-to-Double Coincidence Ratio model.
23
23
  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.
@@ -27,8 +27,6 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
27
27
  --> In mode="eff", it calculates the efficiency of the TDCR system as a function of a value (triplet) of free parameter(s) L, the measurement data is not used;
28
28
 
29
29
  --> In mode="res", it calculates the residual of the TDCR model parametrized by a value (or triplet) of free parameter(s) L and the measurement data TD, TAB, TBC, TAC.
30
-
31
- --> In mode="dis", the distributions of coincidence probability are retruned
32
30
 
33
31
  also, two configuration can be set:
34
32
 
@@ -71,15 +69,13 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
71
69
  V : float
72
70
  volume of the scintillator in ml.
73
71
  mode : string
74
- "res" to return the residual, "eff" to return efficiencies, "dis" to resturn distributions.
72
+ "res" to return the residual, "eff" to return efficiencies.
75
73
  mode2 : string
76
74
  "sym" for symetrical model, "asym" for symetrical model.
77
75
  Display : Boolean, optional
78
76
  "True" to display details on the decay sampling. The default is False.
79
77
  barp : Boolean, optional
80
- "True" to display the calculation progress. The default is False.
81
- uncData : Boolean, optional
82
- "True" to propagate uncertainty from decay data. The default is False.
78
+ "True" to display the calculation progress. The default is True.
83
79
 
84
80
  Returns
85
81
  -------
@@ -101,7 +97,7 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
101
97
  if barp: tl.display_header()
102
98
  config = configparser.ConfigParser()
103
99
  with importlib.resources.as_file(files('tdcrpy').joinpath('config.toml')) as data_path:
104
- file_conf = data_path
100
+ file_conf = data_path
105
101
  config.read(file_conf)
106
102
  tau=config["Inputs"].getfloat("tau")
107
103
  Y=config["Inputs"].getboolean("Y")
@@ -179,9 +175,15 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
179
175
  efficiency_S = []
180
176
  efficiency_D = []
181
177
  efficiency_T = []
178
+ efficiency_S2 = []
179
+ efficiency_D2 = []
180
+ efficiency_T2 = []
182
181
  efficiency_AB = []
183
182
  efficiency_BC = []
184
183
  efficiency_AC = []
184
+ efficiency_AB2 = []
185
+ efficiency_BC2 = []
186
+ efficiency_AC2 = []
185
187
 
186
188
  if barp and not Display: NN = tqdm(range(N), desc="Processing", unit=" decays")
187
189
  else: NN = range(N)
@@ -195,7 +197,7 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
195
197
  '''
196
198
  index_rad = tl.sampling(pmf_1)
197
199
  rad_i = Rad[index_rad]
198
- if Display: print("\n Trial ",str(i+1),"- Sampled radionuclide: ", rad_i)
200
+ if Display: print("\n\n Trial ",str(i+1),"- Sampled radionuclide: ", rad_i)
199
201
 
200
202
 
201
203
  '''
@@ -229,7 +231,11 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
229
231
  if particle_branch[:4]=="Atom":
230
232
  if particle_branch=="Atom_K": print("\t\t Electron capture on K shell")
231
233
  if particle_branch=="Atom_L": print("\t\t Electron capture on L shell")
234
+ if particle_branch=="Atom_L1": print("\t\t Electron capture on L1 shell")
235
+ if particle_branch=="Atom_L2": print("\t\t Electron capture on L2 shell")
236
+ if particle_branch=="Atom_L3": print("\t\t Electron capture on L3 shell")
232
237
  if particle_branch=="Atom_M": print("\t\t Electron capture on M shell")
238
+ if particle_branch=="Atom_O": print("\t\t Electron capture on O shell")
233
239
  else:
234
240
  print("\t\t Particle: ", particle_branch)
235
241
  print("\t\t Energy of the particle = ", energy_branch, " keV")
@@ -256,17 +262,25 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
256
262
  ==============
257
263
  '''
258
264
  if Display: print("\t Subsequent isomeric transition(s)") # finish with the mother / now with the daughter
265
+ evenement = 1
266
+ e_sum2 = 0
267
+ particle_vec2 = []
268
+ energy_vec2 = []
259
269
  while levelOftheDaughter > 0: # Go on the loop while the daughter nucleus is a its fundamental level (energy 0)
260
270
  i_level = levelNumber[index_rad][iDaughter].index([levelOftheDaughter]) # Find the position in the daughter level vector
261
- print(trans_halfLife)
271
+
272
+ t1 = np.random.exponential(trans_halfLife[index_rad][iDaughter][i_level][0], size=1)[0]
273
+
262
274
  # test whether the decay occurs within the coincidence resolving time or not
263
- if np.random.exponential(trans_halfLife[index_rad][iDaughter][i_branch][i_level], size=1)[0] > tau: splitEvent = True
264
- else: splitEvent = False
275
+ if t1 > tau*1e-9:
276
+ #splitEvent = True
277
+ evenement = evenement + 1
265
278
 
266
279
  if transitionType[index_rad][iDaughter][i_level] != []:
267
280
  #====================================================================
268
281
  # Sampling of the transition in energy levels of the daughter nucleus
269
282
  #====================================================================
283
+
270
284
  if uncData:
271
285
  prob_trans_s=[]
272
286
  for ipt, xpt in enumerate(prob_trans[index_rad][iDaughter][i_level]):
@@ -275,7 +289,7 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
275
289
  probability_tran = tl.normalise(prob_trans_s) # normaliser la proba de transition
276
290
  else:
277
291
  probability_tran = tl.normalise(prob_trans[index_rad][iDaughter][i_level]) # normaliser la proba de transition
278
-
292
+ #probability_tran = tl.normalise(prob_trans[index_rad][iDaughter][i_level]) # normaliser la proba de transition
279
293
  index_t = tl.sampling(probability_tran) # indice de la transition
280
294
  if Display:
281
295
  print("\t\t Energy of the level = ", levelEnergy[index_rad][iDaughter][i_level][0], " keV")
@@ -292,62 +306,120 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
292
306
  #========
293
307
  # Scoring
294
308
  #========
295
- if transitionType[index_rad][iDaughter][i_level][index_t] == "GA": # if it is a gamma that has been emitted
296
- particle_vec.append("gamma") # Update of the particle vector
297
- energy_vec.append(e_trans[index_rad][iDaughter][i_level][index_t]) # Update the energy vector
298
- else: # if not, it is a internal conversion, so an electron
299
- particle_vec.append("electron") # !!!!!!!!! it is OK for our model? Does the electron leave with the kinetic enegy of the transition
300
- energy_vec.append(e_trans[index_rad][iDaughter][i_level][index_t]) # Update the energy vector
301
- if transitionType[index_rad][iDaughter][i_level][index_t] == "EK": # record that an electron is missing on the K shell of the dughter nucleus
302
- particle_vec.append("Atom_K")
303
- energy_vec.append(0)
304
-
305
- if transitionType[index_rad][iDaughter][i_level][index_t] == "EL": # record that an electron is missing on the L1 shell of the dughter nucleus
306
- particle_vec.append("Atom_L")
307
- energy_vec.append(0)
308
-
309
- if transitionType[index_rad][iDaughter][i_level][index_t] == "EL1": # record that an electron is missing on the L1 shell of the dughter nucleus
310
- particle_vec.append("Atom_L1")
311
- energy_vec.append(0)
312
-
313
- if transitionType[index_rad][iDaughter][i_level][index_t] == "EL2": # record that an electron is missing on the L2 shell of the dughter nucleus
314
- particle_vec.append("Atom_L2")
315
- energy_vec.append(0)
316
-
317
- if transitionType[index_rad][iDaughter][i_level][index_t] == "EL3": # record that an electron is missing on the L3 shell of the dughter nucleus
318
- particle_vec.append("Atom_L3")
319
- energy_vec.append(0)
320
-
321
- if transitionType[index_rad][iDaughter][i_level][index_t] == "EM": # record that an electron is missing on the M shell of the dughter nucleus
322
- particle_vec.append("Atom_M")
323
- energy_vec.append(0)
324
-
325
- if transitionType[index_rad][iDaughter][i_level][index_t] == "EN": # record that an electron is missing on the N shell of the dughter nucleus
326
- particle_vec.append("Atom_N")
327
- energy_vec.append(0)
309
+
310
+ ## evenement retardé
311
+ if evenement != 1:
312
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "GA": # if it is a gamma that has been emitted
313
+ particle_vec2.append("gamma") # Update of the particle vector
314
+ energy_vec2.append(e_trans[index_rad][iDaughter][i_level][index_t]) # Update the energy vector
315
+ else: # if not, it is a internal conversion, so an electron
316
+ particle_vec2.append("electron") # !!!!!!!!! it is OK for our model? Does the electron leave with the kinetic enegy of the transition
317
+ energy_vec2.append(e_trans[index_rad][iDaughter][i_level][index_t]) # Update the energy vector
318
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EK": # record that an electron is missing on the K shell of the dughter nucleus
319
+ particle_vec2.append("Atom_K")
320
+ energy_vec2.append(0)
321
+
322
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EL": # record that an electron is missing on the L1 shell of the dughter nucleus
323
+ particle_vec2.append("Atom_L")
324
+ energy_vec2.append(0)
325
+
326
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EL1": # record that an electron is missing on the L1 shell of the dughter nucleus
327
+ particle_vec2.append("Atom_L1")
328
+ energy_vec2.append(0)
329
+
330
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EL2": # record that an electron is missing on the L2 shell of the dughter nucleus
331
+ particle_vec2.append("Atom_L2")
332
+ energy_vec2.append(0)
333
+
334
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EL3": # record that an electron is missing on the L3 shell of the dughter nucleus
335
+ particle_vec2.append("Atom_L3")
336
+ energy_vec2.append(0)
337
+
338
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EM": # record that an electron is missing on the M shell of the dughter nucleus
339
+ particle_vec2.append("Atom_M")
340
+ energy_vec2.append(0)
341
+
342
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EN": # record that an electron is missing on the N shell of the dughter nucleus
343
+ particle_vec2.append("Atom_N")
344
+ energy_vec2.append(0)
345
+ e_sum2 += e_trans[index_rad][iDaughter][i_level][index_t] # Energy summary
346
+
347
+
348
+ ## evenement normal
349
+ else:
350
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "GA": # if it is a gamma that has been emitted
351
+ particle_vec.append("gamma") # Update of the particle vector
352
+ energy_vec.append(e_trans[index_rad][iDaughter][i_level][index_t]) # Update the energy vector
353
+ else: # if not, it is a internal conversion, so an electron
354
+ particle_vec.append("electron") # !!!!!!!!! it is OK for our model? Does the electron leave with the kinetic enegy of the transition
355
+ energy_vec.append(e_trans[index_rad][iDaughter][i_level][index_t]) # Update the energy vector
356
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EK": # record that an electron is missing on the K shell of the dughter nucleus
357
+ particle_vec.append("Atom_K")
358
+ energy_vec.append(0)
359
+
360
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EL": # record that an electron is missing on the L1 shell of the dughter nucleus
361
+ particle_vec.append("Atom_L")
362
+ energy_vec.append(0)
363
+
364
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EL1": # record that an electron is missing on the L1 shell of the dughter nucleus
365
+ particle_vec.append("Atom_L1")
366
+ energy_vec.append(0)
367
+
368
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EL2": # record that an electron is missing on the L2 shell of the dughter nucleus
369
+ particle_vec.append("Atom_L2")
370
+ energy_vec.append(0)
371
+
372
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EL3": # record that an electron is missing on the L3 shell of the dughter nucleus
373
+ particle_vec.append("Atom_L3")
374
+ energy_vec.append(0)
375
+
376
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EM": # record that an electron is missing on the M shell of the dughter nucleus
377
+ particle_vec.append("Atom_M")
378
+ energy_vec.append(0)
379
+
380
+ if transitionType[index_rad][iDaughter][i_level][index_t] == "EN": # record that an electron is missing on the N shell of the dughter nucleus
381
+ particle_vec.append("Atom_N")
382
+ energy_vec.append(0)
383
+ e_sum += e_trans[index_rad][iDaughter][i_level][index_t] # Energy summary
328
384
 
329
- e_sum += e_trans[index_rad][iDaughter][i_level][index_t] # Energy summary
385
+
386
+
330
387
  levelOftheDaughter = next_level[index_rad][iDaughter][i_level][index_t] # set the next level
388
+
331
389
  else:
332
390
  i_level = levelNumber[index_rad][iDaughter].index([levelOftheDaughter])
333
391
  print("warning:pas de données de transition:daughter,niveau,niveau d'énergie",DaughterVec[index_rad][iDaughter],levelOftheDaughter,levelEnergy[index_rad][iDaughter][i_level] )
334
392
  levelOftheDaughter = 0 # set the next level
335
393
 
336
394
  if Display:
337
- print("\t Summary of the nuclear decay")
395
+ print("\n\t NUCLEAR DECAY")
396
+ print("\t Summary of the prompt nuclear decay")
338
397
  for i, p in enumerate(particle_vec):
339
398
  if p[:4] != "Atom":
340
- print(f"\t\t energy of {p} = ", energy_vec[i]," keV")
399
+ if p=="beta" or p=="beta+":
400
+ print(f'\t\t {p} transition of energy = {energy_vec[i]}, keV')
401
+ else:
402
+ print(f'\t\t emitted {p} of energy = {energy_vec[i]}, keV')
403
+ else:
404
+ print(f'\t\t capture of an electron from the {p[5:]} shell')
405
+ if evenement != 1:
406
+ print("\t Summary of the delayed nuclear decay")
407
+ for i, p in enumerate(particle_vec2):
408
+ if p[:4] != "Atom":
409
+ if p=="beta" or p=="beta+":
410
+ print(f'\t\t {p} transition of energy = {energy_vec2[i]}, keV')
411
+ else:
412
+ print(f'\t\t emitted {p} of energy = {energy_vec2[i]}, keV')
413
+ else:
414
+ print(f'\t\t capture of an electron from the {p[5:]} shell')
341
415
 
342
416
  '''
343
417
  ==========================
344
418
  II. LA RELAXATION ATOMIQUE
345
419
  ==========================
346
420
  '''
347
-
348
- if splitEvent:
349
- particle_vec2=[]
350
- energy_vec2=[]
421
+ ## evenement retarde
422
+ if evenement != 1:
351
423
 
352
424
  daughter_relax = DaughterVec[index_rad][iDaughter]
353
425
  for i_part in range(len(particle_vec)):
@@ -358,38 +430,84 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
358
430
  tf,ef = tl.relaxation_atom(daughter_relax,Rad[index_rad],particle_vec[i_part])
359
431
  if tf == "XKA":
360
432
  particle_vec[i_part] = "Atom_L"
433
+ particle_vec.append(tf)
434
+ energy_vec.append(ef)
435
+ relaxation = True
436
+ elif tf == "XKB":
437
+ particle_vec[i_part] = "Atom_M"
438
+ particle_vec.append(tf)
439
+ energy_vec.append(ef)
440
+ relaxation = False
441
+ elif tf == "XL":
442
+ particle_vec[i_part] = "Atom_M"
443
+ particle_vec.append(tf)
444
+ energy_vec.append(ef)
445
+ relaxation = False
446
+ elif tf == "Auger K":
447
+ particle_vec[i_part] = "Atom_L"
448
+ particle_vec.append(tf)
449
+ energy_vec.append(ef)
450
+ relaxation = True
451
+ elif tf == "Auger L":
452
+ particle_vec[i_part] = "Atom_M"
453
+ particle_vec.append(tf)
454
+ energy_vec.append(ef)
455
+ relaxation = False
456
+ else:
457
+ if Display: print("\t\t x ray or Auger electron from X shell")
458
+ relaxation = False
459
+ e_sum += ef
460
+ if Display:
461
+ print("\n\t ATOMIC RECOMBINATION\n\t Summary of the prompt atomic relaxation")
462
+ for i, p in enumerate(particle_vec):
463
+ if p[:4] != "Atom":
464
+ print(f"\t\t emitted {p} of energy = {round(energy_vec[i],3)} keV")
465
+ else:
466
+ print(f'\t\t an electron left the {p[5:]} shell')
467
+
468
+ for i_part in range(len(particle_vec2)):
469
+ relaxation = False
470
+ if "Atom_K" in particle_vec2[i_part] or "Atom_L" in particle_vec2[i_part] or "Atom_M" in particle_vec2[i_part]:
471
+ relaxation = True
472
+ while relaxation:
473
+ tf,ef = tl.relaxation_atom(daughter_relax,Rad[index_rad],particle_vec2[i_part])
474
+ if tf == "XKA":
475
+ particle_vec2[i_part] = "Atom_L"
361
476
  particle_vec2.append(tf)
362
477
  energy_vec2.append(ef)
363
478
  relaxation = True
364
479
  elif tf == "XKB":
365
- particle_vec[i_part] = "Atom_M"
480
+ particle_vec2[i_part] = "Atom_M"
366
481
  particle_vec2.append(tf)
367
482
  energy_vec2.append(ef)
368
483
  relaxation = False
369
484
  elif tf == "XL":
370
- particle_vec[i_part] = "Atom_M"
485
+ particle_vec2[i_part] = "Atom_M"
371
486
  particle_vec2.append(tf)
372
487
  energy_vec2.append(ef)
373
488
  relaxation = False
374
489
  elif tf == "Auger K":
375
- particle_vec[i_part] = "Atom_L"
490
+ particle_vec2[i_part] = "Atom_L"
376
491
  particle_vec2.append(tf)
377
492
  energy_vec2.append(ef)
378
493
  relaxation = True
379
494
  elif tf == "Auger L":
380
- particle_vec[i_part] = "Atom_M"
495
+ particle_vec2[i_part] = "Atom_M"
381
496
  particle_vec2.append(tf)
382
497
  energy_vec2.append(ef)
383
498
  relaxation = False
384
499
  else:
385
- if Display: print("untermined x or Auger")
500
+ if Display: print("\t\t x ray or Auger electron from X shell")
386
501
  relaxation = False
387
- e_sum += ef
502
+ e_sum2 += ef
503
+
388
504
  if Display:
389
- print("\t Summary of the atomic relaxation (prompt emission)")
505
+ print("\t Summary of the delayed atomic relaxation")
390
506
  for i, p in enumerate(particle_vec2):
391
507
  if p[:4] != "Atom":
392
- print(f"\t\t energy of {p} = ", round(energy_vec2[i],3), "keV")
508
+ print(f"\t\t emitted {p} of energy = {round(energy_vec2[i],3)} keV")
509
+ else:
510
+ print(f'\t\t an electron left the {p[5:]} shell')
393
511
 
394
512
  '''
395
513
  ==========================================================
@@ -397,98 +515,99 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
397
515
  ==========================================================
398
516
  '''
399
517
 
400
- for i, p in enumerate(particle_vec2):
401
- if p == "beta":
402
- e_b,p_b = tl.readBetaShape(rad_i,"beta-",level_before_trans) # read the data of BetaShape
403
- index_beta_energy = tl.sampling(p_b) # sampling energy of beta
404
- particle_vec2[i] = "electron"
405
- energy_vec2[i] = e_b[index_beta_energy]
406
-
407
- if p == "beta+":
408
- e_b,p_b = tl.readBetaShape(rad_i,"beta+",level_before_trans)
409
- index_beta_energy = tl.sampling(p_b)
410
- particle_vec2[i] = "positron"
411
- energy_vec[i] = e_b[index_beta_energy]
412
- particle_vec2.append("gamma")
413
- particle_vec2.append("gamma")
414
- energy_vec2.append(511)
415
- energy_vec2.append(511)
416
- energy_vec_initial2 = energy_vec2
417
- if Display:
418
- print("\t Summary of emitted particles from the promt atomic relaxation")
518
+ if ("beta" in particle_vec2) or ("beta+" in particle_vec2):
519
+ if Display: print("\t Summary of sampling of beta particles")
419
520
  for i, p in enumerate(particle_vec2):
420
- if p[:4] != "Atom": print(f"\t\t energy of {p} = ", round(energy_vec2[i],3), "keV")
521
+ if p == "beta":
522
+ e_b,p_b = tl.readBetaShape(rad_i,"beta-",level_before_trans) # read the data of BetaShape
523
+ index_beta_energy = tl.sampling(p_b) # sampling energy of beta
524
+ particle_vec2[i] = "electron"
525
+ energy_vec2[i] = e_b[index_beta_energy]
526
+ if Display: print(f"\t\t emitted {p} of energy = {round(energy_vec2[i],3)} keV")
527
+
528
+ if p == "beta+":
529
+ e_b,p_b = tl.readBetaShape(rad_i,"beta+",level_before_trans)
530
+ index_beta_energy = tl.sampling(p_b)
531
+ particle_vec2[i] = "positron"
532
+ energy_vec2[i] = e_b[index_beta_energy]
533
+ particle_vec2.append("gamma")
534
+ particle_vec2.append("gamma")
535
+ energy_vec2.append(511)
536
+ energy_vec2.append(511)
537
+ if Display: print(f"\t\t emitted {p} of energy = {round(energy_vec2[i],3)} keV")
538
+ energy_vec_initial2 = energy_vec2
539
+
421
540
 
422
-
423
- for i, p in enumerate(particle_vec):
424
- if p == "beta":
425
- e_b,p_b = tl.readBetaShape(rad_i,"beta-",level_before_trans) # read the data of BetaShape
426
- index_beta_energy = tl.sampling(p_b) # sampling energy of beta
427
- particle_vec[i] = "electron"
428
- energy_vec[i] = e_b[index_beta_energy]
429
-
430
- if p == "beta+":
431
- e_b,p_b = tl.readBetaShape(rad_i,"beta+",level_before_trans)
432
- index_beta_energy = tl.sampling(p_b)
433
- particle_vec[i] = "positron"
434
- energy_vec[i] = e_b[index_beta_energy]
435
- particle_vec.append("gamma")
436
- particle_vec.append("gamma")
437
- energy_vec.append(511)
438
- energy_vec.append(511)
439
- energy_vec_initial = energy_vec
440
- if Display:
441
- print("\t Summary of emitted particles from the delayed nuclear relaxation")
541
+ if ("beta" in particle_vec) or ("beta+" in particle_vec):
542
+ if Display: print("\t Summary of sampling of beta particles")
442
543
  for i, p in enumerate(particle_vec):
443
- if p[:4] != "Atom": print(f"\t\t energy of {p} = ", round(energy_vec[i],3), "keV")
444
-
445
-
544
+ if p == "beta":
545
+ e_b,p_b = tl.readBetaShape(rad_i,"beta-",level_before_trans) # read the data of BetaShape
546
+ index_beta_energy = tl.sampling(p_b) # sampling energy of beta
547
+ particle_vec[i] = "electron"
548
+ energy_vec[i] = e_b[index_beta_energy]
549
+ if Display: print(f"\t\t emitted {p} of energy = {round(energy_vec[i],3)} keV")
550
+
551
+ if p == "beta+":
552
+ e_b,p_b = tl.readBetaShape(rad_i,"beta+",level_before_trans)
553
+ index_beta_energy = tl.sampling(p_b)
554
+ particle_vec[i] = "positron"
555
+ energy_vec[i] = e_b[index_beta_energy]
556
+ particle_vec.append("gamma")
557
+ particle_vec.append("gamma")
558
+ energy_vec.append(511)
559
+ energy_vec.append(511)
560
+ if Display: print(f"\t\t emitted {p} of energy = {round(energy_vec[i],3)} keV")
561
+ energy_vec_initial = energy_vec
562
+
446
563
  '''
447
564
  ==========================================================
448
565
  III.b INTERACTION RAYONNEMENT/MATIERE
449
566
  ==========================================================
450
567
  '''
451
568
 
452
- for i, p in enumerate(particle_vec2):
569
+ for i, p in enumerate(particle_vec):
453
570
  if p == "electron":
454
- energy_vec2[i] = tl.energie_dep_beta(energy_vec2[i])
571
+ energy_vec[i] = tl.energie_dep_beta(energy_vec[i])
455
572
 
456
573
  if p == "beta+":
457
- energy_vec2[i] = tl.energie_dep_beta(energy_vec2[i])
574
+ energy_vec[i] = tl.energie_dep_beta(energy_vec[i])
458
575
 
459
576
  if p == "gamma" or p == "XKA" or p == "XKB" or p == "XL":
460
- energy_vec2[i] = tl.energie_dep_gamma(energy_vec2[i],v=V) # sampling energy free from photon
461
- particle_vec2[i] = "electron"
577
+ energy_vec[i] = tl.energie_dep_gamma(energy_vec[i],v=V) # sampling energy free from photon
578
+ particle_vec[i] = "electron"
462
579
 
463
580
  if p == "Auger K" or p == "Auger L":
464
- particle_vec2[i] = "electron"
465
- energy_vec2[i] = tl.energie_dep_beta(energy_vec2[i])
581
+ particle_vec[i] = "electron"
582
+ energy_vec[i] = tl.energie_dep_beta(energy_vec[i])
466
583
 
467
584
  if Display:
468
- print("\t Summary of the energy deposited by charged particles by the prompt atomic relaxation")
469
- for i, p in enumerate(particle_vec2):
470
- if p[:4] != "Atom": print(f"\t\t energy of {p} = ", round(energy_vec2[i],3), "keV")
471
-
585
+ print("\n\t INTERACTION \n\t Summary of the energy deposited by charged particles from the prompt transitions")
586
+ for i, p in enumerate(particle_vec):
587
+ if p[:4] != "Atom" and energy_vec[i]!=0: print(f"\t\t {p} of energy = {round(energy_vec[i],3)} keV")
472
588
 
473
- for i, p in enumerate(particle_vec):
589
+ for i, p in enumerate(particle_vec2):
474
590
  if p == "electron":
475
- energy_vec[i] = tl.energie_dep_beta(energy_vec[i])
591
+ energy_vec2[i] = tl.energie_dep_beta(energy_vec2[i])
476
592
 
477
593
  if p == "beta+":
478
- energy_vec[i] = tl.energie_dep_beta(energy_vec[i])
594
+ energy_vec2[i] = tl.energie_dep_beta(energy_vec2[i])
479
595
 
480
596
  if p == "gamma" or p == "XKA" or p == "XKB" or p == "XL":
481
- energy_vec[i] = tl.energie_dep_gamma(energy_vec[i],v=V) # sampling energy free from photon
482
- particle_vec[i] = "electron"
597
+ energy_vec2[i] = tl.energie_dep_gamma(energy_vec2[i],v=V) # sampling energy free from photon
598
+ particle_vec2[i] = "electron"
483
599
 
484
600
  if p == "Auger K" or p == "Auger L":
485
- particle_vec[i] = "electron"
486
- energy_vec[i] = tl.energie_dep_beta(energy_vec[i])
601
+ particle_vec2[i] = "electron"
602
+ energy_vec2[i] = tl.energie_dep_beta(energy_vec2[i])
487
603
 
488
604
  if Display:
489
- print("\t Summary of the energy deposited by charged particles from the delayed nuclear relaxation")
490
- for i, p in enumerate(particle_vec):
491
- if p[:4] != "Atom": print(f"\t\t energy of {p} = ", round(energy_vec[i],3), "keV")
605
+ print("\t Summary of the energy deposited by charged particles from the delayed transitions")
606
+ for i, p in enumerate(particle_vec2):
607
+ if p[:4] != "Atom" and energy_vec2[i]!=0: print(f"\t\t {p} of energy = {round(energy_vec2[i],3)} keV")
608
+
609
+
610
+
492
611
 
493
612
  '''
494
613
  ====================
@@ -496,25 +615,9 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
496
615
  Calculation of the scintillation quenching with the Birks Model
497
616
  ====================
498
617
  '''
499
- if Display: print("\t Summary of the estimation of quenched energies by the prompt atomic relaxation")
500
- e_quenching2=[]
501
- for i, p in enumerate(particle_vec2):
502
- if p == "alpha":
503
- energy_vec2[i] = tl.Em_a(energy_vec2[i],kB,nE_alpha)
504
- e_quenching2.append(energy_vec2[i])
505
- elif p == "electron" or p == "positron":
506
- energy_vec2[i] = tl.Em_e(energy_vec_initial2[i]*1e3,energy_vec2[i]*1e3,kB*1e3,nE_electron)*1e-3
507
- e_quenching2.append(energy_vec2[i])
508
- else:
509
- e_quenching2.append(0)
510
- if Display: print("\t\t Birks constant = ", kB, ' cm/keV')
511
- if Display:
512
- for i, p in enumerate(particle_vec2):
513
- if p[:4] != "Atom": print(f"\t\t quenched energy of {p} = ", round(e_quenching2[i],3), "keV")
514
-
515
618
 
516
619
  # changer l'intégration E_i - E_d à E_i
517
- if Display: print("\t Summary of the estimation of quenched energies from the delayed nuclear relaxation")
620
+ if Display: print(f"\n\t SCINTILLATION \n\t\t Birks constant = {kB} cm/keV\n\t Summary of the estimation of quenched energies from the prompt transitions")
518
621
  e_quenching=[]
519
622
  for i, p in enumerate(particle_vec):
520
623
  if p == "alpha":
@@ -525,11 +628,25 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
525
628
  e_quenching.append(energy_vec[i])
526
629
  else:
527
630
  e_quenching.append(0)
528
- if Display: print("\t\t Birks constant = ", kB, ' cm/keV')
529
631
  if Display:
530
632
  for i, p in enumerate(particle_vec):
531
633
  if p[:4] != "Atom": print(f"\t\t quenched energy of {p} = ", round(e_quenching[i],3), "keV")
532
-
634
+
635
+ if Display: print("\t Summary of the estimation of quenched energies by the delayed atomic relaxation")
636
+ e_quenching2=[]
637
+ for i, p in enumerate(particle_vec2):
638
+ if p == "alpha":
639
+ energy_vec2[i] = tl.Em_a(energy_vec2[i],kB,nE_alpha)
640
+ e_quenching2.append(energy_vec2[i])
641
+ elif p == "electron" or p == "positron":
642
+ energy_vec2[i] = tl.Em_e(energy_vec_initial2[i]*1e3,energy_vec2[i]*1e3,kB*1e3,nE_electron)*1e-3
643
+ e_quenching2.append(energy_vec2[i])
644
+ else:
645
+ e_quenching2.append(0)
646
+ if Display:
647
+ for i, p in enumerate(particle_vec2):
648
+ if p[:4] != "Atom": print(f"\t\t quenched energy of {p} = ", round(e_quenching2[i],3), "keV")
649
+
533
650
  '''
534
651
  ====================
535
652
  V. LE MESURE TDCR
@@ -537,51 +654,52 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
537
654
  '''
538
655
 
539
656
  if mode2=="sym":
540
- p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
657
+
658
+ p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
541
659
  p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
542
660
  efficiency_S.append(p_single)
543
661
  efficiency_T.append(p_single**3)
544
662
  efficiency_D.append(3*(p_single)**2-2*efficiency_T[-1])
545
- if Display: print("\t Summary of TDCR measurement (prompt)")
663
+ if Display: print(f"\n\t COUNTING \n\t\t Free parameter = {L} keV-1 \n\t Summary of TDCR measurement (prompt)")
546
664
  if Display: print("\t\t Free parameter = ", L, "keV-1")
547
665
  if Display: print("\t\t Efficiency of single events = ", round(efficiency_S[-1],5))
548
666
  if Display: print("\t\t Efficiency of double events = ", round(efficiency_D[-1],5))
549
667
  if Display: print("\t\t Efficiency of triple events = ", round(efficiency_T[-1],5))
668
+
669
+ p_nosingle2 = np.exp(-L*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
670
+ p_single2 = 1-p_nosingle2 # probability to have at least 1 electrons in a PMT
671
+ efficiency_S2.append(p_single2)
672
+ efficiency_T2.append(p_single2**3)
673
+ efficiency_D2.append(3*(p_single2)**2-2*efficiency_T2[-1])
674
+ if Display: print("\t Summary of TDCR measurement (delayed)")
675
+ if Display: print("\t\t Efficiency of single events = ", round(efficiency_S2[-1],5))
676
+ if Display: print("\t\t Efficiency of double events = ", round(efficiency_D2[-1],5))
677
+ if Display: print("\t\t Efficiency of triple events = ", round(efficiency_T2[-1],5))
678
+
550
679
  elif mode2=="asym":
551
- pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
552
- pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
553
- pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
554
- pB_single = 1-pB_nosingle # probability to have at least 1 electrons in a PMT
555
- pC_nosingle = np.exp(-L[2]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
556
- pC_single = 1-pC_nosingle # probability to have at least 1 electrons in a PMT
680
+ pA_nosingle2 = np.exp(-L[0]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
681
+ pA_single2 = 1-pA_nosingle2 # probability to have at least 1 electrons in a PMT
682
+ pB_nosingle2 = np.exp(-L[1]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
683
+ pB_single2 = 1-pB_nosingle2 # probability to have at least 1 electrons in a PMT
684
+ pC_nosingle2 = np.exp(-L[2]*np.sum(np.asarray(e_quenching2))/3) # probability to have 0 electrons in a PMT
685
+ pC_single2 = 1-pC_nosingle2 # probability to have at least 1 electrons in a PMT
557
686
 
558
- efficiency_AB.append(pA_single*pB_single)
559
- efficiency_BC.append(pB_single*pC_single)
560
- efficiency_AC.append(pA_single*pC_single)
561
- efficiency_T.append(pA_single*pB_single*pC_single)
562
- efficiency_D.append(efficiency_AB[-1]+efficiency_BC[-1]+efficiency_AC[-1]-2*efficiency_T[-1])
563
- efficiency_S.append(pA_single+pB_single+pC_single-efficiency_D[-1]-efficiency_T[-1])
564
- if Display: print("\t Summary of TDCR measurement (prompt)")
687
+ efficiency_AB2.append(pA_single2*pB_single2)
688
+ efficiency_BC2.append(pB_single2*pC_single2)
689
+ efficiency_AC2.append(pA_single2*pC_single2)
690
+ efficiency_T2.append(pA_single2*pB_single2*pC_single2)
691
+ efficiency_D2.append(efficiency_AB2[-1]+efficiency_BC2[-1]+efficiency_AC2[-1]-2*efficiency_T2[-1])
692
+ efficiency_S2.append(pA_single2+pB_single2+pC_single2-efficiency_D2[-1]-efficiency_T2[-1])
693
+ if Display: print(f"\n\t COUNTING \n\t\t Free parameter = {L} keV-1 \n\t Summary of TDCR measurement (prompt)")
694
+ if Display: print("\t Summary of TDCR measurement (delayed)")
565
695
  if Display: print("\t\t Free parameter PMT A: ", L[0], "keV-1")
566
696
  if Display: print("\t\t Free parameter PMT B: ", L[1], "keV-1")
567
697
  if Display: print("\t\t Free parameter PMT C: ", L[2], "keV-1")
568
- if Display: print("\t\t Efficiency of single events: ", round(efficiency_S[-1],5))
569
- if Display: print("\t\t Efficiency of double events: ", round(efficiency_D[-1],5))
570
- if Display: print("\t\t Efficiency of triple events: ", round(efficiency_T[-1],5))
698
+ if Display: print("\t\t Efficiency of single events: ", round(efficiency_S2[-1],5))
699
+ if Display: print("\t\t Efficiency of double events: ", round(efficiency_D2[-1],5))
700
+ if Display: print("\t\t Efficiency of triple events: ", round(efficiency_T2[-1],5))
571
701
 
572
-
573
- if mode2=="sym":
574
- p_nosingle = np.exp(-L*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
575
- p_single = 1-p_nosingle # probability to have at least 1 electrons in a PMT
576
- efficiency_S.append(p_single)
577
- efficiency_T.append(p_single**3)
578
- efficiency_D.append(3*(p_single)**2-2*efficiency_T[-1])
579
- if Display: print("\t Summary of TDCR measurement (delayed)")
580
- if Display: print("\t\t Free parameter = ", L, "keV-1")
581
- if Display: print("\t\t Efficiency of single events = ", round(efficiency_S[-1],5))
582
- if Display: print("\t\t Efficiency of double events = ", round(efficiency_D[-1],5))
583
- if Display: print("\t\t Efficiency of triple events = ", round(efficiency_T[-1],5))
584
- elif mode2=="asym":
702
+
585
703
  pA_nosingle = np.exp(-L[0]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
586
704
  pA_single = 1-pA_nosingle # probability to have at least 1 electrons in a PMT
587
705
  pB_nosingle = np.exp(-L[1]*np.sum(np.asarray(e_quenching))/3) # probability to have 0 electrons in a PMT
@@ -595,7 +713,7 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
595
713
  efficiency_T.append(pA_single*pB_single*pC_single)
596
714
  efficiency_D.append(efficiency_AB[-1]+efficiency_BC[-1]+efficiency_AC[-1]-2*efficiency_T[-1])
597
715
  efficiency_S.append(pA_single+pB_single+pC_single-efficiency_D[-1]-efficiency_T[-1])
598
- if Display: print("\t Summary of TDCR measurement (delayed)")
716
+ if Display: print("\t Summary of TDCR measurement (prompt)")
599
717
  if Display: print("\t\t Free parameter PMT A: ", L[0], "keV-1")
600
718
  if Display: print("\t\t Free parameter PMT B: ", L[1], "keV-1")
601
719
  if Display: print("\t\t Free parameter PMT C: ", L[2], "keV-1")
@@ -642,24 +760,31 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
642
760
  relaxation = False
643
761
  e_sum += ef
644
762
  if Display:
645
- print("\t Summary of the atomic relaxation")
763
+ print("\n\t ATOMIC RECOMBINATION\n\t Summary of the atomic relaxation")
646
764
  for i, p in enumerate(particle_vec):
647
765
  if p[:4] != "Atom":
648
- print(f"\t\t energy of {p} = ", round(energy_vec[i],3), "keV")
766
+ if p=="beta" or p=="beta+":
767
+ print(f'\t\t {p} transition of energy = {energy_vec[i]}, keV')
768
+ else:
769
+ print(f"\t\t emitted {p} of energy = {round(energy_vec[i],3)} keV")
770
+ else:
771
+ print(f'\t\t an electron left the {p[5:]} shell')
649
772
 
650
773
  '''
651
774
  ==========================================================
652
775
  III.a SPECTRES D'EMISSION
653
776
  ==========================================================
654
777
  '''
655
-
778
+ if ("beta" in particle_vec) or ("beta+" in particle_vec):
779
+ if Display: print("\n\t EMISSION OF BETA PARTICLES")
656
780
  for i, p in enumerate(particle_vec):
657
781
  if p == "beta":
658
782
  e_b,p_b = tl.readBetaShape(rad_i,"beta-",level_before_trans) # read the data of BetaShape
659
783
  index_beta_energy = tl.sampling(p_b) # sampling energy of beta
660
784
  particle_vec[i] = "electron"
661
785
  energy_vec[i] = e_b[index_beta_energy]
662
-
786
+ if Display: print(f"\t\t emitted {p} of energy = {round(energy_vec[i],3)} keV")
787
+
663
788
  if p == "beta+":
664
789
  e_b,p_b = tl.readBetaShape(rad_i,"beta+",level_before_trans)
665
790
  index_beta_energy = tl.sampling(p_b)
@@ -669,18 +794,15 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
669
794
  particle_vec.append("gamma")
670
795
  energy_vec.append(511)
671
796
  energy_vec.append(511)
797
+ if Display: print(f"\t\t emitted {p} of energy = {round(energy_vec[i],3)} keV")
672
798
  energy_vec_initial = energy_vec
673
- if Display:
674
- print("\t Summary of emitted particles")
675
- for i, p in enumerate(particle_vec):
676
- if p[:4] != "Atom": print(f"\t\t energy of {p} = ", round(energy_vec[i],3), "keV")
677
-
678
799
 
679
800
  '''
680
801
  ==========================================================
681
802
  III.b INTERACTION RAYONNEMENT/MATIERE
682
803
  ==========================================================
683
804
  '''
805
+
684
806
  for i, p in enumerate(particle_vec):
685
807
  if p == "electron":
686
808
  energy_vec[i] = tl.energie_dep_beta(energy_vec[i])
@@ -695,20 +817,19 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
695
817
  if p == "Auger K" or p == "Auger L":
696
818
  particle_vec[i] = "electron"
697
819
  energy_vec[i] = tl.energie_dep_beta(energy_vec[i])
698
-
820
+
699
821
  if Display:
700
- print("\t Summary of the energy deposited by charged particles")
822
+ print("\n\t INTERACTION \n\t Summary of the energy deposited by charged particles")
701
823
  for i, p in enumerate(particle_vec):
702
- if p[:4] != "Atom": print(f"\t\t energy of {p} = ", round(energy_vec[i],3), "keV")
703
-
824
+ if p[:4] != "Atom" and energy_vec[i]!=0: print(f"\t\t {p} of energy = {round(energy_vec[i],3)} keV")
825
+
704
826
  '''
705
827
  ====================
706
828
  IV. LA SCINTILLATION
707
829
  Calculation of the scintillation quenching with the Birks Model
708
830
  ====================
709
831
  '''
710
- # changer l'intégration E_i - E_d à E_i
711
- if Display: print("\t Summary of the estimation of quenched energies")
832
+ if Display: print(f"\n\t SCINTILLATION \n\t\t Birks constant = {kB} cm/keV\n\t Summary of the estimation of quenched energies")
712
833
  e_quenching=[]
713
834
  for i, p in enumerate(particle_vec):
714
835
  if p == "alpha":
@@ -735,8 +856,7 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
735
856
  efficiency_S.append(p_single)
736
857
  efficiency_T.append(p_single**3)
737
858
  efficiency_D.append(3*(p_single)**2-2*efficiency_T[-1])
738
- if Display: print("\t Summary of TDCR measurement")
739
- if Display: print("\t\t Free parameter = ", L, "keV-1")
859
+ if Display: print(f"\n\t COUNTING \n\t\t Free parameter = {L} keV-1 \n\t Summary of TDCR measurement")
740
860
  if Display: print("\t\t Efficiency of single events = ", round(efficiency_S[-1],5))
741
861
  if Display: print("\t\t Efficiency of double events = ", round(efficiency_D[-1],5))
742
862
  if Display: print("\t\t Efficiency of triple events = ", round(efficiency_T[-1],5))
@@ -790,12 +910,27 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
790
910
  TBCmodel = mean_efficiency_T/mean_efficiency_BC
791
911
  TACmodel = mean_efficiency_T/mean_efficiency_AC
792
912
 
913
+
914
+ # x = np.arange(np.mean(efficiency_T),1.001,0.001)
915
+ # plt.figure("efficiency distribution")
916
+ # plt.clf()
917
+ # plt.hist(np.asarray(efficiency_D),bins=x,label="Efficiency of double coincidences")[0]
918
+ # plt.hist(np.asarray(efficiency_T),bins=x,label="Efficiency of triple coincidences")[0]
919
+ # plt.xlabel("Efficiency", fontsize = 14)
920
+ # plt.ylabel(r"Number of counts", fontsize = 14)
921
+ # plt.legend(fontsize = 12)
922
+ # plt.savefig('Effdistribution.png')
923
+
924
+ # x = np.arange(np.mean(tdcr),1.001,0.001)
925
+ # plt.figure("TDCR distribution")
926
+ # plt.clf()
927
+ # plt.hist(np.asarray(tdcr),bins=x,label="Calculated TDCR")[0]
928
+ # plt.plot(x,st.norm.pdf(x, TDCR_measure, u_TDCR_measure),label="measured TDCR")[0]
929
+ # plt.xlabel("Efficiency", fontsize = 14)
930
+ # plt.ylabel(r"Number of counts", fontsize = 14)
931
+ # plt.legend(fontsize = 12)
932
+ # plt.savefig('TDCRdistribution.png')
793
933
 
794
- '''
795
- ======================
796
- VI. RETURN THE RESULTS
797
- ======================
798
- '''
799
934
  if mode2=="sym":
800
935
  res=(TDCR_calcul-TD)**2
801
936
  elif mode2=="asym":
@@ -810,23 +945,21 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
810
945
  else:
811
946
  return mean_efficiency_S, std_efficiency_S, mean_efficiency_D, std_efficiency_D, mean_efficiency_T, std_efficiency_T
812
947
  if mode =="dis":
813
- return efficiency_S, efficiency_D, efficiency_T
814
-
815
-
948
+ return efficiency_S, efficiency_D, efficiency_T
816
949
 
817
- # L = (1, 1, 1)
818
- # TD = 0.977667386529166
819
- # TAB = 0.992232838598821
820
- # TBC = 0.992343419459002
821
- # TAC = 0.99275350064608
822
- # Rad="Co-60"
823
- # pmf_1="1"
824
- # N = 10
825
- # kB =1.0e-5
826
- # V = 10
827
- # mode = "dis"
828
- # mode2 = "asym"
950
+ L = 1.2
951
+ TD = 0.977667386529166
952
+ TAB = 0.992232838598821
953
+ TBC = 0.992343419459002
954
+ TAC = 0.99275350064608
955
+ Rad="Co-60"
956
+ pmf_1="1"
957
+ N = 10
958
+ kB =1.0e-5
959
+ V = 10
960
+ mode = "dis"
961
+ mode2 = "sym"
829
962
 
830
963
 
831
- # S,D,T = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=True, barp=False, uncData=False)
832
- # # tl.display_distrib(S,D,T)
964
+ S,D,T = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=True, barp=False,uncData=False)
965
+ # tl.display_distrib(S, D, T)