TDCRPy 1.8.17__py3-none-any.whl → 1.9.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.

@@ -1,11 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TDCRPy
3
- Version: 1.8.17
3
+ Version: 1.9.0
4
4
  Summary: TDCR model
5
5
  Home-page: https://pypi.org/project/TDCRPy/
6
6
  Author: RomainCoulon (Romain Coulon)
7
7
  Author-email: <romain.coulon@bipm.org>
8
- License: MIT
9
8
  Project-URL: Documentation, https://github.com/RomainCoulon/TDCRPy/
10
9
  Keywords: Python,TDCR,Monte-Carlo,radionuclide,scintillation,counting
11
10
  Classifier: Development Status :: 4 - Beta
@@ -1,9 +1,9 @@
1
- tdcrpy/TDCRPy.py,sha256=Bum4D8UYnWrr2Fa--2RdvvpTaeqIZ4KGc2o230hyt8A,53469
1
+ tdcrpy/TDCRPy.py,sha256=PTLcVHocXvnkO-LmDbWTtMCMfdUavveB-YtOFNGHtIM,53603
2
2
  tdcrpy/TDCRPy1.py,sha256=QTBZh5B5JWnGB0BQfD-cFmwA9W080OD4sG-aj50-ejo,38106
3
- tdcrpy/TDCR_model_lib.py,sha256=k1SYxO5qZyL-IOn-EX465zXa8H4DY8eNZHqVqlkoI8k,98155
3
+ tdcrpy/TDCR_model_lib.py,sha256=pXzxdFEheBHHBbwbqi2CLNezgiIThm9tkAyIJ8NQdRg,98155
4
4
  tdcrpy/TDCRoptimize.py,sha256=c2XIGveeLdVYYek4Rg6dygMvVA2xIrIkMb3L-_jUucM,6496
5
5
  tdcrpy/__init__.py,sha256=vQslGLsoZPIceaitnSHOqN6lUdjEyJ3YhfJ6tYdXt-s,127
6
- tdcrpy/config.toml,sha256=Qm7_Mo3nBKUfNLqhUMP4zA-pjNksy9DzRb7LVR135oY,1876
6
+ tdcrpy/config.toml,sha256=rHuuM520HZquGrEd8LAVUdvnzZGtk90pigudy-MXnm8,1389
7
7
  tdcrpy/test2.py,sha256=poLLXJyIaCeqh1VSkwgbi-udvY7lQjxz_YStKjJXGhU,501
8
8
  tdcrpy/EfficiencyCurves/Ag-108/EffD_Ag-108_[1]_1e-05.txt,sha256=OUoMuqPTw3fXLu5qaHUFN2iW0dPJ9cRyh99a6mUcEus,43
9
9
  tdcrpy/EfficiencyCurves/Ag-108/EffS_Ag-108_[1]_1e-05.txt,sha256=hojCq_MFAw8ONjoDmQfeE9gCXISwhScgAk-N0Pjbg00,45
@@ -1079,9 +1079,9 @@ tdcrpy/docs/_build/html/search.html,sha256=IeTP6CsRdqKWOJttbtskg1oBgdN8norKlzai4
1079
1079
  tdcrpy/docs/_build/html/source/modules.html,sha256=Jf-qxVBId0UgpwyvYuyjtMNG-ezPOK1oH_IxRXAWTRs,3601
1080
1080
  tdcrpy/docs/_build/html/source/tdcrpy.html,sha256=-38lHMNFB22p1tWJEeN3yDqfDiCYE304vxDamO1-iRc,3779
1081
1081
  tdcrpy/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1082
- tdcrpy/test/test_tdcrpy.py,sha256=3b9PeT2ROGGEFM_G4EVlDQMdP4B3ONp4a0kh1bKyVkI,4003
1083
- TDCRPy-1.8.17.dist-info/LICENCE.md,sha256=ZTpWyGU3qv_iwEpgvCijoCuCYpOPpyzJCgOk46WpUKU,1066
1084
- TDCRPy-1.8.17.dist-info/METADATA,sha256=Tc5yJbdrB_ZxyAfbAzqUo9B0LSaDKOAQEfFCUF0J8Ro,16009
1085
- TDCRPy-1.8.17.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
1086
- TDCRPy-1.8.17.dist-info/top_level.txt,sha256=f4vzFFcKSEnonAACs0ZXuRczmroLLqtPTqXFymU_VU0,14
1087
- TDCRPy-1.8.17.dist-info/RECORD,,
1082
+ tdcrpy/test/test_tdcrpy.py,sha256=MTMiE0N7RiyE8Rom2Yu8kCDR03pJga9D6_o7wr7leVA,4675
1083
+ TDCRPy-1.9.0.dist-info/LICENCE.md,sha256=ZTpWyGU3qv_iwEpgvCijoCuCYpOPpyzJCgOk46WpUKU,1066
1084
+ TDCRPy-1.9.0.dist-info/METADATA,sha256=9EclWWZsFjnCopuEJDOI2yuJHFwR8-B-m9M67mWpI-4,15995
1085
+ TDCRPy-1.9.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
1086
+ TDCRPy-1.9.0.dist-info/top_level.txt,sha256=f4vzFFcKSEnonAACs0ZXuRczmroLLqtPTqXFymU_VU0,14
1087
+ TDCRPy-1.9.0.dist-info/RECORD,,
tdcrpy/TDCRPy.py CHANGED
@@ -10,8 +10,6 @@ Bureau International des Poids et Mesures
10
10
 
11
11
  ## IMPORT PYTHON MODULES
12
12
  import tdcrpy.TDCR_model_lib as tl
13
- # import TDCR_model_lib as tl
14
- # import tdcrpy.TDCR_model_lib as tl
15
13
  import importlib.resources
16
14
  from importlib.resources import files
17
15
  import configparser
@@ -83,7 +81,7 @@ def relaxAtom(daughter_relax,particle_vec,energy_vec,rad,Display=False,uncData=F
83
81
  relaxation = False
84
82
  return particle_vec, energy_vec
85
83
 
86
- def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=False, barp=False,uncData=False):
84
+ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=False, barp=False, Smodel=True, uncData=False):
87
85
  """
88
86
  This is the main function of the TDCRPy package running the Monte-Carlo Triple-to-Double Coincidence Ratio model.
89
87
  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.
@@ -142,6 +140,8 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
142
140
  "True" to display details on the decay sampling. The default is False.
143
141
  barp : Boolean, optional
144
142
  "True" to display the calculation progress. The default is True.
143
+ Smodel : Boolean, optional
144
+ "True" to run the stochastic TDCR model. False to run the analytical caclulation (available only for pure beta emitters).
145
145
 
146
146
  Returns
147
147
  -------
@@ -166,17 +166,10 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
166
166
  file_conf = data_path
167
167
  config.read(file_conf)
168
168
  tau=config["Inputs"].getfloat("tau")
169
- Y=config["Inputs"].getboolean("Y")
170
169
  micCorr=config["Inputs"].getboolean("micCorr")
171
- radListPureBeta=config["Inputs"].get("radListPureBeta")
172
- radListPureBeta=radListPureBeta.replace(" ","")
173
- radListPureBeta=radListPureBeta.split(',')
174
- X = Rad in radListPureBeta
175
- if X:
176
- nElist=config["Inputs"].get("nE")
177
- nElist=nElist.split(',')
178
- nElist = [int(i) for i in nElist]
179
- if X and Y:
170
+ radListPureBeta = ["H-3", "C-14", "S-35", "Ca-45", "Ni-63", "Sr-89", "Sr-90", "Tc-99", "Pm-147", "Pu-241"]
171
+ if (Rad in radListPureBeta) and (not Smodel):
172
+ nElist = [7000, 1000, 1000, 500, 2000, 500, 200, 500, 1000, 7000] # discretization
180
173
  inE = radListPureBeta.index(Rad)
181
174
  nE = nElist[inE]
182
175
  print(f"Analytical model used for {Rad}")
@@ -185,6 +178,8 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
185
178
  return out
186
179
  if mode == "eff":
187
180
  return out[0], 0, out[1], 0, out[2], 0
181
+ elif (not Smodel) and (not Rad in radListPureBeta):
182
+ print("cannot be processed by the analytical model.")
188
183
  else:
189
184
  nE_electron = config["Inputs"].getint("nE_electron")
190
185
  nE_alpha = config["Inputs"].getint("nE_alpha")
@@ -830,16 +825,17 @@ def TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=Fals
830
825
  # TAB = 0.992232838598821
831
826
  # TBC = 0.992343419459002
832
827
  # TAC = 0.99275350064608
833
- # Rad="Fe-55"
828
+ # Rad="H-3"
834
829
  # pmf_1="1"
835
- # N = 10
830
+ # N = 100
836
831
  # kB =1.0e-5
837
832
  # V = 10
838
833
  # mode = "eff"
839
834
  # mode2 = "sym"
840
835
 
841
- # out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=True, barp=False,uncData=False)
836
+ # out = TDCRPy(L, TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, V, mode, mode2, Display=False, barp=False, Smodel=False, uncData=False)
842
837
 
838
+ # print(out)
843
839
 
844
840
  # L = 1
845
841
  # TD = 0.977667386529166
tdcrpy/TDCR_model_lib.py CHANGED
@@ -2385,7 +2385,7 @@ def modelAnalytical(L,TD,TAB,TBC,TAC,rad,kB,V,mode,mode2,ne):
2385
2385
  for i, ei in enumerate(e):
2386
2386
  # ed = energie_dep_beta2(ei,V)
2387
2387
  # em[i] = E_quench_e(ei*1e3,ed*1e3,kB*1e3,ne)*1e-3
2388
- em[i] = Em_e(ei*1e3,ed*1e3,kB*1e3,ne)*1e-3
2388
+ em[i] = Em_e(ei*1e3,ei*1e3,kB*1e3,ne)*1e-3
2389
2389
 
2390
2390
 
2391
2391
  if mode2=="sym":
tdcrpy/config.toml CHANGED
@@ -1,16 +1,7 @@
1
1
  ## This is the configuration file of the TDCRPy code
2
2
 
3
3
  [Inputs]
4
- ## CASE OF PURE BETA PARTICLE EMITTING RADIONUCLIDES
5
- # Analytical model for pure beta emitting radionuclides (True or False)
6
- Y = True
7
- # List of radionuclides for which the analytical model is applied
8
- radListPureBeta = H-3, C-14, S-35, Ca-45, Ni-63, Sr-89, Sr-90, Tc-99, Pm-147, Pu-241
9
- # Number of bins to discretize the linear energy space for quenching calculation
10
- # and achieve a relative standard uncertainty below 1e-4.
11
- nE = 7000, 1000, 1000, 500, 2000, 500, 200, 500, 1000, 7000
12
-
13
- ## OTHER CASES
4
+ ## QUENCHING
14
5
  # Number of bins to discretize the linear energy space for quenching calculation
15
6
  # to achieve a relative standard uncertainty below 1e-4 on the estimated quenched energy: nE_electron = nE_alpha = 10000
16
7
  # to achieve a relative standard uncertainty below 1e-3 on the estimated quenched energy: nE_electron = nE_alpha = 1000
@@ -43,8 +43,12 @@ class TestMyModule(unittest.TestCase):
43
43
 
44
44
  def test_readBetaShape(self):
45
45
  result = np.mean(tdcrpy.TDCR_model_lib.readBetaShape("H-3","beta-","tot"))
46
- self.assertEqual(result, 4.661876602564102)
47
-
46
+ self.assertEqual(result, 4.661922025723472)
47
+
48
+ def test_readBetaSpectra(self):
49
+ result = np.mean(tdcrpy.TDCR_model_lib.readBetaSpectra("H-3"))
50
+ self.assertEqual(result, 4.6155)
51
+
48
52
  def test_E_quench_e(self):
49
53
  result = np.mean(tdcrpy.TDCR_model_lib.E_quench_e(100*1e3,100*1e3,0.01,20000)*1e-3)
50
54
  self.assertEqual(result, 91.24694728992633)
@@ -55,54 +59,71 @@ class TestMyModule(unittest.TestCase):
55
59
 
56
60
  def test_E_quench_a(self):
57
61
  result = np.mean(tdcrpy.TDCR_model_lib.E_quench_a(5000,1e-5,20000))
58
- self.assertEqual(result, 344.0835545240962)
62
+ self.assertEqual(result, 344.28633759073443)
63
+
64
+ # run_interpolate tested inside Em_a() and Em_e()
65
+
66
+ def test_Em_a(self):
67
+ result = tdcrpy.TDCR_model_lib.Em_a(5000, 1e-5, 10000)
68
+ self.assertLessEqual(result, 344.12105896)
69
+
70
+ def test_Em_e(self):
71
+ result = tdcrpy.TDCR_model_lib.Em_e(50000, 50000, 1e-5, 10000)
72
+ self.assertLessEqual(result, 48568.14392205286)
73
+
74
+ def test_Em_e2(self):
75
+ result = tdcrpy.TDCR_model_lib.Em_e(50000, 25000, 1e-5, 10000)
76
+ self.assertLessEqual(result, 25000.754895953367)
77
+
78
+ def test_micelleLoss(self):
79
+ result = tdcrpy.TDCR_model_lib.micelleLoss(5)
80
+ self.assertLessEqual(result, 0.9)
81
+
82
+ def test_micelleLoss2(self):
83
+ result = tdcrpy.TDCR_model_lib.micelleLoss(0.2)
84
+ self.assertLessEqual(result, 0.86)
59
85
 
60
86
  def test_read_matrice(self):
61
87
  result = tdcrpy.TDCR_model_lib.read_matrice(fp1,0)[50][50]
62
88
  self.assertEqual(result, 0.000718)
63
-
89
+
90
+ # energie_dep_gamma() no more used.
91
+
64
92
  def test_energie_dep_gamma(self):
65
- result = tdcrpy.TDCR_model_lib.energie_dep_gamma(100,10)
93
+ result = tdcrpy.TDCR_model_lib.energie_dep_gamma2(100,10)
66
94
  self.assertLessEqual(result, 100)
67
-
68
- # def test_energie_dep_gamma2(self):
69
- # result = tdcrpy.TDCR_model_lib.energie_dep_gamma2(100,13)
70
- # self.assertLessEqual(result, 100)
71
-
95
+
96
+ # energie_dep_beta() no more used.
97
+
72
98
  def test_energie_dep_beta(self):
73
- result = tdcrpy.TDCR_model_lib.energie_dep_beta(100)
99
+ result = tdcrpy.TDCR_model_lib.energie_dep_beta2(100,10)
74
100
  self.assertLessEqual(result, 100)
75
101
 
76
- # def test_energie_dep_beta2(self):
77
- # result = tdcrpy.TDCR_model_lib.energie_dep_beta2(100)
78
- # self.assertLessEqual(result, 100)
79
-
80
- # writeEffcurves(x,y,uy,rad,p,kB,SDT)
102
+ # writeEffcurves() no more used.
81
103
 
82
104
  def test_transf_name(self):
83
105
  result = tdcrpy.TDCR_model_lib.transf_name("108Ag")
84
106
  self.assertLessEqual(result, "Ag108")
85
107
 
86
- def test_readEShape(self):
87
- result = tdcrpy.TDCR_model_lib.readEShape("Ag-108")
88
- self.assertLessEqual(result[0], ['PD108', 'CD108'])
89
- self.assertLessEqual(result[1][0], [21.0203, 21.1774, 23.874466666666667, 24.3217, 20.580333333333332, 2.65])
90
- self.assertLessEqual(result[2][0], [0.44, 0.84, 0.23, 0.0391, 0.341, 1.97])
91
-
92
- def test_Em_a(self):
93
- result = tdcrpy.TDCR_model_lib.Em_a(5000, 1e-5, 10000)
94
- self.assertLessEqual(result, 344.12105896)
108
+ def test_read_ENSDF(self):
109
+ result = tdcrpy.TDCR_model_lib.read_ENSDF("Co-60")
110
+ self.assertLessEqual(result[0][0], 'NI60')
95
111
 
96
- def test_Em_e(self):
97
- result = tdcrpy.TDCR_model_lib.Em_e(50000, 50000, 1e-5, 10000)
98
- self.assertLessEqual(result, 48568.14392205286)
112
+ def test_incer(self):
113
+ result = tdcrpy.TDCR_model_lib.incer(["0.9", "0.2"],["1", "1"])
114
+ self.assertLessEqual(result, [[1.0], [1.0]])
99
115
 
100
- def test_Em_e2(self):
101
- result = tdcrpy.TDCR_model_lib.Em_e(50000, 25000, 1e-5, 10000)
102
- self.assertLessEqual(result, 25000.754895953367)
116
+ def test_relaxation_atom(self):
117
+ result = tdcrpy.TDCR_model_lib.relaxation_atom("NI60","Co-60",lacune="Atom_L")
118
+ self.assertLessEqual(result, ('Auger L', 0.8))
103
119
 
104
-
105
- # relaxation_atom(daugther,rad,lacune='defaut')
120
+ def test_format_modif(self):
121
+ result = tdcrpy.TDCR_model_lib.format_modif("17-3")
122
+ self.assertLessEqual(result, '17E-3')
123
+
124
+ def test_reperer_energie_index(self):
125
+ result = tdcrpy.TDCR_model_lib.reperer_energie_index(17,[5,11,13,17,52,64])
126
+ self.assertLessEqual(result, 3)
106
127
 
107
128
  # modelAnalytical(L,TD,TAB,TBC,TAC,rad,kB,V,mode,mode2,ne)
108
129