Skip to content

improve robustness by replacing if/else with try/except#369

Merged
shamin-slac merged 1 commit into
mainfrom
robustness
May 11, 2026
Merged

improve robustness by replacing if/else with try/except#369
shamin-slac merged 1 commit into
mainfrom
robustness

Conversation

@roussel-ryan
Copy link
Copy Markdown
Collaborator

This pull request improves the robustness of the process_images function in lcls_tools/common/image/processing.py by replacing manual checks for zero-intensity images with exception handling. This makes the image centering and cropping steps more reliable and provides clearer warnings when issues occur.

Error handling improvements:

  • Replaced manual zero-intensity checks with try/except blocks during image centering, issuing a warning and skipping centering if a ValueError occurs.
  • Replaced manual zero-intensity checks with try/except blocks during image cropping, issuing a warning and skipping cropping if a ValueError occurs. [1] [2]

@roussel-ryan roussel-ryan requested a review from shamin-slac May 7, 2026 19:25
@shamin-slac shamin-slac merged commit cff0f04 into main May 11, 2026
10 checks passed
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.

2 participants