XSLibrary

class XSLibrary(source)

The XSLibrary class reads in cross section libraries, potentially generated by NittanyPhysics, but not necessarily.

Print an object of this class to view all available attributes.

Parameters:

source (str or h5py.Group) – Either the file name corresponding to an HDF5 file output by NittanyPhysics, or the HDF5 group within a Lionbolt HDF5 file that contains an XS library

Examples

Access individal CrossSections objects by naming the particles.

Suppose you want to get the scattering cross sections of a particle named ‘electrons’:

>>> D = XSLibrary('results.h5')
>>> el = D['electrons']
>>> # OR
>>> el = D['electrons', 'electrons']

Suppose you want to get the scattering cross sections for mapping from a particle named ‘photons’ to a particle named ‘electrons’:

>>> photoelectrons = D['photons', 'electrons']
h5

Either the full HDF5 file or just the group depending on how the object was initialized.

Type:

h5py.File or h5py.Group

num_materials

Number of materials described by this library.

Type:

int

present_particles

Number of particles described by this library.

Type:

int

<self[p1, p2]>

For a provided p1 (str) and p2 (str) which give particle names, gives the CrossSections object corresponding to the mapping from p1 to p2. If p1 = p2 then one can use either [p1, p1] or [p1] and get single-particle cross sections.

Type:

CrossSections