TDCRPy 1.2.0__tar.gz → 1.3.0__tar.gz

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.

Files changed (73) hide show
  1. {TDCRPy-1.2.0/TDCRPy.egg-info → TDCRPy-1.3.0}/PKG-INFO +1 -1
  2. {TDCRPy-1.2.0 → TDCRPy-1.3.0/TDCRPy.egg-info}/PKG-INFO +1 -1
  3. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/TDCRPy.egg-info/requires.txt +1 -0
  4. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/setup.py +2 -2
  5. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/TDCRPy.py +47 -29
  6. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/TDCR_model_lib.py +71 -31
  7. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/LICENCE.md +0 -0
  8. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/MANIFEST.in +0 -0
  9. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/README.md +0 -0
  10. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/TDCRPy.egg-info/SOURCES.txt +0 -0
  11. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/TDCRPy.egg-info/dependency_links.txt +0 -0
  12. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/TDCRPy.egg-info/top_level.txt +0 -0
  13. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/setup.cfg +0 -0
  14. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_C-14.txt +0 -0
  15. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Ca-45.txt +0 -0
  16. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_H-3.txt +0 -0
  17. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Ni-63.txt +0 -0
  18. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Pm-147.txt +0 -0
  19. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Pu-241.txt +0 -0
  20. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_S-35.txt +0 -0
  21. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Sr-89.txt +0 -0
  22. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Sr-90.txt +0 -0
  23. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/Spectra_for_analytical_model/dep_spectrum_Tc-99.txt +0 -0
  24. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/matrice/fichier/E_depose.txt +0 -0
  25. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/matrice/fichier/matrice_10ml-beta-_1_200k.txt +0 -0
  26. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/matrice/fichier/matrice_10ml-beta-_2000_10000k.txt +0 -0
  27. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/matrice/fichier/matrice_10ml-beta-_200_2000k.txt +0 -0
  28. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/matrice/fichier/matrice_10ml-photon_1_200k.txt +0 -0
  29. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/matrice/fichier/matrice_10ml-photon_2000_10000k.txt +0 -0
  30. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/matrice/fichier/matrice_10ml-photon_200_2000k.txt +0 -0
  31. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/matrice/fichier/matrice_16ml-beta-_1_200k.txt +0 -0
  32. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/matrice/fichier/matrice_16ml-beta-_200_2000k.txt +0 -0
  33. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/matrice/fichier/matrice_16ml-photon_1_200k.txt +0 -0
  34. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/matrice/fichier/matrice_16ml-photon_2000_10000k.txt +0 -0
  35. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/MCNP-MATRIX/matrice/fichier/matrice_16ml-photon_200_2000k.txt +0 -0
  36. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyAlpha_0.015.txt +0 -0
  37. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyAlpha_1.1e-05.txt +0 -0
  38. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyAlpha_1.2e-05.txt +0 -0
  39. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyAlpha_1.3e-05.txt +0 -0
  40. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyAlpha_1.4e-05.txt +0 -0
  41. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyAlpha_1.5e-05.txt +0 -0
  42. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyAlpha_1e-05.txt +0 -0
  43. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyAlpha_6e-06.txt +0 -0
  44. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyAlpha_7e-06.txt +0 -0
  45. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyAlpha_8e-06.txt +0 -0
  46. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyAlpha_9e-06.txt +0 -0
  47. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyElectron_0.006.txt +0 -0
  48. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyElectron_0.007.txt +0 -0
  49. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyElectron_0.008.txt +0 -0
  50. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyElectron_0.009.txt +0 -0
  51. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyElectron_0.01.txt +0 -0
  52. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyElectron_0.011.txt +0 -0
  53. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyElectron_0.012.txt +0 -0
  54. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyElectron_0.013.txt +0 -0
  55. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyElectron_0.014.txt +0 -0
  56. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/QuenchEnergyElectron_0.015.txt +0 -0
  57. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/TandataUG.txt +0 -0
  58. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/alpha_toulene.txt +0 -0
  59. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/inputVecteurAlpha.txt +0 -0
  60. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/Quenching/inputVecteurElectron.txt +0 -0
  61. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/TDCRoptimize.py +0 -0
  62. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/__init__.py +0 -0
  63. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/config.toml +0 -0
  64. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/decayData/All-nuclides_BetaShape.zip +0 -0
  65. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/decayData/All-nuclides_Ensdf.zip +0 -0
  66. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/decayData/All-nuclides_PenNuc.zip +0 -0
  67. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/docs/_build/html/genindex.html +0 -0
  68. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/docs/_build/html/index.html +0 -0
  69. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/docs/_build/html/search.html +0 -0
  70. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/docs/_build/html/source/modules.html +0 -0
  71. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/docs/_build/html/source/tdcrpy.html +0 -0
  72. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/test/__init__.py +0 -0
  73. {TDCRPy-1.2.0 → TDCRPy-1.3.0}/tdcrpy/test/test_tdcrpy.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TDCRPy
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: TDCR model
5
5
  Home-page: https://github.com/RomainCoulon/TDCRPy
6
6
  Author: RomainCoulon (Romain Coulon)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TDCRPy
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: TDCR model
5
5
  Home-page: https://github.com/RomainCoulon/TDCRPy
6
6
  Author: RomainCoulon (Romain Coulon)
@@ -4,3 +4,4 @@ setuptools
4
4
  scipy
5
5
  configparser
6
6
  importlib.resources
7
+ matplotlib
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
  import codecs
3
3
  import os
4
4
 
5
- VERSION = "1.2.0"
5
+ VERSION = "1.3.0"
6
6
  DESCRIPTION = "TDCR model"
7
7
 
8
8
  with open("README.md", "r") as f:
@@ -20,7 +20,7 @@ setup(
20
20
  project_urls={'Documentation': 'https://github.com/RomainCoulon/TDCRPy/',},
21
21
  # packages = find_packages(exclude=["tdcrpy.EfficiencyProfils","tdcrpy.decay","tdcrpy.Activity_TDCR"], include=["tdcrpy.TDCR_model_lib","tdcrpy.TDCRoptimize","tdcrpy.TDCRPy", "tdcrpy.test.test_tdcrpy"]),
22
22
  packages = find_packages(),
23
- install_requires = ["numpy","tqdm","setuptools","scipy","configparser","importlib.resources"],
23
+ install_requires = ["numpy","tqdm","setuptools","scipy","configparser","importlib.resources","matplotlib"],
24
24
  keywords = ["Python","TDCR","Monte-Carlo","radionuclide","scintillation","counting"],
25
25
  classifiers=[
26
26
  "Development Status :: 4 - Beta",
@@ -9,14 +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
15
  import configparser
16
16
  import numpy as np
17
17
  from tqdm import tqdm
18
+ from importlib.resources import files
18
19
 
19
- def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=False, barp=False):
20
+ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=False, barp=False, uncData=False):
20
21
  """
21
22
  This is the main function of the TDCRPy package running the Monte-Carlo Triple-to-Double Coincidence Ratio model.
22
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.
@@ -26,6 +27,8 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
26
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;
27
28
 
28
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
29
32
 
30
33
  also, two configuration can be set:
31
34
 
@@ -68,13 +71,15 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
68
71
  V : float
69
72
  volume of the scintillator in ml.
70
73
  mode : string
71
- "res" to return the residual, "eff" to return efficiencies.
74
+ "res" to return the residual, "eff" to return efficiencies, "dis" to resturn distributions.
72
75
  mode2 : string
73
76
  "sym" for symetrical model, "asym" for symetrical model.
74
77
  Display : Boolean, optional
75
78
  "True" to display details on the decay sampling. The default is False.
76
79
  barp : Boolean, optional
77
- "True" to display the calculation progress. The default is True.
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
83
 
79
84
  Returns
80
85
  -------
@@ -95,8 +100,8 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
95
100
  """
96
101
  if barp: tl.display_header()
97
102
  config = configparser.ConfigParser()
98
- with importlib.resources.path('tdcrpy', 'config.toml') as data_path:
99
- file_conf = data_path
103
+ with importlib.resources.as_file(files('tdcrpy').joinpath('config.toml')) as data_path:
104
+ file_conf = data_path
100
105
  config.read(file_conf)
101
106
  tau=config["Inputs"].getfloat("tau")
102
107
  Y=config["Inputs"].getboolean("Y")
@@ -253,7 +258,7 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
253
258
  if Display: print("\t Subsequent isomeric transition(s)") # finish with the mother / now with the daughter
254
259
  while levelOftheDaughter > 0: # Go on the loop while the daughter nucleus is a its fundamental level (energy 0)
255
260
  i_level = levelNumber[index_rad][iDaughter].index([levelOftheDaughter]) # Find the position in the daughter level vector
256
-
261
+ print(trans_halfLife)
257
262
  # test whether the decay occurs within the coincidence resolving time or not
258
263
  if np.random.exponential(trans_halfLife[index_rad][iDaughter][i_branch][i_level], size=1)[0] > tau: splitEvent = True
259
264
  else: splitEvent = False
@@ -262,7 +267,15 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
262
267
  #====================================================================
263
268
  # Sampling of the transition in energy levels of the daughter nucleus
264
269
  #====================================================================
265
- probability_tran = tl.normalise(prob_trans[index_rad][iDaughter][i_level]) # normaliser la proba de transition
270
+ if uncData:
271
+ prob_trans_s=[]
272
+ for ipt, xpt in enumerate(prob_trans[index_rad][iDaughter][i_level]):
273
+ prob_trans_s.append(np.random.normal(xpt, u_prob_trans[index_rad][iDaughter][i_level][ipt], 1)[0])
274
+
275
+ probability_tran = tl.normalise(prob_trans_s) # normaliser la proba de transition
276
+ else:
277
+ probability_tran = tl.normalise(prob_trans[index_rad][iDaughter][i_level]) # normaliser la proba de transition
278
+
266
279
  index_t = tl.sampling(probability_tran) # indice de la transition
267
280
  if Display:
268
281
  print("\t\t Energy of the level = ", levelEnergy[index_rad][iDaughter][i_level][0], " keV")
@@ -777,27 +790,12 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
777
790
  TBCmodel = mean_efficiency_T/mean_efficiency_BC
778
791
  TACmodel = mean_efficiency_T/mean_efficiency_AC
779
792
 
780
-
781
- # x = np.arange(np.mean(efficiency_T),1.001,0.001)
782
- # plt.figure("efficiency distribution")
783
- # plt.clf()
784
- # plt.hist(np.asarray(efficiency_D),bins=x,label="Efficiency of double coincidences")[0]
785
- # plt.hist(np.asarray(efficiency_T),bins=x,label="Efficiency of triple coincidences")[0]
786
- # plt.xlabel("Efficiency", fontsize = 14)
787
- # plt.ylabel(r"Number of counts", fontsize = 14)
788
- # plt.legend(fontsize = 12)
789
- # plt.savefig('Effdistribution.png')
790
-
791
- # x = np.arange(np.mean(tdcr),1.001,0.001)
792
- # plt.figure("TDCR distribution")
793
- # plt.clf()
794
- # plt.hist(np.asarray(tdcr),bins=x,label="Calculated TDCR")[0]
795
- # plt.plot(x,st.norm.pdf(x, TDCR_measure, u_TDCR_measure),label="measured TDCR")[0]
796
- # plt.xlabel("Efficiency", fontsize = 14)
797
- # plt.ylabel(r"Number of counts", fontsize = 14)
798
- # plt.legend(fontsize = 12)
799
- # plt.savefig('TDCRdistribution.png')
800
793
 
794
+ '''
795
+ ======================
796
+ VI. RETURN THE RESULTS
797
+ ======================
798
+ '''
801
799
  if mode2=="sym":
802
800
  res=(TDCR_calcul-TD)**2
803
801
  elif mode2=="asym":
@@ -811,4 +809,24 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
811
809
  return mean_efficiency_S, 1, mean_efficiency_D, 1, mean_efficiency_T, 1
812
810
  else:
813
811
  return mean_efficiency_S, std_efficiency_S, mean_efficiency_D, std_efficiency_D, mean_efficiency_T, std_efficiency_T
812
+ if mode =="dis":
813
+ return efficiency_S, efficiency_D, efficiency_T
814
+
815
+
816
+
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"
829
+
814
830
 
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)
@@ -13,6 +13,7 @@ Bureau International des Poids et Mesures
13
13
  """
14
14
 
15
15
  import importlib.resources
16
+ from importlib.resources import files
16
17
  import pkg_resources
17
18
  import configparser
18
19
  import numpy as np
@@ -21,14 +22,16 @@ import time
21
22
  import re
22
23
  import os
23
24
  import scipy.interpolate as interp
25
+ import matplotlib.pyplot as plt
24
26
 
25
27
  """
26
28
  ======= Import ressource data =======
27
29
  """
28
30
 
29
31
  # import advanced configuration data
32
+
30
33
  config = configparser.ConfigParser()
31
- with importlib.resources.path('tdcrpy', 'config.toml') as data_path:
34
+ with importlib.resources.as_file(files('tdcrpy').joinpath('config.toml')) as data_path:
32
35
  file_conf = data_path
33
36
  config.read(file_conf)
34
37
  RHO = config["Inputs"].getfloat("density")
@@ -38,22 +41,26 @@ depthSpline = config["Inputs"].getint("depthSpline")
38
41
  Einterp = config["Inputs"].getfloat("Einterp")
39
42
 
40
43
  # import PenNuc data
41
- with importlib.resources.path('tdcrpy', 'decayData') as data_path:
44
+ with importlib.resources.as_file(files('tdcrpy').joinpath('decayData')) as data_path:
45
+ #with importlib.resources.path('tdcrpy', 'decayData') as data_path:
42
46
  file_pennuc = data_path / "All-nuclides_PenNuc.zip"
43
47
  z_PenNuc = zf.ZipFile(file_pennuc)
44
48
 
45
49
  # import BetaShape data
46
- with importlib.resources.path('tdcrpy', 'decayData') as data_path:
50
+ with importlib.resources.as_file(files('tdcrpy').joinpath('decayData')) as data_path:
51
+ #with importlib.resources.path('tdcrpy', 'decayData') as data_path:
47
52
  file_betashape = data_path / "All-nuclides_BetaShape.zip"
48
53
  z_betashape = zf.ZipFile(file_betashape)
49
54
 
50
55
  # import ENSDF data
51
- with importlib.resources.path('tdcrpy', 'decayData') as data_path:
56
+ with importlib.resources.as_file(files('tdcrpy').joinpath('decayData')) as data_path:
57
+ #with importlib.resources.path('tdcrpy', 'decayData') as data_path:
52
58
  file_ensdf = data_path / 'All-nuclides_Ensdf.zip'
53
59
  z_ensdf = zf.ZipFile(file_ensdf)
54
60
 
55
61
  # import photon interaction data (MCNP6 calculation)
56
- with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
62
+ with importlib.resources.as_file(files('tdcrpy').joinpath('MCNP-MATRIX')) as data_path:
63
+ #with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
57
64
  fp1 = data_path / 'matrice/fichier/matrice_10ml-photon_1_200k.txt' #gamma-10ml-1-200keV-niveau 0
58
65
  fp2 = data_path / 'matrice/fichier/matrice_10ml-photon_200_2000k.txt' #gamma-10ml-200-2000keV-niveau 1
59
66
  fp3 = data_path / 'matrice/fichier/matrice_10ml-photon_2000_10000k.txt' #gamma-10ml-2000-10000keV-niveau 2
@@ -63,7 +70,8 @@ with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
63
70
  fe = data_path / 'matrice/fichier/E_depose.txt'
64
71
 
65
72
  # import electron interaction data (MCNP6 calculation)
66
- with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
73
+ with importlib.resources.as_file(files('tdcrpy').joinpath('MCNP-MATRIX')) as data_path:
74
+ #with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
67
75
  fe1 = data_path / 'matrice/fichier/matrice_10ml-beta-_1_200k.txt' # electron-10ml-1-200keV-niveau 0
68
76
  fe2 = data_path / 'matrice/fichier/matrice_10ml-beta-_200_2000k.txt' # electron-10ml-200-2000keV-niveau 1
69
77
  fe3 = data_path / 'matrice/fichier/matrice_10ml-beta-_2000_10000k.txt' # electron-10ml-2000-10000keV-niveau 2
@@ -72,7 +80,8 @@ with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
72
80
  fe = data_path / 'matrice/fichier/E_depose.txt' # electron-10ml-énergie-niveau 'e'
73
81
 
74
82
  # import beta spectra calculated for the analytical model (BetaShape + MCNP6 calculation)
75
- with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
83
+ with importlib.resources.as_file(files('tdcrpy').joinpath('MCNP-MATRIX')) as data_path:
84
+ #with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
76
85
  sH3 = data_path / 'Spectra_for_analytical_model/dep_spectrum_H-3.txt'
77
86
  sC14 = data_path / 'Spectra_for_analytical_model/dep_spectrum_C-14.txt'
78
87
  sS35 = data_path / 'Spectra_for_analytical_model/dep_spectrum_S-35.txt'
@@ -85,7 +94,8 @@ with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
85
94
  sPu241 = data_path / 'Spectra_for_analytical_model/dep_spectrum_Pu-241.txt'
86
95
 
87
96
  # import stopping power data for electron
88
- with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
97
+ with importlib.resources.as_file(files('tdcrpy').joinpath('Quenching')) as data_path:
98
+ #with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
89
99
  file_TanXia = open(data_path / "TandataUG.txt")
90
100
 
91
101
  data_TanXia=file_TanXia.read(); file_TanXia.close()
@@ -94,9 +104,10 @@ for i, x in enumerate(data_TanXia):
94
104
  if i<len(data_TanXia)-1: data_TanXia_f[i]=float(x)
95
105
 
96
106
  # import stopping power data for electron for alpha particle (ASTAR data)
97
- with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
107
+ with importlib.resources.as_file(files('tdcrpy').joinpath('Quenching')) as data_path:
108
+ #with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
98
109
  f_alpha = open(data_path / "alpha_toulene.txt")
99
-
110
+
100
111
  data_ASTAR = f_alpha.readlines()
101
112
  f_alpha.close()
102
113
  energy_alph = []
@@ -110,7 +121,8 @@ for i in range(np.size(data_ASTAR)):
110
121
 
111
122
  # import pre-calculated quenched energy tables
112
123
  kB_a = [6e-6, 7e-6, 8e-6, 9e-6, 1e-5, 1.1e-5, 1.2e-5, 1.3e-5, 1.4e-5, 1.5e-5] # cm/MeV
113
- with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
124
+ with importlib.resources.as_file(files('tdcrpy').joinpath('Quenching')) as data_path:
125
+ #with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
114
126
  Ei_alpha_fid = open(data_path / "inputVecteurAlpha.txt")
115
127
  Ei_alpha = Ei_alpha_fid.readlines()
116
128
  Ei_alpha = Ei_alpha[0].split(" ")
@@ -118,7 +130,8 @@ Ei_alpha = [float(x) for x in Ei_alpha[:-1]]
118
130
 
119
131
  Em_alpha = []
120
132
  for ikB in kB_a:
121
- with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
133
+ with importlib.resources.as_file(files('tdcrpy').joinpath('Quenching')) as data_path:
134
+ #with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
122
135
  tamptxt = "QuenchEnergyAlpha_"+str(ikB)+".txt"
123
136
  fid = open(data_path / tamptxt)
124
137
  line = fid.readlines()
@@ -127,7 +140,8 @@ for ikB in kB_a:
127
140
  Em_alpha.append(line)
128
141
 
129
142
  kB_e = [0.006, 0.007, 0.008, 0.009, 0.010, 0.011, 0.012, 0.013, 0.014, 0.015] # cm/MeV
130
- with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
143
+ with importlib.resources.as_file(files('tdcrpy').joinpath('Quenching')) as data_path:
144
+ #with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
131
145
  Ei_electron_fid = open(data_path / "inputVecteurElectron.txt")
132
146
  Ei_electron = Ei_electron_fid.readlines()
133
147
  Ei_electron = Ei_electron[0].split(" ")
@@ -135,7 +149,8 @@ Ei_electron = [float(x) for x in Ei_electron[:-1]]
135
149
 
136
150
  Em_electron = []
137
151
  for ikB in kB_e:
138
- with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
152
+ with importlib.resources.as_file(files('tdcrpy').joinpath('Quenching')) as data_path:
153
+ #with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
139
154
  tamptxt = "QuenchEnergyElectron_"+str(ikB)+".txt"
140
155
  fid = open(data_path / tamptxt)
141
156
  line = fid.readlines()
@@ -143,6 +158,7 @@ for ikB in kB_e:
143
158
  line = [float(x) for x in line[:-1]]
144
159
  Em_electron.append(line)
145
160
 
161
+
146
162
  """
147
163
  ======= Library of functions =======
148
164
  """
@@ -231,18 +247,18 @@ def readPenNuc2(rad,z1=z_PenNuc):
231
247
  list of energy associated with transitions -- indice 9. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
232
248
  tran_prob_tot : list[list]
233
249
  list of probability associated with transitions -- indice 10. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
234
- uncertainty_tot : list[list]
235
- list of uncertainty of probability associated with transitions -- indice 11. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
236
250
  tran_level_tot : list[list]
237
- list of corresponding branch levels -- indice 12. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to the level before the transition.
251
+ list of corresponding branch levels -- indice 11. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to the level before the transition.
238
252
  tran_level_end_tot : list[list]
239
- list of level following given transitions -- indice 13. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to the level after the transition.
253
+ list of level following given transitions -- indice 12. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to the level after the transition.
240
254
  level_energy_tot : list[list]
241
- list of energy levels -- indice 14. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
255
+ list of energy levels -- indice 13. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
242
256
  prob_tran_tot : list[list]
243
- list of sum of transition of each branches -- indice 15. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
257
+ list of sum of transition of each branches -- indice 14. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
244
258
  half_life : list
245
- list of half_life of meta state -- indice 16.
259
+ list of half_life of meta state -- indice 15.
260
+ uncertainty_tot : list[list]
261
+ list of uncertainty of probability associated with transitions -- indice 16. It contains a sub-list for all possible branches of a given daughter nucleus and a sub-sub list related to possible decay mode of each branch.
246
262
  '''
247
263
  doc = rad + ".PenNuc.txt"
248
264
  with z1.open(doc) as file_P:
@@ -365,11 +381,6 @@ def readPenNuc2(rad,z1=z_PenNuc):
365
381
  uncertainty = []
366
382
  half_life = []
367
383
 
368
- meta = False
369
- meta_rad = ['Mn-52m','Y-90m','Nb-93m','Nb-95m','Tc-99m','Ag-108m','Ag-110m','Te-123m','Te-127m','Xe-131m','Xe-133m','Xe-135m','Ba-137m','Pr-144m','Pm-148m','Pa-234m','Am-242m']
370
- if rad in meta_rad:
371
- meta = True
372
- meta = True
373
384
 
374
385
  for i3 in range(len(posi_end_i)-1):
375
386
  start_p1 = posi_end_i[i3]
@@ -429,10 +440,8 @@ def readPenNuc2(rad,z1=z_PenNuc):
429
440
  if "LED" == i4[0]:
430
441
  tran_level_b.append(int(i4[-1]))
431
442
  level_energy_b.append(float(i4[1]))
432
- if meta:
433
- half_life_b.append(float(i4[4]))
443
+ half_life_b.append(float(i4[4]))
434
444
  if i4[0] == "GA" or i4[0] == "EK" or i4[0] == "EL" or i4[0] == "EL1" or i4[0] == "EL2" or i4[0] == "EL3" or i4[0] == "EM" or i4[0] == "EN":
435
- #print(i4)
436
445
  tran_type_b.append(i4[0])
437
446
  tran_prob_b.append(float(i4[1]))
438
447
  uncertainty_b.append(float(i4[2]))
@@ -474,11 +483,13 @@ def readPenNuc2(rad,z1=z_PenNuc):
474
483
 
475
484
  tran_type_daug.append([])
476
485
  tran_prob_daug.append([])
486
+ uncertainty.append([])
477
487
  tran_energy_daug.append([])
478
488
  tran_level_end_daug.append([])
479
489
  tran_level_daug.append([])
480
490
  level_energy_daug.append([])
481
491
  prob_tran_daug.append(0)
492
+ half_life.append([])
482
493
 
483
494
  desin_type_tot.append(desin_type_daug)
484
495
  desin_energy_tot.append(desin_energy_daug)
@@ -501,7 +512,6 @@ def readPenNuc2(rad,z1=z_PenNuc):
501
512
 
502
513
 
503
514
 
504
-
505
515
  #================================== StoppingPower for alpha particle ===========================================
506
516
 
507
517
  def stoppingpowerA(e,rho=RHO,energy_alpha=energy_alph,dEdx_alpha=dEdx_alph):
@@ -1637,6 +1647,36 @@ distribution: https://pypi.org/project/TDCRPy \n\
1637
1647
  developement: https://github.com/RomainCoulon/TDCRPy \n\n\
1638
1648
  start calculation..."
1639
1649
 
1640
- # Start Calculation
1650
+ # Start Calculation
1641
1651
  print(header_text)
1642
1652
  print(header_text2)
1653
+
1654
+ def display_distrib(S, D, T):
1655
+ n=len(D)
1656
+ x = np.arange(0,1.1,0.01)
1657
+ D=np.asarray(D)
1658
+ T=np.asarray(T)
1659
+ meanD=np.mean(D)
1660
+ meanT=np.mean(T)
1661
+ # tdcr=T/D
1662
+ plt.figure("efficiency distribution")
1663
+ plt.clf()
1664
+ plt.hist(np.asarray(D),bins=x,label="Double coincidences")[0]
1665
+ plt.hist(np.asarray(T),bins=x,label="Triple coincidences")[0]
1666
+ plt.scatter(meanD,n,marker='o',s=200,color='orange',label="mean value for Double coincidences")
1667
+ plt.scatter(meanT,n,marker='o',s=200,color='blue',label="mean value for Triple coincidences")
1668
+ plt.yscale("log")
1669
+ plt.xlabel("Efficiency", fontsize = 14)
1670
+ plt.ylabel(r"Number of counts", fontsize = 14)
1671
+ plt.legend(fontsize = 12)
1672
+ plt.show()
1673
+ # plt.savefig('Effdistribution.png')
1674
+
1675
+ # plt.figure("TDCR distribution")
1676
+ # plt.clf()
1677
+ # plt.hist(np.asarray(tdcr),bins=x,label="calculated TDCR")[0]
1678
+ # # plt.plot(x,st.norm.pdf(x, TDCR_measure, u_TDCR_measure),label="measured TDCR")[0]
1679
+ # plt.xlabel("Efficiency", fontsize = 14)
1680
+ # plt.ylabel(r"Number of counts", fontsize = 14)
1681
+ # plt.legend(fontsize = 12)
1682
+ # # plt.savefig('TDCRdistribution.png')
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes