TDCRPy 0.0.29__tar.gz → 0.0.31__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.
- {TDCRPy-0.0.29/TDCRPy.egg-info → TDCRPy-0.0.31}/PKG-INFO +1 -1
- {TDCRPy-0.0.29 → TDCRPy-0.0.31/TDCRPy.egg-info}/PKG-INFO +1 -1
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/setup.py +1 -1
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/tdcrpy/TDCR_model_lib.py +15 -25
- TDCRPy-0.0.31/tdcrpy/TDCRoptimize.py +89 -0
- TDCRPy-0.0.31/tdcrpy/test.py +9 -0
- TDCRPy-0.0.29/tdcrpy/TDCRoptimize.py +0 -99
- TDCRPy-0.0.29/tdcrpy/test.py +0 -12
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/LICENCE.md +0 -0
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/MANIFEST.in +0 -0
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/README.md +0 -0
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/TDCRPy.egg-info/SOURCES.txt +0 -0
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/TDCRPy.egg-info/dependency_links.txt +0 -0
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/TDCRPy.egg-info/requires.txt +0 -0
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/TDCRPy.egg-info/top_level.txt +0 -0
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/setup.cfg +0 -0
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/tdcrpy/Activity_TDCR.py +0 -0
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/tdcrpy/EfficiencyProfils.py +0 -0
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/tdcrpy/TDCRPy.py +0 -0
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/tdcrpy/__init__.py +0 -0
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/tdcrpy/decay.py +0 -0
- {TDCRPy-0.0.29 → TDCRPy-0.0.31}/tdcrpy/test1.py +0 -0
|
@@ -1388,7 +1388,10 @@ def energie_dep_gamma(e_inci,v,matrice10_1=Matrice10_p_1,matrice10_2=Matrice10_p
|
|
|
1388
1388
|
"""
|
|
1389
1389
|
## sort keV / entrée : keV
|
|
1390
1390
|
if e_inci <= 200:
|
|
1391
|
-
|
|
1391
|
+
if e_inci < 200:
|
|
1392
|
+
index = int(e_inci)-1 # index de colonne de la matrice de l'énergie incidente la plus proche
|
|
1393
|
+
elif e_inci == 200:
|
|
1394
|
+
index = -1
|
|
1392
1395
|
if v == 10:
|
|
1393
1396
|
matrice = matrice10_1
|
|
1394
1397
|
elif v == 16:
|
|
@@ -1401,27 +1404,13 @@ def energie_dep_gamma(e_inci,v,matrice10_1=Matrice10_p_1,matrice10_2=Matrice10_p
|
|
|
1401
1404
|
matrice = matrice10_2
|
|
1402
1405
|
elif v == 16:
|
|
1403
1406
|
matrice = matrice16_2
|
|
1404
|
-
#taille_x = 901
|
|
1405
1407
|
e = ed[:,1]
|
|
1406
1408
|
|
|
1407
1409
|
else:
|
|
1408
1410
|
index = (int(e_inci)-2000)//10
|
|
1409
|
-
|
|
1410
|
-
matrice = matrice3
|
|
1411
|
-
#taille_x = 801
|
|
1411
|
+
matrice = matrice10_3
|
|
1412
1412
|
e = ed[:,2]
|
|
1413
1413
|
|
|
1414
|
-
'''
|
|
1415
|
-
with open(doc) as f:
|
|
1416
|
-
data = f.readlines()
|
|
1417
|
-
|
|
1418
|
-
matrice = np.zeros((1002,taille_x))
|
|
1419
|
-
|
|
1420
|
-
for i in range(1002):
|
|
1421
|
-
data[i] = data[i].split()
|
|
1422
|
-
for j in range(taille_x):
|
|
1423
|
-
matrice[i][j] = float(data[i][j])
|
|
1424
|
-
'''
|
|
1425
1414
|
inde = sampling(matrice[1:,index])
|
|
1426
1415
|
if inde == 1 : result = 0
|
|
1427
1416
|
#elif e_inci<25: result = e[inde-1]*1e3*e_inci/matrice[0][index]
|
|
@@ -1434,9 +1423,9 @@ def energie_dep_gamma(e_inci,v,matrice10_1=Matrice10_p_1,matrice10_2=Matrice10_p
|
|
|
1434
1423
|
|
|
1435
1424
|
|
|
1436
1425
|
if absolutePath:
|
|
1437
|
-
fe1 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/
|
|
1438
|
-
fe2 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/
|
|
1439
|
-
fe3 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/
|
|
1426
|
+
fe1 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/matrice_10ml-beta-_1_200k.txt' # electron-10ml-1-200keV-niveau 0
|
|
1427
|
+
fe2 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/matrice_10ml-beta-_200_2000k.txt' # electron-10ml-200-2000keV-niveau 1
|
|
1428
|
+
fe3 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/matrice_10ml-beta-_2000_10000k.txt' # electron-10ml-2000-10000keV-niveau 2
|
|
1440
1429
|
fe = "G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/E_depose.txt" # electron-10ml-énergie-niveau 'e'
|
|
1441
1430
|
else:
|
|
1442
1431
|
# fe1 = 'MCNP-MATRIX/matrice/fichier/matrice_beta-_1_200k.txt' # electron-10ml-1-200keV-niveau 0
|
|
@@ -1444,9 +1433,9 @@ else:
|
|
|
1444
1433
|
# fe3 = 'MCNP-MATRIX/matrice/fichier/matrice_beta-_2000_10000k.txt' # electron-10ml-2000-10000keV-niveau 2
|
|
1445
1434
|
# fe = "MCNP-MATRIX/matrice/fichier/E_depose.txt" # electron-10ml-énergie-niveau 'e'
|
|
1446
1435
|
with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
|
|
1447
|
-
fe1 = data_path / 'matrice/fichier/
|
|
1448
|
-
fe2 = data_path / 'matrice/fichier/
|
|
1449
|
-
fe3 = data_path / 'matrice/fichier/
|
|
1436
|
+
fe1 = data_path / 'matrice/fichier/matrice_10ml-beta-_1_200k.txt' # electron-10ml-1-200keV-niveau 0
|
|
1437
|
+
fe2 = data_path / 'matrice/fichier/matrice_10ml-beta-_200_2000k.txt' # electron-10ml-200-2000keV-niveau 1
|
|
1438
|
+
fe3 = data_path / 'matrice/fichier/matrice_10ml-beta-_2000_10000k.txt' # electron-10ml-2000-10000keV-niveau 2
|
|
1450
1439
|
fe = data_path / 'matrice/fichier/E_depose.txt' # electron-10ml-énergie-niveau 'e'
|
|
1451
1440
|
|
|
1452
1441
|
|
|
@@ -1483,10 +1472,11 @@ def energie_dep_beta(e_inci,*,matrice10_1=Matrice10_e_1,matrice10_2=Matrice10_e_
|
|
|
1483
1472
|
"""
|
|
1484
1473
|
## sort keV / entrée : keV
|
|
1485
1474
|
if e_inci <= 200:
|
|
1486
|
-
|
|
1487
|
-
|
|
1475
|
+
if e_inci < 200:
|
|
1476
|
+
index = int(e_inci)-1 # index de colonne de la matrice de l'énergie incidente la plus proche
|
|
1477
|
+
elif e_inci == 200:
|
|
1478
|
+
index = -1
|
|
1488
1479
|
matrice = matrice10_1
|
|
1489
|
-
#taille_x = 200
|
|
1490
1480
|
e = ed[:,0]
|
|
1491
1481
|
|
|
1492
1482
|
elif e_inci <= 2000:
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Created on Wed Jul 5 10:04:53 2023
|
|
4
|
+
|
|
5
|
+
@author: romain.coulon, jialin.hu
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import numpy as np
|
|
9
|
+
import tdcrpy.TDCRPy as td
|
|
10
|
+
import scipy.optimize as opt
|
|
11
|
+
# import sys, time
|
|
12
|
+
# sys.path.insert(1, 'G:\Python_modules\BIPM_RI_PyModules')
|
|
13
|
+
# import TDCRcalculation as tc
|
|
14
|
+
|
|
15
|
+
def eff(TD, TAB, TBC, TAC, Rad, pmf_1, kB, mode2, N=1000, RHO=0.98, nE=1000, L=1):
|
|
16
|
+
"""
|
|
17
|
+
Caclulation of the efficiency of a TDCR system based on the model TDCRPy
|
|
18
|
+
|
|
19
|
+
Parameters
|
|
20
|
+
----------
|
|
21
|
+
TD : float
|
|
22
|
+
triple-to-double coincidence ratio. Not consider if mode2="asym". Not consider if mode2="asym".
|
|
23
|
+
TAB : float
|
|
24
|
+
triple-to-double coincidence ratio (coincidences between channel A and B). Not consider if mode2="sym".
|
|
25
|
+
TBC : float
|
|
26
|
+
triple-to-double coincidence ratio (coincidences between channel B and C). Not consider if mode2="sym".
|
|
27
|
+
TAC : float
|
|
28
|
+
triple-to-double coincidence ratio (coincidences between channel A and C). Not consider if mode2="sym".
|
|
29
|
+
Rad : string
|
|
30
|
+
List of radionuclides.
|
|
31
|
+
pmf_1 : string
|
|
32
|
+
list of probability of each radionuclide..
|
|
33
|
+
kB : float
|
|
34
|
+
Birks constant.
|
|
35
|
+
mode2 : string
|
|
36
|
+
"sym" for symetrical model, "asym" for symetrical model.
|
|
37
|
+
N : interger, optional
|
|
38
|
+
number of Monte-Carlo trials. The default is 1000.
|
|
39
|
+
RHO : float, optional
|
|
40
|
+
density of the source. The default is 0.98.
|
|
41
|
+
nE : interger, optional
|
|
42
|
+
number of bins for the quenching function. The default is 1000.
|
|
43
|
+
L : float, optional
|
|
44
|
+
free parameter(s) as initial guess. The default is 1.
|
|
45
|
+
|
|
46
|
+
Returns
|
|
47
|
+
-------
|
|
48
|
+
L0 : float
|
|
49
|
+
global free parameter.
|
|
50
|
+
L : tuple or float
|
|
51
|
+
free parameters (relevant for the asymetric model).
|
|
52
|
+
eff_S : float
|
|
53
|
+
counting efficiency of single events.
|
|
54
|
+
u_eff_S : float
|
|
55
|
+
standard uncertainty of eff_S.
|
|
56
|
+
eff_D : float
|
|
57
|
+
counting efficiency of double coincidences.
|
|
58
|
+
u_eff_D : float
|
|
59
|
+
standard uncertainty of eff_D.
|
|
60
|
+
eff_T : float
|
|
61
|
+
counting efficiency of triple coincidences.
|
|
62
|
+
u_eff_T : float
|
|
63
|
+
standard uncertainty of eff_T.
|
|
64
|
+
|
|
65
|
+
"""
|
|
66
|
+
# Estimation of the free parameter that minimize the residuals
|
|
67
|
+
r=opt.minimize_scalar(td.TDCRPy, args=(TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, RHO, nE, "res", "sym"), method='bounded', bounds=[0.5, 2])
|
|
68
|
+
L=r.x
|
|
69
|
+
print(r)
|
|
70
|
+
|
|
71
|
+
if mode2 == "asym":
|
|
72
|
+
L=(L, L, L) # Free paramete in keV-1
|
|
73
|
+
r=opt.minimize(td.TDCRPy, L, args=(TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, RHO, nE, "res", "asym"), method='nelder-mead',options={'xatol': 1e-7, 'disp': True, 'maxiter':100})
|
|
74
|
+
L=r.x
|
|
75
|
+
print(r)
|
|
76
|
+
out=td.TDCRPy(L,TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, RHO, nE, "eff", "asym")
|
|
77
|
+
else:
|
|
78
|
+
out=td.TDCRPy(L,TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, RHO, nE, "eff", "sym")
|
|
79
|
+
|
|
80
|
+
L0 = np.mean(L)
|
|
81
|
+
eff_S = out[0]
|
|
82
|
+
u_eff_S = out[1]
|
|
83
|
+
eff_D = out[2]
|
|
84
|
+
u_eff_D = out[3]
|
|
85
|
+
eff_T = out[4]
|
|
86
|
+
u_eff_T = out[5]
|
|
87
|
+
|
|
88
|
+
return L0, L, eff_S, u_eff_S, eff_D, u_eff_D, eff_T, u_eff_T
|
|
89
|
+
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""
|
|
3
|
-
Created on Wed Jul 5 10:04:53 2023
|
|
4
|
-
|
|
5
|
-
@author: romain.coulon
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
import numpy as np
|
|
9
|
-
import tdcrpy.TDCRPy as td
|
|
10
|
-
import scipy.optimize as opt
|
|
11
|
-
import sys, time
|
|
12
|
-
# sys.path.insert(1, 'G:\Python_modules\BIPM_RI_PyModules')
|
|
13
|
-
# import TDCRcalculation as tc
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def eff(TDCR_measure, TAB, TBC, TAC, Rad, kB):
|
|
18
|
-
|
|
19
|
-
N=50000
|
|
20
|
-
L=1
|
|
21
|
-
# r=opt.minimize_scalar(td.TDCRPy, args=(TDCR_measure, TAB, TBC, TAC, Rad, "1", N, kB, 0.98, 1000, "res", "sym"), method='golden')#,options={'xatol': 1e-7, 'disp': True, 'maxiter':100})
|
|
22
|
-
# r=opt.minimize_scalar(td.TDCRPy, args=(TDCR_measure, TAB, TBC, TAC, Rad, "1", N, kB, 0.98, 1000, "res", "sym"), method='brent')
|
|
23
|
-
r=opt.minimize_scalar(td.TDCRPy, args=(TDCR_measure, TAB, TBC, TAC, Rad, "1", N, kB, 0.98, 1000, "res", "sym"), method='bounded', bounds=[0.5, 2])
|
|
24
|
-
|
|
25
|
-
# r=opt.minimize(td.TDCRPy, L, args=(TDCR_measure, TAB, TBC, TAC, Rad, "1", N, kB, 0.98, 1000, "res", "sym"), method='nelder-mead',options={'xatol': 1e-7, 'disp': True, 'maxiter':100})
|
|
26
|
-
L=r.x
|
|
27
|
-
print(r)
|
|
28
|
-
#L=(L*0.995, L*1.021, L*0.988) # Free paramete in keV-1
|
|
29
|
-
# L = (L, L, L)
|
|
30
|
-
# r=opt.minimize(td.TDCRPy, L, args=(TDCR_measure, TAB, TBC, TAC, Rad, "1", N, kB, 0.98, 1000, "res", "asym"), method='nelder-mead',options={'xatol': 1e-7, 'disp': True, 'maxiter':100})
|
|
31
|
-
# L=r.x
|
|
32
|
-
# print(r)
|
|
33
|
-
out=td.TDCRPy(L,TDCR_measure, TAB, TBC, TAC, Rad, "1", N, kB, 0.98, 1000, "eff", "sym")
|
|
34
|
-
return np.mean(L), L, out[2], out[2], out[3]
|
|
35
|
-
|
|
36
|
-
def TicTocGenerator():
|
|
37
|
-
"""
|
|
38
|
-
Generator that returns time differences
|
|
39
|
-
"""
|
|
40
|
-
ti = 0 # initial time
|
|
41
|
-
tf = time.time() # final time
|
|
42
|
-
while True:
|
|
43
|
-
ti = tf
|
|
44
|
-
tf = time.time()
|
|
45
|
-
yield tf-ti # returns the time difference
|
|
46
|
-
|
|
47
|
-
TicToc = TicTocGenerator() # create an instance of the TicTocGen generator
|
|
48
|
-
|
|
49
|
-
# This will be the main function through which we define both tic() and toc()
|
|
50
|
-
def toc(tempBool=True):
|
|
51
|
-
"""
|
|
52
|
-
Prints the time difference yielded by generator instance TicToc
|
|
53
|
-
"""
|
|
54
|
-
|
|
55
|
-
tempTimeInterval = next(TicToc)
|
|
56
|
-
if tempBool:
|
|
57
|
-
print( "Elapsed time: %f seconds.\n" %tempTimeInterval )
|
|
58
|
-
|
|
59
|
-
def tic():
|
|
60
|
-
"""
|
|
61
|
-
Records a time in TicToc, marks the beginning of a time interval
|
|
62
|
-
"""
|
|
63
|
-
toc(False)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"""
|
|
67
|
-
TEST
|
|
68
|
-
"""
|
|
69
|
-
|
|
70
|
-
# Rad="Co-60" # list of radionuclides (Na-24)
|
|
71
|
-
# kB =1.0e-5 # Birks constant in cm/keV
|
|
72
|
-
# TDCR_measure = 0.977667386529166 # Measured TDCR value
|
|
73
|
-
# TAB = 0.992232838598821
|
|
74
|
-
# TBC = 0.992343419459002
|
|
75
|
-
# TAC = 0.99275350064608
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
# # tic()
|
|
80
|
-
# # F1, FFF, eff1, eff2 = tc.I2calc(TDCR_measure, TAB, TBC, TAC, Rad, kB)
|
|
81
|
-
# # toc()
|
|
82
|
-
|
|
83
|
-
# # print("/nanalytical model")
|
|
84
|
-
# # print("free parameter = ", F1)
|
|
85
|
-
# # print("free parameters = ", FFF)
|
|
86
|
-
# # print("Double count rate efficiency (sym) = ", eff1)
|
|
87
|
-
# # print("Double count rate efficiency (asym) = ", eff2)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
# tic()
|
|
91
|
-
# F1, FFF, eff1, eff2, u = eff(TDCR_measure, TAB, TBC, TAC, Rad, kB)
|
|
92
|
-
# toc()
|
|
93
|
-
|
|
94
|
-
# print("/nstochastic model")
|
|
95
|
-
# print("free parameter = ", F1)
|
|
96
|
-
# print("free parameters = ", FFF)
|
|
97
|
-
# print("Double count rate efficiency (sym) = ", eff1)
|
|
98
|
-
# print("Double count rate efficiency (asym) = ", eff2)
|
|
99
|
-
# print("u(eff) = ", u)
|
TDCRPy-0.0.29/tdcrpy/test.py
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""
|
|
3
|
-
Created on Thu Jul 13 19:15:23 2023
|
|
4
|
-
|
|
5
|
-
@author: romain.coulon
|
|
6
|
-
"""
|
|
7
|
-
import TDCRPy
|
|
8
|
-
|
|
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)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|