serpentTools.DepmtxReader¶

class
serpentTools.
DepmtxReader
(filePath, sparse=None)¶ Reader for processing depletion matrix files
 Parameters

n0
¶ Vector of original isotopics
 Type

zai
¶ Integer vector of isotope ZAI (zzaaai) identifiers
 Type

depmtx
¶ Depletion matrix for this material. Will be
scipy.sparse.csc_matrix
if scipy is installed and the sparseengine option is either not specified (None
) duringread()
or passed asTrue
. Otherwise, will be anumpy.ndarray
 Type

n1
¶ Vector for isotopics after depletion
 Type

checkSparse
()¶ Return
True
if the object is configured for sparse support

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 thanlower
percent different that the same quantity on this object, consider this allowable and make no messages. Quantities that are greater thanupper
percent different will have a error messages printed and the comparison will returnFalse
, 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
 Raises
TypeError – If
other
is not of the same class as this class nor a subclass of this classValueError – If upper > lower, If sigma, lower, or upper are negative

plotDensity
(what='both', ax=None, logx=False, logy=True, loglog=None, legend=None, title=None, labels=None, markers=None, xlabel=None, ylabel=None, ylim=None)¶ Plot initial, final, or both number densities.
 Parameters
what (str) –
Concentrations to plot.
'both'
: plot initial and final'n0'
or'initial'
: only initial'n1'
or'final'
: only final
ax (
matplotlib.axes.Axes
, optional) – Ax on which to plot the data. If not provided, create a new plotlogx (bool) – Apply a log scale to x axis.
logy (bool) – Apply a log scale to y axis.
loglog (bool) – Apply a log scale to both axes.
legend (bool or str or None) – Automatically label the plot. No legend will be made if a single item is plotted. Pass one of the following values to place the legend outside the plot: above, right
title (str) – Title to apply to the figure.
labels (None or str or list of strings) – Labels to apply to concentration plot(s). If given, must have length equal to the number of quantities plotted, e.g. plotting both concentrations and passing a single string for
labels
is not allowedmarkers (None or str or list of strings) – Markers to apply to each plot. Must be a valid
matplotlib
marker such as'o'
,'>'
, etc. If given, the number of markers given must equal the number of quantities to plot.xlabel (str or bool, optional) – Label to apply to the xaxis. If given as
None
, a label will be determined from other arguments. If notNone
but evaluates toFalse
, do not label.ylabel (str or bool, optional) – Label to apply to the yaxis. If given as
None
, a label will be determined from other arguments. If notNone
but evaluates toFalse
, do not label.ylim (None or float or list of floats) – If a single value is given, set the lower yaxis limit to this value. If two values are given, set the upper and lower yaxis limits to this value
 Returns
Ax on which the data was plotted.
 Return type

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 filelike object) – Name of the file to write.
.mat
extension is not needed ifappend==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 overwrittenformat ({'5', '4'}) – Format of file to write.
'5'
for MATLAB 5 to 7.2,'4'
for MATLAB 4longNames (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 onedimensional arrays as row vectors if
oned=='row'
(default), or column vectors
 Raises
ImportError – If scipy is not installed
See also