TDCRPy 0.0.30__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TDCRPy
3
- Version: 0.0.30
3
+ Version: 0.0.31
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: 0.0.30
3
+ Version: 0.0.31
4
4
  Summary: TDCR model
5
5
  Home-page: https://github.com/RomainCoulon/TDCRPy
6
6
  Author: RomainCoulon (Romain Coulon)
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
  import codecs
3
3
  import os
4
4
 
5
- VERSION = "0.0.30"
5
+ VERSION = "0.0.31"
6
6
  DESCRIPTION = "TDCR model"
7
7
 
8
8
  with open("README.md", "r") as f:
@@ -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
- index = int(e_inci) # index de colonne de la matrice de l'énergie incidente la plus proche
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
- #doc = 'MCNP-MATRIX/matrice/matrice_p_2000_10000k.txt'
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/matrice_beta-_1_200k.txt' # electron-10ml-1-200keV-niveau 0
1438
- fe2 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/matrice_beta-_200_2000k.txt' # electron-10ml-200-2000keV-niveau 1
1439
- fe3 = 'G:\Python_modules\Jialin\Code\\MCNP-MATRIX/matrice/fichier/matrice_beta-_2000_10000k.txt' # electron-10ml-2000-10000keV-niveau 2
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/matrice_beta-_1_200k.txt' # electron-10ml-1-200keV-niveau 0
1448
- fe2 = data_path / 'matrice/fichier/matrice_beta-_200_2000k.txt' # electron-10ml-200-2000keV-niveau 1
1449
- fe3 = data_path / 'matrice/fichier/matrice_beta-_2000_10000k.txt' # electron-10ml-2000-10000keV-niveau 2
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
- index = int(e_inci) # index de colonne de la matrice de l'énergie incidente la plus proche
1487
- #doc = 'MCNP-MATRIX/matrice/matrice_p_1_200k.txt'
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,76 +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
- 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
- L : TYPE
22
- DESCRIPTION.
23
- TD : TYPE
24
- DESCRIPTION.
25
- TAB : TYPE
26
- DESCRIPTION.
27
- TBC : TYPE
28
- DESCRIPTION.
29
- TAC : TYPE
30
- DESCRIPTION.
31
- Rad : TYPE
32
- DESCRIPTION.
33
- pmf_1 : TYPE
34
- DESCRIPTION.
35
- kB : TYPE
36
- DESCRIPTION.
37
- mode2 : TYPE
38
- DESCRIPTION.
39
- N : TYPE, optional
40
- DESCRIPTION. The default is 1000.
41
- RHO : TYPE, optional
42
- DESCRIPTION. The default is 098.
43
- nE : TYPE, optional
44
- DESCRIPTION. The default is 1000.
45
- L : TYPE, optional
46
- DESCRIPTION. The default is 1.
47
-
48
- Returns
49
- -------
50
- TYPE
51
- DESCRIPTION.
52
- L : TYPE
53
- DESCRIPTION.
54
- TYPE
55
- DESCRIPTION.
56
- TYPE
57
- DESCRIPTION.
58
- TYPE
59
- DESCRIPTION.
60
-
61
- """
62
- # Estimation of the free parameter that minimize the residuals
63
- 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])
64
- L=r.x
65
- print(r)
66
-
67
- if mode2 == "asym":
68
- L=(L, L, L) # Free paramete in keV-1
69
- 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})
70
- L=r.x
71
- print(r)
72
- out=td.TDCRPy(L,TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, RHO, nE, "eff", "asym")
73
- else:
74
- out=td.TDCRPy(L,TD, TAB, TBC, TAC, Rad, pmf_1, N, kB, RHO, nE, "eff", "sym")
75
- return np.mean(L), L, out[2], out[2], out[3]
76
-
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