vibe-sketcherDocumentation

vibesketcher.document.refinement_records

Refinement intents and verified report associations of measured patterns (#275).

vibe-sketcher runs no refinement and depends on no refinement engine. It keeps two kinds of record on a stored measured pattern:

  • an intent: which parameters an external engine is meant to refine or hold (scale, zero shift, background, lattice parameters, U_iso groups, occupancies, positions, profile, preferred orientation) and the constraints between them (equal ties, sum such as occupancies summing to 1, fixed values), for a named periodic structure whose digest is recorded. Starting values may be stated. Refined values and agreement indices may not: an intent is not a result.

  • a report association: an external report file read here, so its SHA-256 and size are computed rather than stated, with the engine, the version as given and the agreement indices exactly as the report gives them. Agreement measures the fit of one model to one pattern. It does not establish that the structure is unique, and it is not the instrument’s uncertainty; every record says so.

An agreement claim without its report bytes is refused, and so is an intent that carries results. Every edit is checked against the document revision. An intent whose structure changed or is gone is stale, and so is a report whose intent is stale. Undo removes the pattern’s last record while it is current; removing an intent that a report answers is refused.

Module Attributes

AGREEMENT_NOTE

Printed with every record and on every output that shows agreement indices.

MAX_REPORT_BYTES

The largest report file read for its digest (bytes).

Functions

associate_report(document, pattern, report, ...)

Associate an external refinement report (its bytes) with a measured pattern.

records(document, pattern)

The pattern's refinement records, oldest first, each marked stale or current.

remove(document, pattern, record_id, *[, ...])

Remove one refinement record by id, stale or not; an answered intent is refused.

store_intent(document, pattern, intent, *[, ...])

Keep a refinement intent on a measured pattern; returns (document, summary).

summary(document, pattern, record_id)

One record with its pattern, marked stale or current, with the agreement note.

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

Remove the pattern's last refinement record; refused once it is stale.

Exceptions

RefinementRefused(code, message)

A refinement record cannot be stored or changed faithfully; code says why.

vibesketcher.document.refinement_records.AGREEMENT_NOTE = "Agreement indices are as reported by the external engine for this model and this pattern. They measure the fit; they do not establish that the structure is unique, and they are not the instrument's uncertainty."

Printed with every record and on every output that shows agreement indices.

vibesketcher.document.refinement_records.MAX_REPORT_BYTES = 67108864

The largest report file read for its digest (bytes).

exception vibesketcher.document.refinement_records.RefinementRefused(code, message)[source]

Bases: ValueError

A refinement record cannot be stored or changed faithfully; code says why.

Parameters:
Return type:

None

vibesketcher.document.refinement_records.store_intent(document, pattern, intent, *, revision=None, identifier=None)[source]

Keep a refinement intent on a measured pattern; returns (document, summary).

Parameters:
Return type:

tuple[Document, dict[str, Any]]

vibesketcher.document.refinement_records.associate_report(document, pattern, report, file_name, *, engine, engine_version=None, agreement=None, intent=None, notes=None, revision=None, identifier=None)[source]

Associate an external refinement report (its bytes) with a measured pattern.

Parameters:
Return type:

tuple[Document, dict[str, Any]]

vibesketcher.document.refinement_records.summary(document, pattern, record_id)[source]

One record with its pattern, marked stale or current, with the agreement note.

Parameters:
Return type:

dict[str, Any]

vibesketcher.document.refinement_records.records(document, pattern)[source]

The pattern’s refinement records, oldest first, each marked stale or current.

Parameters:
Return type:

list[dict[str, Any]]

vibesketcher.document.refinement_records.undo(document, pattern, *, revision=None)[source]

Remove the pattern’s last refinement record; refused once it is stale.

Parameters:
Return type:

Document

vibesketcher.document.refinement_records.remove(document, pattern, record_id, *, revision=None)[source]

Remove one refinement record by id, stale or not; an answered intent is refused.

Parameters:
Return type:

Document