serpentTools.next.SerpentFile¶
-
class
serpentTools.next.
SerpentFile
(filename=None)¶ Most basic interface for a Serpent file
- Parameters
filename (str, optional) – Helpful identifier for the source of data
-
classmethod
fromSerpent
(source, sourcename=None, postcheck=True, strict=True, **kwargs)¶ Load data from a Serpent output file
- Parameters
source (str or pathlib.Path or io.IOBase) – Source of Serpent output data. File names can be passed as either strings or
pathlib.Path
. Otherwise, source must be readable, e.g. supportsource.read
andsource.readline
sourcename (str, optional) – Alternative identifier for the source. If not provided and
source
is a string orpathlib.Path
, the name will reflect the name of the filepostcheck (bool, optional) – Perform simple checks after the file has been processed. Default is to perform the check
strict (bool, optional) – If simple checks fail during post-check routines, raise an error if
True
or a warning. Default is to raise an errorkwargs – Additional keyword arguments will be passed directly to the concrete stream reader, implemented by each subclass.
- Returns
Specific subclass corresponding to the file type
- Return type
- Raises
serpentTools.SerpentToolsException – If
postcheck
, a check fails, andstrict
- Warns
UserWarning – If
postcheck
, a check fails, and notstrict