Skip to content

feat(replay): Tiled replay + config robustness (sockets, polling, auto-detect)#47

Merged
Garrett Bischof (gwbischof) merged 1 commit into
mainfrom
h6b/replay-config-robustness
Jun 9, 2026
Merged

feat(replay): Tiled replay + config robustness (sockets, polling, auto-detect)#47
Garrett Bischof (gwbischof) merged 1 commit into
mainfrom
h6b/replay-config-robustness

Conversation

@gwbischof

Copy link
Copy Markdown
Collaborator

H6b of the #37 decomposition — replay/config tooling robustness. All three files' main history is fully contained in #37 (merge-base --is-ancestor confirmed), so #37's changes apply cleanly on top — no main-only work lost.

datasource.py

  • Cap ZMQ reconnect backoff (RECONNECT_IVL_MAX=1s) on EigerZmqRxOp + PositionRxOp, so a SUB started before its publisher binds reconnects within ~1s instead of waiting minutes (pairs with replay --no-hp-start).

replay_from_tiled.py

  • publish_eiger accepts a prebound_socket so the caller binds the PUB before the pipeline starts (SUB connects during compose()); only closes sockets it owns.
  • _wait_for_pipeline_ready polls /status before publishing in --no-hp-start.
  • iter_frame_chunks default n_workers 16→4 with exponential-backoff retry on httpx PoolTimeout; new --tiled-workers flag.

config_from_tiled.py

  • Auto-detect panda_upsample (encoder/frame shape ratio) and vit_normalization — the latter via ptychoml.compute_intensity_normalization instead of Enhance image processing and orientation detection in holoptycho #37's inline mask+max (behavior-equivalent; its ValueError on the all-hot case maps to the prior warning path).
  • New CLI args: --patch-flip, --min-overlap-count, --overshoot-factor, --x/--y-direction.

Testing

Dev-tooling socket/HTTP/Tiled-I/O robustness — not unit-testable in CI without a live Tiled server + ZMQ pipeline. It faithfully reproduces #37 (clean apply, ancestry-verified), and the one computational reuse (compute_intensity_normalization) is ptychoml-tested. --help works for both scripts.

pixi run test   # 95 passed; the 2 vit_inference/ptycho_holo smoke failures are pre-existing.

Remaining: H6c — infra/docs (Dockerfile, start_editable.sh, pixi.toml, README).

…o-detect)

Replay/config tooling improvements from #37 (all verified to apply cleanly —
main's replay/config history is fully contained in #37):

datasource.py:
- Cap ZMQ reconnect backoff at RECONNECT_IVL_MAX=1s on EigerZmqRxOp and
  PositionRxOp, so a SUB started before its publisher binds reconnects within
  ~1s instead of waiting minutes (pairs with replay --no-hp-start).

replay_from_tiled.py:
- publish_eiger accepts a prebound_socket so the caller can bind the PUB
  before the pipeline starts (SUB connects during compose()), and only
  closes sockets it owns.
- _wait_for_pipeline_ready polls /status before publishing in --no-hp-start.
- iter_frame_chunks default n_workers 16 -> 4 with exponential-backoff retry
  on httpx PoolTimeout; new --tiled-workers flag.

config_from_tiled.py:
- Auto-detect panda_upsample (encoder/frame shape ratio) and vit_normalization
  (max raw intensity, hot pixels excluded) — the latter via
  ptychoml.compute_intensity_normalization instead of an inline mask+max
  (behavior-equivalent; ValueError on all-hot maps to the prior warning path).
- New CLI args: --patch-flip, --min-overlap-count, --overshoot-factor,
  --x/--y-direction.

Dev-tooling socket/HTTP/Tiled robustness — not unit-testable in CI without a
live Tiled server + ZMQ pipeline; faithfully reproduces #37 (clean apply,
ancestry-verified) and the normalization reuse is ptychoml-tested. Suite
passes (95, modulo the 2 pre-existing TILED smoke imports).

H6b of the #37 decomposition.

Co-authored-by: Himanshu Goel <4122621+himanshugoel2797@users.noreply.github.com>
@gwbischof Garrett Bischof (gwbischof) merged commit 2d6b7fc into main Jun 9, 2026
5 checks passed
@gwbischof Garrett Bischof (gwbischof) deleted the h6b/replay-config-robustness branch June 9, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant