sandy.tsl module
This module contains all classes and functions specific for Thermal Neutron Scattering Data.
class Tsl class acts as a container for temperatura-dependent tabulated thermal neutron scattering cross section.
- class sandy.tsl.Tsl(dct)
Bases:
object
- Attributes:
- data
Methods
from_endf6
(endf6)Extract hierarchical structure of tsl data from sandy.Endf6 instance.
get_S
([kind])Extract stacked S matrix from the Tsl class.
to_endf6
(endf6)Update S matrixs in Endf6 instance with those available in a Tsl instance.
- property data
- classmethod from_endf6(endf6)
Extract hierarchical structure of tsl data from sandy.Endf6 instance.
- Parameters:
- tapesandy.Endf6
instance containing tsl data
- Returns:
- sandy.Tsl
structured container divided into the 3 reaction of the tsl files: elastic coherent scattering, elastic incoherent scattering and inelastic incoherent scattering.
Examples
Load test ENDF-6 file with data for Be-4: >>> tape = sandy.get_endf6_file(“endfb_80”, ‘tsl’, 26) >>> tsl = Tsl.from_endf6(tape)
Coherent elastic scattering: >>> tsl.data[‘elastic coherent’][‘T’].keys() dict_keys([296.0, 400.0, 500.0, 600.0, 700.0, 800.0, 1000.0, 1200.0])
Incoherent inelastic scattering: >>> tsl.data[‘inelastic incoherent’][‘beta’][0.0][‘T’].keys() dict_keys([296.0, 400.0, 500.0, 600.0, 700.0, 800.0, 1000.0, 1200.0])
Incoherent elastic scattering: >>> tape = sandy.get_endf6_file(“endfb_80”, ‘tsl’, 10) >>> tsl = Tsl.from_endf6(tape) >>> tsl.data[‘elastic incoherent’][‘Debye-Waller’] array([14.70372, 19.1224 , 20.37892, 21.65261, 21.97355, 22.94205,
23.26671, 24.24591, 24.57398])
- get_S(kind='elastic coherent')
Extract stacked S matrix from the Tsl class.
- Parameters:
- kindstr, optional
The type of reaction from where the S matrix is going to be extracted. The default is ‘elastic coherent’.
- Returns:
- pd.DataFrame
Stack S matrix.
Notes
Note
In a future, the return of this method is going to be a object of the class S_matrix.
Examples
Load test ENDF-6 file with data for Be-4: >>> tape = sandy.get_endf6_file(“endfb_80”, ‘tsl’, 26) >>> tsl = Tsl.from_endf6(tape)
Elastic coherent S-matrix: >>> tsl.get_S(kind =’elastic coherent’).head()
T E S
0 2.96000e+02 1.62650e-03 0.00000e+00 1 2.96000e+02 5.28450e-03 8.69813e-03 2 2.96000e+02 6.50600e-03 1.91051e-02 3 2.96000e+02 6.91100e-03 6.40282e-02 4 2.96000e+02 1.17905e-02 7.49635e-02
Inelastic incoherent S-matrix: >>> tsl.get_S(kind =’inelastic incoherent’).head()
beta T alpha S
0 0.00000e+00 2.96000e+02 3.05297e-03 7.52844e-05 1 0.00000e+00 2.96000e+02 3.27092e-03 8.06581e-05 2 0.00000e+00 2.96000e+02 3.50442e-03 8.64153e-05 3 0.00000e+00 2.96000e+02 3.75460e-03 9.25834e-05 4 0.00000e+00 2.96000e+02 4.02263e-03 9.91918e-05
- to_endf6(endf6)
Update S matrixs in Endf6 instance with those available in a Tsl instance.
- Parameters:
- `endf6`sandy.Endf6
Endf6 instance
- Returns:
- sandy.Endf6
Endf6 instance with updated S matrixs and Deby-Waller function
Notes
Note
The user can only add new energy grids in the coherent elastic scattering. For the moment, add new temperatures is not allow.
Note
The user can only add new alpha grids in the incoherent inelastic scattering. For the moment, add new temperatures and beta values is not allow.
Examples
Incoherent elastic scattering >>> tape = sandy.get_endf6_file(“endfb_80”, ‘tsl’, 10) >>> from_endf = sandy.sections.mf7.read_mf7(tape, 10, 2) >>> text = sandy.sections.mf7.write_mf7(from_endf) >>> tsl = sandy.Tsl.from_endf6(tape) >>> new_tape = tsl.to_endf6(tape) >>> new_from_endf = sandy.sections.mf7.read_mf7(tape, 10, 2) >>> new_text = sandy.sections.mf7.write_mf7(new_from_endf) >>> assert new_text == text
Coherent elastic scattering >>> tape = sandy.get_endf6_file(“endfb_80”, ‘tsl’, 26) >>> from_endf = sandy.sections.mf7.read_mf7(tape, 26, 2) >>> text = sandy.sections.mf7.write_mf7(from_endf) >>> tsl = sandy.Tsl.from_endf6(tape) >>> new_tape = tsl.to_endf6(tape) >>> new_from_endf = sandy.sections.mf7.read_mf7(tape, 26, 2) >>> new_text = sandy.sections.mf7.write_mf7(new_from_endf) >>> assert new_text == text
Incoherent inelastic scattering >>> tape = sandy.get_endf6_file(“endfb_80”, ‘tsl’, 26) >>> from_endf = sandy.sections.mf7.read_mf7(tape, 26, 4) >>> text = sandy.sections.mf7.write_mf7(from_endf) >>> tsl = sandy.Tsl.from_endf6(tape) >>> new_tape = tsl.to_endf6(tape) >>> new_from_endf = sandy.sections.mf7.read_mf7(tape, 26, 4) >>> new_text = sandy.sections.mf7.write_mf7(new_from_endf) >>> assert new_text == text