spacr.notebook_export

Notebook export — turn a run journal into a runnable Jupyter notebook.

Every completed run in ~/.spacr/runs/ can be exported to a .ipynb file that walks a user through:

  1. Importing spaCR + the pipeline used.

  2. Loading the exact settings from settings.json.

  3. Optionally re-running the pipeline (commented out — reviewer choice) or loading the outputs directly.

  4. Scaffolded per-output cells that read the measurements database, plot summary charts, and expose the DataFrame for further analysis in the notebook.

Public API:

from spacr.notebook_export import export_run

nb_path = export_run(run_dir, out_path="/tmp/mask_run.ipynb")

Notebook is generated with the nbformat library (widely-shipped Jupyter dependency; no extra install needed).

Functions

export_run(→ pathlib.Path)

Export a run journal folder to a Jupyter notebook.

Module Contents

spacr.notebook_export.export_run(run_dir: Any, out_path: Any | None = None) → pathlib.Path[source]

Export a run journal folder to a Jupyter notebook.

Parameters:
  • run_dir – path to a ~/.spacr/runs/<ts>_<uuid>__<app> folder.

  • out_path – destination .ipynb path. Defaults to <run_dir>/notebook.ipynb.

Returns:

the notebook path on disk.

Raises:

FileNotFoundError – when the run folder is missing or doesn’t have a manifest.json / settings.json.