serpentTools.XSPlotReader

class serpentTools.XSPlotReader(filePath)

Parser responsible for reading and working with xsplot output files. These files can be generated using:

http://serpent.vtt.fi/mediawiki/index.php/Input_syntax_manual#set_xsplot

Parameters

filePath (str) – path to the xsplot result file

xsections

Contains XSData objects with keys given by their names. There should be one XSData instance for each isotope and material present in the problem.

Type

dict

energies

Array of energy grids, shared across all XSData instances

Type

numpy.ndarray or None

majorant

L-inf norm among all macroscopic cross sections used in the problem.

Type

numpy.ndarray or None

metadata

Alias for accessing energies and majorant. Attribute-based access is prefered, as this property will likely be removed in the future

Type

dict

__contains__(key)

Return true or false if key in xsections

__getitem__(key)

Return item corresponding to key in xsections

__iter__()

Iterate over all keys in xsections

__len__()

Number of xsdata objects stored

compare(other, lower=0, upper=10, sigma=2, verbosity=None)

Compare the results of this reader to another.

For values without uncertainties, the upper and lower arguments control what passes and what messages get raised. If a quantity in other is less than lower percent different that the same quantity on this object, consider this allowable and make no messages. Quantities that are greater than upper percent different will have a error messages printed and the comparison will return False, but continue. Quantities with difference between these ranges will have warning messages printed.

Parameters
  • other – Other reader instance against which to compare. Must be a similar class as this one.

  • lower (float or int) – Lower limit for relative tolerances in percent Differences below this will be considered allowable

  • upper (float or int) – Upper limit for relative tolerances in percent. Differences above this will be considered failure and errors messages will be raised

  • sigma (int) – Size of confidence interval to apply to quantities with uncertainties. Quantities that do not have overlapping confidence intervals will fail

  • verbosity (None or str) – If given, update the verbosity just for this comparison.

Returns

True if the objects are in agreement with each other according to the parameters specified

Return type

bool

Raises
  • TypeError – If other is not of the same class as this class nor a subclass of this class

  • ValueError – If upper > lower, If sigma, lower, or upper are negative

get(key, default=None)

Return the value of key from xsections or default

Parameters
  • key (str) – Name of isotope or material that may or may not exist in xsections

  • default (object) – Item to return if key not found

Returns

XSData that corresponds to key if key is found. Otherwise return default

Return type

object

items()

Item-view (k, v) into xsections

keys()

Key-view into xsections

read()

The main method for reading that not only parses data, but also runs pre and post checks.

values()

Values-view into xsections