MaterialView
- class endf_parserpy.tape.MaterialView(endf_file, slot)[source]
A handle to one material of an
EndfFile.Sections are addressed by an
(MF, MT)pair and parsed lazily on access. A section can be read, replaced, added or deleted:section = material[3, 2] material[3, 2] = edited_section del material[3, 2]
Reading a section returns a view over the parsed section whose mutability follows the file’s
check_editsmode – read-only under"eager"and a live write-through view under"deferred"(seeendf_parserpy.tape.views). A section that failed to parse raisesSectionParseErroron access.The view is bound to the underlying material, so it stays valid if the tape is reordered; it becomes invalid only if that material is deleted, after which every operation on it raises
RuntimeError.- property awr
Atomic weight ratio of the material, or
Noneif unknown.
- property is_modified
Whether this material has been edited.
- property mat
ENDF MAT number of the material.
- property position
The material’s current zero-based position on the tape.
- to_tape_dict()[source]
Return this material as a complete single-material tape dict.
The result is a
{MF: {MT: section}}mapping that, unlike the per-section access of this view, also carries anMF=0/MT=0tape-head (TPID) entry. It therefore forms a complete single-material tape and can be handed directly to the ordinary parser’swrite–parser.write(view.to_tape_dict())yields a tape the ordinaryparser.parseround-trips.Untouched sections appear as their raw ENDF-6 lines and edited or added ones as parsed mappings; the writer accepts both.
- property za
ZA identifier of the material, or
Noneif unknown.