Skip to content

Export

Every export is generated from Python’s numeric output. None of them is a screenshot of an interactive view, and none of them is admitted. Each exported artifact carries the method identifier and the status METHOD_EXECUTED · NOT_ADMITTED where the format allows it.

The Python instrument shows a script for the current ROI. The script is a set of marimo cell bodies assembled by presets.py from a fixed setup block. The setup binds the sidecar’s manifest and store paths, and the ROI ring and τ literals:

import marimo as mo
import numpy as np
from pathlib import Path
from lunartrace.science import slope_quality as sq
from lunartrace.workbench import figures
from lunartrace.workbench import roi as wroi
site = wroi.load_site(Path("<manifest path>"), Path("<store path>"))
ring = wroi.check_ring(RING) # the evaluated ROI ring
taus = TAUS # the selected cutoffs

Actions:

  • Copy copies the script.
  • Download .py saves it as lunartrace-<roi id>-<preset id>.py.
  • Open in Lab opens the same presets in the Lab (see below).

Presets (GET /presets returns the same list):

IdTitlePurpose
roi-rowsEvaluate ROI rowsslope_quality/v1 rows over the ROI mask at each τ (default)
tau-sweepSweep the slope-RMS cutoffInclusion fraction over 120 τ values from 0.25 to 30.0
slope-vs-rmsSlope against slope RMSLog-scaled hexbin of slope against slope RMS inside the ROI
compare-referenceCompare with the source ROIsRows for the reference ROIs (v1 closed rule) beside the user ROI (centre-inside rule)
steep-shareSteep terrain shareSlider (5 to 45 degrees) and the share of included cells steeper than it, per τ
figureMake a FigureDeterministic histogram SVG from the exact rows

A preset is the body of one cell. Cells share the names mo, np, sq, wroi, figures, site, ring and taus, so a downloaded script and the Lab notebook load the same Site.

The Lab instrument embeds an editable marimo notebook served by the sidecar.

  • The sidecar writes the notebook to build/lab/roi-<first 12 hex of ring SHA-256>.py (the default lab directory) and starts marimo edit on 127.0.0.1:4319 with a per-process access token. The url returned by POST /lab/open includes that token.
  • The notebook header states the ROI identity, kind and mask rule, and repeats METHOD_EXECUTED, NOT_ADMITTED.
  • Because the file name depends only on the ring, a notebook is written once per ring. A later request for the same ring with different presets returns the existing file, and an edited notebook is not overwritten.
  • Nothing computed in the Lab is promoted to a Study or admitted.

The Lab runs as a separate local process. If port 4319 is busy, or marimo does not start within 30 seconds, the sidecar returns an error (see Sidecar API).

The Figure instrument produces figures with figures.render, which is deterministic for the same inputs. Figures contain no creation dates, and the SVG uses a fixed hash salt.

ControlOptionsNotes
KindHistogram, Inclusion, MapMap is the only kind that uses τ
τ cutoffOne of the evaluated τ valuesShown only for Map; if omitted the first τ is used
FormatSVG, PNG, PDFThe preview is always SVG; Export uses the chosen format

The figure stamp reports the method identifier, status, admission, ROI id, kind, cell count, mask rule, source witness, the slope SHA-256 prefix and a line stating that the valid-cell fraction is not lunar area and that τ is a slope-RMS data-quality cutoff.

Export filenames follow lunartrace-<roi id with ':' replaced by '-'>-<kind>.<format>, for example lunartrace-source-0-histogram.svg. The sidecar sets the same name in the content-disposition header.

Format details:

  • SVG: text is converted to paths (svg.fonttype: path), the hash salt is fixed, and the Date metadata is removed.
  • PNG: rendered at 200 dpi; the Software metadata is removed.
  • PDF: rendered at 200 dpi; the creation and modification dates are removed.

Save run (S, or the Save run command) saves the currently evaluated ROI as a local JSON capsule, then opens the Runs panel. A capsule is only available when the ROI evaluation has succeeded.

Capsule structure:

{
"kind": "lunartrace.research-capsule",
"version": 1,
"durability": "local file only; not openBIS, not a Study, not admitted",
"id": "run-<first 8 hex of ring SHA-256>-<base-36 timestamp>",
"savedAt": "<ISO 8601 time>",
"roiId": "<roi id, for example source:0 or user:<12 hex>>",
"ring": [[lon, lat], "..."],
"taus": [0.5, 2.0, 25.0],
"rows": [],
"status": "METHOD_EXECUTED",
"admission": "NOT_ADMITTED",
"provenance": {}
}

The file is named lunartrace-<run id>.json. In the Runs panel each saved run can be Restored into the workbench or Downloaded again.

Export CSV in the Rows panel writes one row per τ with the raw Python values. Filename: lunartrace-<roi id>-rows.csv.

Columns, in order:

ColumnMeaning
tauCutoff τ
roi_cellsCells in the ROI mask, including cells with missing values
valid_slope_cellsROI cells whose slope is finite and within [0, 90] degrees
valid_err_cellsROI cells whose slope RMS is finite and strictly positive
joint_cellsROI cells where both are valid
included_cellsJointly valid cells with slope RMS ≤ τ
included_fractionincluded_cells / joint_cells; empty when joint_cells is zero
slope_meanMean slope of included cells (degrees); empty when none are included
quantile columnsInverted-CDF quantiles of included slopes at the probabilities 0.05, 0.25, 0.5, 0.75 and 0.95
slope_histogramCounts of included slopes in 45 bins of 2 degrees over [0, 90]

Values are written raw; display rounding in the table is not applied to the CSV.