class serpentTools.DetectorReader(filePath)

Parser responsible for reading and working with detector files.

Parameters

filePath (str) – path to the depletion file

detectors

Dictionary where key, value pairs correspond to detector names and their respective Detector instances

Type

dict

__contains__(key)

Check if a detector key is stored

__getitem__(name)

Retrieve a detector from detectors

__iter__()

Iterate over detector names

__len__()

Number of detectors 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)

Retrieve a detector from the dictionary if it exists

Parameters
• key (str) – Name of a detector that may or may not exist in detectors

• default (optional) – Item to return if key isn’t found

Returns

A serpentTools.Detector if it is stored under key. Otherwise return default

Return type

object

items()

Iterate over key, detector pairs

iterDets()

Yield name, detector pairs by iterating over detectors.

Deprecated since version 0.9.3: Use items()

read()

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

toMatlab(fileP, reconvert=True, append=True, format='5', longNames=True, compress=True, oned='row')

Write a binary MATLAB file from the contents of this object

Parameters
• fileP (str or file-like object) – Name of the file to write. .mat extension is not needed if append==True

• reconvert (bool) – If this evaluates to true, convert values back into their original form as they appear in the output file.

• append (bool) – If true and a file exists under output, append to that file. Otherwise the file will be overwritten

• format ({'5', '4'}) – Format of file to write. '5' for MATLAB 5 to 7.2, '4' for MATLAB 4

• longNames (bool) – If true, allow variable names to reach 63 characters, which works with MATLAB 7.6+. Otherwise, maximum length is 31 characters

• compress (bool) – If true, compress matrices on write

• oned ({'row', 'col'}) – Write one-dimensional arrays as row vectors if oned=='row' (default), or column vectors

Raises

ImportError – If scipy is not installed