eon.concorpus

Store path-based con blobs in a readcon-db corpus.

readcon still parses every frame. The corpus is a second copy: one trajectory per distinct path plus blob, next to the run when config.ini is at most eight directories up, otherwise beside the con file. A missing readcon_db install leaves the con file as the only copy.

An overwrite of a path starts a generation, a trajectory whose frame 0 is the written frame, and later appends extend that trajectory. Compressed con files stay out of the corpus.

A dynamics movie can also ingest each directory of a simulation tree and read those frames back with one read-only get_frame_texts call. The .con files remain the store.

Module Contents

Functions

blob_id

FNV-1a 64 over the canonical path, a NUL, and the con text.

generation_id

Trajectory id of one generation of path whose frame 0 is first_text.

corpus_dir

Directory of the LMDB corpus for this con path.

start_generation

Start the trajectory an overwrite of path with one frame text begins.

note_corpus_append

Buffer one appended frame for the path’s generation. Flush at 64 frames.

flush_corpus_appends

Extend every buffered batch. A crash before this drops at most 63 frames.

corpus_buffered_frames

generation_frame_texts

Frame texts of the path’s current generation, oldest first.

mirror_con_text

Insert one con blob. Identical path-and-text pairs are stored once.

store_frame_text

Store one con blob. Returns (traj_id, 0) for a single frame.

load_frame_text

Frame text for a key in this corpus, or None when it is absent.

stored_frame_text

Frame text for this path’s current blob, or None when the corpus has no copy.

mirror_con_path

Insert the con file’s current bytes. A .gz or .zst path is skipped.

directories_with_con

Directories under tree that directly contain .con or .convel.

frame_texts_for_paths

Ingest tree and return frame 0 text for each path, in order.

Data

API

eon.concorpus.logger

‘getLogger(…)’

eon.concorpus.blob_id(path: str, text: str) → int[source]

FNV-1a 64 over the canonical path, a NUL, and the con text.

Whole-file blobs are keyed by content. The corpus has no replace, so a rewrite of a path stores a new blob under a new id, and a reader finds the current one from the file’s text. The C++ mirror uses the same bytes.

eon.concorpus.generation_id(path: str, first_text: str, generation: int = 0) → int[source]

Trajectory id of one generation of path whose frame 0 is first_text.

Generation 0 is blob_id(path, first_text), so the blob an overwrite stores is the trajectory its appends extend. The corpus cannot drop frames, so an overwrite that repeats the first frame of an extended generation takes the next one: FNV-1a 64 over the path, a NUL, the text, a NUL and the decimal generation. The C++ mirror uses the same bytes.

eon.concorpus.corpus_dir(con_path: pathlib.Path) → pathlib.Path[source]

Directory of the LMDB corpus for this con path.

eon.concorpus.start_generation(path, text: str) → int | None[source]

Start the trajectory an overwrite of path with one frame text begins.

Frames still buffered for the previous generation go to it first. A generation that holds only this frame is reused. Returns the trajectory id, or None when no corpus takes the frame.

eon.concorpus.note_corpus_append(path, frame_text: str) → None[source]

Buffer one appended frame for the path’s generation. Flush at 64 frames.

eon.concorpus.flush_corpus_appends() → None[source]

Extend every buffered batch. A crash before this drops at most 63 frames.

eon.concorpus.corpus_buffered_frames(path) → int[source]
eon.concorpus.generation_frame_texts(path) → list[str][source]

Frame texts of the path’s current generation, oldest first.

Empty when this process holds no generation for the path or no corpus is loaded.

eon.concorpus.mirror_con_text(path, text: str) → None[source]

Insert one con blob. Identical path-and-text pairs are stored once.

eon.concorpus.store_frame_text(path, text: str) → tuple[int, int] | None[source]

Store one con blob. Returns (traj_id, 0) for a single frame.

The corpus takes the con text only. A barrier is not an argument. A mode is not an argument either: it rides in the saddle frame as the displacements section.

eon.concorpus.load_frame_text(directory: pathlib.Path, traj: int, frame_idx: int) → str | None[source]

Frame text for a key in this corpus, or None when it is absent.

eon.concorpus.stored_frame_text(path) → str | None[source]

Frame text for this path’s current blob, or None when the corpus has no copy.

eon.concorpus.mirror_con_path(path) → None[source]

Insert the con file’s current bytes. A .gz or .zst path is skipped.

eon.concorpus.directories_with_con(tree: pathlib.Path) → list[pathlib.Path][source]

Directories under tree that directly contain .con or .convel.

eon.concorpus.frame_texts_for_paths(tree, con_paths, corpus_cls=None) → list[str][source]

Ingest tree and return frame 0 text for each path, in order.

corpus_cls defaults to readcon_db.ConCorpus. Tests pass a stand-in with the same constructor, ingest_directory, and get_frame_texts.