TapeIndex
- class endf_parserpy.TapeIndex(materials, tpid_line, tpid_offset, tpid_length, source=None, source_size=None, source_mtime_ns=None)[source]
A structural index over the materials of an ENDF tape.
Build one with
from_file()(exact on-disk byte offsets) orfrom_lines(). The index supportslen(), iteration and integer position indexing, and providesby_mat()andby_za()secondary lookups. It is recipe-free and picklable.- tpid_offset, tpid_length
Byte location of the TPID record.
- Type:
- source
Path of the indexed file, if built with
from_file().- Type:
str or None
- source_size, source_mtime_ns
Size and modification time of the source file at index time; usable to detect that the file changed after indexing.
- Type:
int or None
- classmethod from_file(path, *, chunk_bytes=16777216)[source]
Build an index of the ENDF tape stored at
path.The tape is read in blocks of about
chunk_bytes, so peak memory during indexing stays a small multiple ofchunk_bytesregardless of the tape size.
- classmethod from_lines(lines, source=None)[source]
Build an index from an iterable of ENDF tape lines.
The lines are consumed lazily. Byte offsets are computed assuming a single
"\n"terminates each line; they are therefore only exact for a file written that way. Usefrom_file()when exact on-disk offsets are required.