fix(config): compute vit_normalization inline, not via ptychoml (client/replay envs lack it)#49
Merged
Garrett Bischof (gwbischof) merged 1 commit intoJun 9, 2026
Conversation
config_from_tiled's vit_normalization auto-detect was changed in the H6b decomposition PR to call ptychoml.compute_intensity_normalization. But config_from_tiled runs in the `client` and `replay` pixi envs, which deliberately do NOT depend on ptychoml (the replay env dropped it on purpose). So the import raised ModuleNotFoundError, the broad except swallowed it, and vit_normalization silently came out unset — both for `config-from-tiled` and for `replay --hp-start` (which builds its config via build_full_config -> load_config_from_tiled). Revert to the inline hot-pixel-masked max (numpy only). Verified against scan 405820: vit_normalization now resolves to 1150.0, matching the operator's known-good config. (The ptychoml-reuse was well-intentioned but I only tested it in the default env, which has ptychoml; the failure only shows in the client/replay envs.) Co-authored-by: Himanshu Goel <4122621+himanshugoel2797@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while validating scan 405820 against the operator's known-good config.
Bug
H6b (#47) swapped
config_from_tiled'svit_normalizationauto-detect from an inline hot-pixel-masked max toptychoml.compute_intensity_normalization. Butconfig_from_tiledruns in theclientandreplaypixi envs, which deliberately don't depend on ptychoml (the replay env dropped it). So:The broad
exceptswallowed it andvit_normalizationcame out unset — both for the standaloneconfig-from-tiledtask and forreplay --hp-start(which builds its config viabuild_full_config→load_config_from_tiled).Fix
Revert to the inline numpy hot-pixel-masked max. Verified against scan 405820:
vit_normalizationnow resolves to1150.0, matching the operator's known-good config.How it slipped through
The H6b swap was only exercised in the default env (which has ptychoml) via
py_compile+--help; the failure only manifests in theclient/replayenvs where the function actually runs. (compute_intensity_normalizationitself is fine and still used bydetect_orientation.py, which runs in an env that does have ptychoml.)No new test:
config_from_tiledis Tiled-I/O bound (the normalization path needs a live scan). Validated end-to-end against 405820.