TDCRPy 1.1.3__py3-none-any.whl → 1.1.4__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/TDCR_model_lib.py CHANGED
@@ -71,6 +71,19 @@ with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
71
71
  fe5 = data_path / 'matrice/fichier/matrice_16ml-beta-_200_2000k.txt' # electron-16ml-1-200keV-niveau 1
72
72
  fe = data_path / 'matrice/fichier/E_depose.txt' # electron-10ml-énergie-niveau 'e'
73
73
 
74
+ # import beta spectra calculated for the analytical model (BetaShape + MCNP6 calculation)
75
+ with importlib.resources.path('tdcrpy', 'MCNP-MATRIX') as data_path:
76
+ sH3 = data_path / 'matrice/Spectra_for_analytical_model/dep_spectrum_H-3.txt'
77
+ sC14 = data_path / 'matrice/Spectra_for_analytical_model/dep_spectrum_C-14.txt'
78
+ sS35 = data_path / 'matrice/Spectra_for_analytical_model/dep_spectrum_S-35.txt'
79
+ sCa45 = data_path / 'matrice/Spectra_for_analytical_model/dep_spectrum_Ca-45.txt'
80
+ sNi63 = data_path / 'matrice/Spectra_for_analytical_model/dep_spectrum_Ni-63.txt'
81
+ sSr89 = data_path / 'matrice/Spectra_for_analytical_model/dep_spectrum_Sr-89.txt'
82
+ sSr90 = data_path / 'matrice/Spectra_for_analytical_model/dep_spectrum_Sr-90.txt'
83
+ sTc99 = data_path / 'matrice/Spectra_for_analytical_model/dep_spectrum_Tc-99.txt'
84
+ sPm147 = data_path / 'matrice/Spectra_for_analytical_model/dep_spectrum_Pm-147.txt'
85
+ sPu241 = data_path / 'matrice/Spectra_for_analytical_model/dep_spectrum_Pu-241.txt'
86
+
74
87
  # import stopping power data for electron
75
88
  with importlib.resources.path('tdcrpy', 'Quenching') as data_path:
76
89
  file_TanXia = open(data_path / "TandataUG.txt")
@@ -633,14 +646,56 @@ def readBetaShape(rad,mode,level,z=z_betashape):
633
646
  p=[]
634
647
  for k, p0 in enumerate(dNdx): # deal with the inhomogeneous energy space
635
648
  if k==0:
636
- p.append(p0[k] * (e[k+1])-e[k])
649
+ p.append(p0 * (e[k+1])-e[k])
637
650
  else:
638
- p.append(p0[k] * (e[k]-e[k-1]))
651
+ p.append(p0 * (e[k]-e[k-1]))
639
652
 
640
653
  p /= sum(np.asarray(p)) # normalization
641
654
  p = list(p)
642
655
  return e, p
643
656
 
657
+
658
+ def readBetaSpectra(rad):
659
+ """
660
+ This function reads the deposited energy distribution from beta particles.
661
+ The distribution is built from BetaShape emitted distribution and MCNP6 calculation
662
+
663
+ Parameters
664
+ ----------
665
+ rad : string
666
+ Radionuclide (e.g. "H-3").
667
+
668
+ Returns
669
+ -------
670
+ e : list
671
+ energy vector in keV.
672
+ p : list
673
+ probability density in keV-1.
674
+
675
+ """
676
+ e = []
677
+ p = []
678
+
679
+ if rad == "H-3": file_path = sH3
680
+ elif rad == "C-14": file_path = sC14
681
+ elif rad == "S-35": file_path = sS35
682
+ elif rad == "Ca-45": file_path = sCa45
683
+ elif rad == "Ni-63": file_path = sNi63
684
+ elif rad == "Sr-89": file_path = sSr89
685
+ elif rad == "Sr-90": file_path = sSr90
686
+ elif rad == "Tc-99": file_path = sTc99
687
+ elif rad == "Pm-147": file_path = sPm147
688
+ elif rad == "Pu-241": file_path = sPu241
689
+
690
+ with open(file_path, "r") as file:
691
+ for line in file:
692
+ columns = line.strip().split('\t')
693
+ if len(columns) >= 2:
694
+ e.append(int(columns[0]))
695
+ p.append(columns[1])
696
+ return e, p
697
+
698
+
644
699
  #=======================================================================================
645
700
 
646
701
  #============================ Fonction quenching =====================================
@@ -1489,7 +1544,8 @@ def modelAnalytical(L,TD,TAB,TBC,TAC,rad,kB,V,mode,mode2,ne):
1489
1544
 
1490
1545
  """
1491
1546
 
1492
- e, p = readBetaShape(rad, 'beta-', 'tot')
1547
+ # e, p = readBetaShape(rad, 'beta-', 'tot')
1548
+ e, p = readBetaSpectra(rad)
1493
1549
  em=np.empty(len(e))
1494
1550
  for i, ei in enumerate(e):
1495
1551
  ed = energie_dep_beta(ei)
File without changes