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

filename

Name of the source of data

Type

str or None

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. support source.read and source.readline

  • sourcename (str, optional) – Alternative identifier for the source. If not provided and source is a string or pathlib.Path, the name will reflect the name of the file

  • postcheck (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 error

  • kwargs – 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

SerpentFile

Raises

serpentTools.SerpentToolsException – If postcheck, a check fails, and strict

Warns

UserWarning – If postcheck, a check fails, and not strict