lunartrace.workbench.presets
Preset research operations: real Python the researcher can read, run and edit.
Each preset is the body of one marimo cell. Cells share the names defined by the Lab
setup cell: mo, np, sq (slope_quality), wroi (workbench ROI API),
figures, site, ring and taus. “Show Python” displays exactly these
bodies; nothing here is pseudocode.
Preset
Section titled “Preset”class
PresetOne researcher-facing analysis preset.
Attributes
Section titled “Attributes”| Name | Type | Description |
|---|---|---|
id | str | Stable key used by the Lab request (for example "roi-rows"). |
title | str | Short menu label. |
summary | str | One-sentence description shown beside the title. |
code | str | Python source of one marimo cell body, executed verbatim in the Lab. |
Preset.as_json
Section titled “Preset.as_json”def as_json(self) -> dict[str, str]Serialise the preset for the GET /presets response.
Returns
Section titled “Returns”dict of str to str— Keysid,title,summaryandcode.
attribute
SETUPSetup cell body; MANIFEST and STORE are placeholders bound by setup_with_paths.
RING and TAUS stay free names that the caller defines in the notebook.
setup_with_paths
Section titled “setup_with_paths”function
def setup_with_paths(manifest: Path, store: Path) -> strBind the manifest and store paths into the setup cell.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
manifest | pathlib.Path | Site source manifest path; stored as a POSIX string literal. |
store | pathlib.Path | Source store root; stored as a POSIX string literal. |
Returns
Section titled “Returns”str—SETUPwith the placeholders replaced, so a downloaded script and the Lab notebook load the same Site.
RING and TAUS are left as names for the caller to define.
STEEP_FOLLOWUP
Section titled “STEEP_FOLLOWUP”attribute
STEEP_FOLLOWUPFollow-up cell appended after the steep-share preset; it reads the slider it defines.
preset
Section titled “preset”function
def preset(preset_id: str) -> PresetLook up a preset by its id.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
preset_id | str | Id of a member of PRESETS. |
Returns
Section titled “Returns”Preset— The matching preset.
Raises
Section titled “Raises”KeyError— If no preset has this id.
cells_for
Section titled “cells_for”function
def cells_for(preset_ids: list[str]) -> list[str]Return the marimo cell bodies for the chosen presets, in order.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
preset_ids | list of str | Preset ids in the order they should appear in the notebook. |
Returns
Section titled “Returns”list of str— One code body per preset, plusSTEEP_FOLLOWUPimmediately after"steep-share".
Raises
Section titled “Raises”KeyError— If any id is not a known preset.