System map

pySTAMPS is organized around the dataset directory as the source of truth.

The CLI, runtime scheduler, ported stages, optimized kernels, and verification tools all read from or write to the same StaMPS-style dataset tree.

Runtime layers

LayerMain modulesResponsibility
CLIpystamps.cliParse commands, load config, print JSON reports.
Configurationpystamps.configNormalize runtime, kernel, tolerance, tool, and compatibility settings.
Dataset I/Opystamps.io.dataset, pystamps.io.matDiscover patches and read/write MATLAB-compatible artifacts.
Pipeline orchestrationpystamps.pipeline.stagesSelect stages, skip existing artifacts, schedule patch or merged work.
Scientific stagespystamps.pipeline.portedImplement StaMPS-style stage behavior in Python.
Kernelspystamps.kernelsDispatch hot numerical kernels to Python, native Rust/CPU, or CUDA providers.
Verificationpystamps.verify, scripts/validate_audit.pyCompare outputs against golden datasets and audit manifests.

Pipeline model

StageScopePipeline nameExpected progress artifact
1PatchInitial loadPATCH_*/ps1.mat
2PatchEstimate gammaPATCH_*/pm1.mat
3PatchSelect PS pixelsPATCH_*/select1.mat
4PatchWeed adjacent pixelsPATCH_*/weed1.mat
5Patch and mergedCorrect phase and mergePATCH_*/ph2.mat, root ifgstd2.mat
6MergedUnwrap phaseroot phuw2.mat
7MergedCalculate SCLAroot scla2.mat
8MergedFilter SCNroot uw_space_time.mat
Patch-scoped stages run once per discovered PATCH_* directory. Merged stages run once at the dataset root.

Artifact-driven scheduling

Before running a stage, pystamps.pipeline.stages checks the expected artifact or merged stage bundle. If the artifacts already exist, the result status is skipped_existing.

StatusMeaning
plannedDry-run selected the stage but did not execute it.
completedStage executed or strict reference replay copied the expected bundle.
skipped_existingExpected artifacts were already present.
skippedNo artifact mapping exists for that scope.
failedStage raised an execution error.

Backend and kernel architecture

pySTAMPS separates runtime scheduling from numerical kernel selection. Runtime settings control thread/process/GPU-oriented scheduling. Kernel settings choose the reference Python implementation, compiled native Rust/CPU implementation, or CUDA provider where available.

uv run pystamps describe-backends

Optimized kernels

  • stage2_grid_accumulate
  • stage2_histogram
  • stage2_topofit
  • stage2_topofit_row_invariant
  • stage2_topofit_coh_row_invariant
  • stage4_edge_stats
  • stage7_scla
  • stage8_edge_noise
runtime:
  backend: auto
  stage2_kernel_backend: native
  stage2_native_threads: 0
  kernel_backend_overrides:
    stage2_grid_accumulate: native
    stage2_histogram: native
    stage2_topofit: native
    stage2_topofit_row_invariant: native
    stage2_topofit_coh_row_invariant: native
    stage4_edge_stats: native
    stage7_scla: native
    stage8_edge_noise: native
  io_workers: 8
  cpu_workers: 0
  stage7_chunk_ps: 100000
  stage8_chunk_edges: 200000

Workflow graph (Figma)

This diagram focuses on the command flow around status and run.

Open the source graph in Figma
pySTAMPS status/run workflow graph

Verification architecture

Single-run verification compares one run tree to one golden tree. Full parity audit is handled by make audit and reads the maintained manifest.

uv run pystamps verify --run RUN_DIR --golden GOLDEN_DIR
make audit

The audit dataset list is owned by pystamps/data/audited_workflow_manifest.json. Oracle precedence is owned by pystamps/data/oracle_contract.json.

Practical boundaries

  • The package implements stages 1 through 8 in pystamps.pipeline.ported.
  • The optimized native extension accelerates selected hot kernels, not every line of the pipeline.
  • External tools such as triangle and snaphu are still required for relevant unwrapping workflows.
  • Parity should be claimed from verify or audit evidence, not from command completion alone.
  • Speed should be claimed from make benchmark or scripts/benchmark_backends.py, not from a skipped pipeline run.