osmose.calibration.checkpoint

Calibration checkpoint module — atomic on-disk progress snapshots.

Read by the Shiny dashboard at 1 Hz; written by every optimizer (DE / CMA-ES / surrogate-DE / NSGA-II) every N generations.

See docs/superpowers/specs/2026-05-12-calibration-dashboard-design.md for the full contract and 14 invariants enforced in CalibrationCheckpoint.__post_init__.

Functions

default_results_dir()

Baltic default — OSMOSE_RESULTS_DIR env override, else package-root-resolved data/baltic/calibration_results/.

is_live(path[, max_age_s, now])

True iff (now - max_age_s) < mtime <= now.

liveness_state(age_seconds)

Three-state liveness classification per spec §7.

probe_writable(results_dir)

Write a temporary probe file; raise OSError on permission/missing-dir failure.

read_checkpoint(path)

Read and validate a checkpoint file.

write_checkpoint(path, ckpt)

Atomic write: serialise to a .tmp file then os.replace into place.

Classes

CalibrationCheckpoint(optimizer, phase, ...)

Atomic snapshot of a calibration run, written every N generations.

CheckpointReadResult(kind, checkpoint, ...)

Discriminated read result.

LiveSnapshot(active, other_live_paths, ...)

One atomic view of the results directory per scan tick.