Cross Section Data Sources – pyne.xs.data_source
¶
Cross section library data source interfaces.
-
class
pyne.xs.data_source.
DataSource
(src_phi_g=None, dst_group_struct=None, **kwargs)[source]¶ Base cross section data source.
This is an abstract class which provides default functionality when subclassed and certain methods are overridden. A data source should know how to find cross section information for a given nuclide, reaction type, and temperature, if available. If such data is not present for this source, then the source should return None.
Furthermore, a data source must be able to declare whether the data is present on the users system.
Finally, data sources distinguish between group structure information coming from or for the source itself (src) and optional user-defined destination (dst) group structure information. This allows the data source to define how it wishes to discretize its data to the custom destination form.
The following methods must be overridden in all DataSource subclasses:
@property def exists(self): # Is this DataSource available on the user's system? return (True or False) def _load_group_structure(self): # Sets the source group structure, E_g, native to this DataSource ... self.src_group_struct = E_g (array-like) def _load_reaction(self, nuc, rx, temp=300.0): # Returns the rection channel for a nuclide at a given temperature # or returns None, if this unavailable in this DataSource. ... return rxdata (ndarray of floats, length self.src_ngroups, or None)
The following methods may be overridden in DataSource subclasses as a potential optimization:
def load(self, temp=300.0): # loads the entire data source into memory. This prevents # excessive queries to disk. This does not return anything. pass # a class attribute that specificies whether the data source uses # temperature information. If the data source does not use such # info, the keys in the rxcache dictionary are shortend to just the # (nuc, rx) pair. Accessing (nuc, rx, temp) data will defer to the # (nuc, rx) pair. _USES_TEMP = True
Note that non-multigroup data sources should also override the discretize() method. Other methods and properties may also need to be overriden depending on the data source at hand.
All data sources may be used independently or in conjunction with a cross section cache instance.
- Parameters
- src_phi_garray-like, optional
Group fluxes which must match the group structure for this data source.
- dst_group_structarray-like, optional
The energy group structure [MeV] of the destination cross sections. Used when discretizing cross sections from this source.
-
reaction
(self, nuc, rx, temp=300.0)[source]¶ Gets the cross section data for this reaction channel either directly from the data source or from the rxcache.
- Parameters
- nucint or str
A nuclide.
- rxint or str
Reaction id or name.
- tempfloat, optional
Temperature [K] of material, defaults to 300.0.
- Returns
- rxdatandarray
Source cross section data, length src_ngroups.
-
discretize
(self, nuc, rx, temp=300.0, src_phi_g=None, dst_phi_g=None)[source]¶ Discretizes the reaction channel from the source group structure to that of the destination weighted by the group fluxes. This implemenation is only valid for multi-group data sources. Non-multigroup data source should also override this method.
- Parameters
- nucint or str
A nuclide.
- rxint or str
Reaction id or name.
- tempfloat, optional
Temperature [K] of material, defaults to 300.0.
- src_phi_garray-like, optional
Group fluxes for this data source, length src_ngroups.
- dst_phi_garray-like, optional
Group fluxes for the destiniation structure, length dst_ngroups.
- Returns
- dst_sigmandarray
Destination cross section data, length dst_ngroups.
-
shield_weights
(self, num_dens, temp)[source]¶ Builds the weights used during the self shielding calculations. Parameters ———- mat : array of floats.
A map of the number densities of each of the nuclides of the material for which self-shielding is being calculated.
- data_source: pyne data_source
Contains the cross section information for the isotopes in the material that is experiencing the self shielding.
-
class
pyne.xs.data_source.
NullDataSource
(**kwargs)[source]¶ Cross section data source that always exists and always returns zeros.
- Parameters
- kwargsoptional
Keyword arguments to be sent to base class.
-
class
pyne.xs.data_source.
SimpleDataSource
(**kwargs)[source]¶ Simple cross section data source based off of KAERI data. This data source does not use material temperature information.
- Parameters
- kwargsoptional
Keyword arguments to be sent to base class.
-
discretize
(self, nuc, rx, temp=300.0, src_phi_g=None, dst_phi_g=None)[source]¶ Discretizes the reaction channel from simple group structure to that of the destination weighted by the group fluxes. Since the simple data source consists of only thermal (2.53E-8 MeV), fission (1 MeV), and 14 MeV data points, the following piecewise functional form is assumed:
\[ \begin{align}\begin{aligned}\sigma(E) = \sigma(2.53E-8) \sqrt{\frac{2.53E-8}{E}}\\\sigma(E) = \frac{\sigma(14) - \sigma(1)}{14 - 1} (E - 1) + \sigma(1)\end{aligned}\end{align} \]- Parameters
- nucint or str
A nuclide.
- rxint or str
Reaction key (‘gamma’, ‘alpha’, ‘p’, etc.) or MT number.
- tempfloat, optional
Temperature [K] of material, defaults to 300.0.
- src_phi_garray-like, optional
IGNORED!!! Included for API compatability
- dst_phi_garray-like, optional
Group fluxes for the destiniation structure, length dst_ngroups.
- Returns
- dst_sigmandarray
Destination cross section data, length dst_ngroups.
-
class
pyne.xs.data_source.
CinderDataSource
(**kwargs)[source]¶ Cinder cross section data source. The relevant cinder cross section data must be present in the nuc_data for this data source to exist. This data source does not use material temperature information.
- Parameters
- kwargsoptional
Keyword arguments to be sent to base class.
-
class
pyne.xs.data_source.
EAFDataSource
(**kwargs)[source]¶ European Activation File cross section data source. The relevant EAF cross section data must be present in the nuc-data for this data source to exist.
- Parameters
- kwargsoptional
Keyword arguments to be sent to base class.
Notes
EAF data does not use temperature information.
-
class
pyne.xs.data_source.
ENDFDataSource
(fh, src_phi_g=None, dst_group_struct=None, **kwargs)[source]¶ Evaluated Nuclear Data File cross section data source. The ENDF file must exist for this data source to exist.
- Parameters
- fhstring, file handle
Path to ENDF file, or ENDF file itself.
- kwargsoptional
Keyword arguments to be sent to base class.
-
reaction
(self, nuc, rx, nuc_i=None)[source]¶ Get reaction data.
- Parameters
- nucint or str
Nuclide containing the reaction.
- rxint or str
Desired reaction
- nuc_iint or str
Nuclide containing the reaction. Defaults to nuc.
- group_boundstuple
Low and high energy bounds of the new group.
- Returns
- rxdictdict
Dictionary containing source group structure, energy values, cross- section data, and interpolation data.
-
discretize
(self, nuc, rx, temp=300.0, src_phi_g=None, dst_phi_g=None)[source]¶ Discretizes the reaction channel from the source group structure to that of the destination weighted by the group fluxes.
- Parameters
- nucint or str
A nuclide.
- rxint or str
Reaction id or name.
- tempfloat, optional
Temperature [K] of material, defaults to 300.0.
- src_phi_garray-like, optional
Group fluxes for this data source, length src_ngroups.
- dst_phi_garray-like, optional
Group fluxes for the destiniation structure, length dst_ngroups.
- Returns
- dst_sigmandarray
Destination cross section data, length dst_ngroups.
-
class
pyne.xs.data_source.
OpenMCDataSource
(cross_sections=None, src_group_struct=None, **kwargs)[source]¶ Data source for ACE data that is listed in an OpenMC cross_sections.xml file. This data source discretizes the reactions to a given group stucture when the reactions are loaded in. Reseting this source group structure will clear the reaction cache.
- Parameters
- cross_sectionsopenmc_utils.CrossSections or string or file-like, optional
Path or file to OpenMC cross_sections.xml
- src_group_structarray-like, optional
The group structure to discretize the ACE data to, defaults to
np.logspace(1, -9, 101)
.- kwargsoptional
Keyword arguments to be sent to DataSource base class.
-
pointwise
(self, nuc, rx, temp=300.0)[source]¶ Returns pointwise reaction data from ACE files indexed by OpenMC.
- Parameters
- nucint
Nuclide id.
- rxint
Reaction id.
- tempfloat, optional
The nuclide temperature in [K].
- Returns
- E_pointsarray-like
The array or energy points that the reaction is evaluated at.
- rawdataarray-like
Raw pointwise reaction data.
-
self_shield
(self, nuc, rx, temp, E_points, xs_points)[source]¶ Calculates the self shielded cross section for a given nuclide and reaction. This calculation uses the Bonderanko method.
- Parameters
- nucint
Nuclide id.
- rxint
Reaction id.
- tempfloat, optional
The nuclide temperature in [K].
- E_pointsarray like
The point wise energies.
- xs_pointsarray like
Point wise cross sections
- Returns
- rxdataarray like
collapsed self shielded cross section for nuclide nuc and reaction rx
-
class
pyne.xs.data_source.
StatePointDataSource
(state_point, tallies, num_den, phi_tot, **kwargs)[source]¶ Data source for reactions coming from OpenMC state points
- Parameters
- state_pointstring
Path to the OpenMC statepoint file to be used to build the data_source
- talliesarray-like
The tally id’s used to pull the cross sections from.
- num_dens: map of int to float
A map containing the number densities of the nuclides in the material used in the statepoint.
- phi_tot: array of floats
The total flux within the reactor
- kwargsoptional
Keyword arguments to be sent to DataSource base class.