tape

The endf_parserpy.tape module provides support for ENDF-6 files that contain several materials, traditionally called tapes. This includes the PENDF tapes produced by processing codes, which repeat the same material at several temperatures.

The parse_tape(), iter_parse_tape() and write_tape() functions (and their _file variants) read and write such files in terms of ordinary material dictionaries. The EndfFile class instead provides lazy, memory-bounded access: the file is indexed on construction and individual sections are parsed only when accessed.

The guide on multi-material files explains these tools from a practical perspective. The following sections give a detailed description of the functions and classes involved:

Exceptions

All exceptions raised by endf-parserpy derive from EndfParserpyError. The tape interface raises the TapeError subclasses listed below.

exception endf_parserpy.EndfParserpyError[source]

Base class for all exceptions raised by endf-parserpy.

exception endf_parserpy.tape.TapeError[source]

Base class for all errors raised by the tape interface.

exception endf_parserpy.tape.TapeStructureError[source]

Raised when the structure of an ENDF tape is malformed.

Examples are a tape that does not begin with a tape head (TPID) record, or a tape that ends in the middle of a material because the final MEND or TEND record is missing.

exception endf_parserpy.tape.AmbiguousMaterialError[source]

Raised when a MAT number matches several materials.

PENDF tapes repeat the same MAT number at different temperatures. A lookup by MAT number then needs an occurrence index to select among them.

This is a lookup failure, so it also derives from the built-in LookupError; code that handles lookup errors generically can catch it that way.

exception endf_parserpy.tape.SectionParseError[source]

Raised when a section fails to parse and on_error="raise".

exception endf_parserpy.tape.SectionRenderError[source]

Raised when an edited section fails to render to ENDF-6 text.

In check_edits="eager" mode every edited section is rendered through the parser’s writer right away; a section that no longer conforms to its ENDF recipe makes the writer fail, which is reported as this error with the writer’s own exception kept as its cause. The same error is collected by invalid_edits().

exception endf_parserpy.tape.StaleSourceError[source]

Raised when the source file changed after its index was built.