vibe-sketcherDocumentation

vibesketcher.document.porosity_store

Porosity estimates stored on a periodic structure, with undo and stale marking (#206).

store() attaches a reference estimate (vibesketcher.document.porosity.analyse()) to its structure’s provenance["porosity"] as one revision-checked edit. The record keeps the structure’s content digest (the digest leaves provenance out, so storing changes no digest). An estimate whose digest no longer matches its structure is stale: stored() marks it, undo() refuses once the structure changed, and the publication table writers refuse to write it.

Stored estimates travel with the document: in the .vsk file and in the QVF document section. QVF has no porosity contract, so the QVF writers also add a non-critical vendor section x_vibesketch.porosity (QVF_KIND) holding every stored estimate with its structure digest; from_qvf() reads it.

Every record is labelled a geometric planning estimate: geometric void is not adsorption capacity, and no surface area here is a BET surface area.

Module Attributes

MAX_STORED

Stored estimates one structure may hold.

Functions

entry(structure[, identifier])

One stored estimate (the latest when identifier is None), marked stale or not.

fresh(structure[, identifier])

A stored estimate that still matches its structure; a stale one is refused.

from_qvf(data)

The stored estimates of a QVF's x_vibesketch.porosity section ([] when absent).

qvf_members(structures)

The x_vibesketch.porosity members for these structures, or None when none stores any.

store(document, result, *[, revision, ...])

Attach result to its structure as one undoable edit; returns (document, entry).

stored(structure)

The stored estimates, oldest first, each marked stale against the structure now.

summaries(structure)

The stored estimates without their full estimate payload.

undo(document, structure_id, *[, revision])

Remove the last stored estimate; refused once the structure changed since.

vibesketcher.document.porosity_store.MAX_STORED = 16

Stored estimates one structure may hold.

vibesketcher.document.porosity_store.stored(structure)[source]

The stored estimates, oldest first, each marked stale against the structure now.

Parameters:

structure (PeriodicStructure)

Return type:

list[dict[str, Any]]

vibesketcher.document.porosity_store.summaries(structure)[source]

The stored estimates without their full estimate payload.

Parameters:

structure (PeriodicStructure)

Return type:

list[dict[str, Any]]

vibesketcher.document.porosity_store.entry(structure, identifier=None)[source]

One stored estimate (the latest when identifier is None), marked stale or not.

Parameters:
Return type:

dict[str, Any]

vibesketcher.document.porosity_store.fresh(structure, identifier=None)[source]

A stored estimate that still matches its structure; a stale one is refused.

Parameters:
Return type:

dict[str, Any]

vibesketcher.document.porosity_store.store(document, result, *, revision=None, identifier=None)[source]

Attach result to its structure as one undoable edit; returns (document, entry).

Refuses (PorosityRefused) when revision is not the document’s, when the result belongs to another version of the structure, or when the structure already holds MAX_STORED estimates.

Parameters:
Return type:

tuple[Document, dict[str, Any]]

vibesketcher.document.porosity_store.undo(document, structure_id, *, revision=None)[source]

Remove the last stored estimate; refused once the structure changed since.

Parameters:
Return type:

Document

vibesketcher.document.porosity_store.qvf_members(structures)[source]

The x_vibesketch.porosity members for these structures, or None when none stores any.

Parameters:

structures (list[PeriodicStructure])

Return type:

dict[str, Any] | None

vibesketcher.document.porosity_store.from_qvf(data)[source]

The stored estimates of a QVF’s x_vibesketch.porosity section ([] when absent).

Parameters:

data (bytes)

Return type:

list[dict[str, Any]]