lunartrace.workbench.figures
Deterministic publication Figures for a Workbench ROI.
A Figure is regenerated by Python from the exact numeric source and method rows; it is never a screenshot of an interactive view. Output bytes are deterministic for the same inputs (fixed SVG hash salt, no creation dates).
FigureKind
Section titled “FigureKind”attribute
FigureKindFigure kinds accepted by render.
FigureFormat
Section titled “FigureFormat”attribute
FigureFormatOutput formats accepted by render.
attribute
KINDSAll supported figure kinds, in API order.
FORMATS
Section titled “FORMATS”attribute
FORMATSMap from figure format to its HTTP media type.
histogram_xlim
Section titled “histogram_xlim”function
def histogram_xlim( histograms: Sequence[npt.ArrayLike], edges: Sequence[float],) -> tuple[float, float]Compute the deterministic slope-axis limit of the histogram figure.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
histograms | sequence of array-like | Per-tau slope histograms (included-cell counts per bin). |
edges | sequence of float | Bin edges in degrees, one more than the number of bins. |
Returns
Section titled “Returns”tuple of float—(lower, upper)in degrees, withloweralways 0.0.
Let be the last bin that is non-empty for any tau. The upper limit is
where is the right edge of that bin. If every bin is empty the limit is
(0.0, 90.0).
render
Section titled “render”function
def render( site: wroi.Site, body: dict[str, object], kind: FigureKind, fmt: FigureFormat, tau: float | None = None,) -> bytesRender one publication Figure from exact evaluation rows.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
site | lunartrace.workbench.roi.Site | The Site; used only by the "map" kind to rebuild the ROI mask. |
body | dict | The result of lunartrace.workbench.roi.evaluate_ring, which supplies the roi, rows, taus, provenance, status and admission fields. |
kind | ('histogram', 'inclusion', 'map') | Figure kind. Default "histogram". |
fmt | ('svg', 'png', 'pdf') | Output format. PNG is written at 200 dpi. Default "svg". |
tau | float | Slope-RMS cutoff in degrees for the "map" kind. Defaults to the first tau in body["taus"]. Ignored by the other kinds. Default None. |
Returns
Section titled “Returns”bytes— The encoded figure.
Raises
Section titled “Raises”TypeError— Ifbodylacks the expected structure: a required field is missing or is not a mapping or list as the figure needs. The checks are explicit, so they still run underpython -O.
Output is deterministic for the same inputs. Creation dates and the generator software string are removed from the metadata, and the SVG hash salt is fixed. Each figure carries a stamp with the method id, status, admission, ROI and source witness, and states that valid-cell fraction is not lunar area. In the inclusion figure an undefined fraction (no jointly valid cells) is drawn as no bar and labelled as undefined, never as zero.