Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ewm7922 defect pixel masks #521

Open
wants to merge 3 commits into
base: next
Choose a base branch
from
Open

Conversation

darshdinger
Copy link
Contributor

@darshdinger darshdinger commented Dec 13, 2024

Description of work

This change addresses a scenario where a pixel group in a given reduction process can become entirely masked out. When all pixels in a group are excluded, the data arrays for that group are effectively empty. Downstream algorithms (notably, SmoothDataExcludingPeaks) currently assume that some data are always present, and fail when attempting to process an empty dataset. The modifications introduced here ensure that the workflow can detect when a pixel group is fully masked, skip any further data processing for that group, and provide a clear warning message to the user.

Explanation of work

The code replaces _isGroupFullyMasked() checks with _checkMaskedPixels(), which takes a more semantic approach. Instead of iterating through raw pixel data, _checkMaskedPixels():

  • Parses the groupingWorkspace name to determine the corresponding "focus group."
  • Looks up the pixelGroup object associated with that focus group.
  • Checks the pixelGroupingParameters of the pixelGroup to determine if any subgroups are fully masked.

If a subgroup is found to be fully masked, a warning is logged and the method instructs the calling code to skip further processing. If the entire group is masked, a similar warning is provided.

To test

Dev testing

  1. Please insure that all unit tests pass.
  2. To test the functionality within SNAPRed UI, please follow the steps listed:
  • Within your local Calibration directory, delete all of your states, start SNAPRed and run a diffraction calibration and a normalization for run 58882. You can use the following inputs:

diffraction calibration
run number: 58882
convergence threshold: 0.1
bins across peak width: 10
sample: Silicon_NIST_640D_001
grouping: Column

normalization:
run number: 58882
background run number: 58810
sample: Silicon_NIST_640D_001
grouping: Column

  • Use the diffcal_masking_script.py within mantid workbench to produce a masking workspace where all pixels are masked.
  • Create another mask where only a certain banks are fully masked.

Following this, use these masks in two separate test runs of Reduction within SNAPRed to see how these cases are handled.

CIS testing

Same as above.

Link to EWM item

EWM # 7922

Verification

  • the author has read the EWM story and acceptance critera
  • the reviewer has read the EWM story and acceptance criteria
  • the reviewer certifies the acceptance criteria below reflect the criteria in EWM

Acceptance Criteria

This list is for ease of reference, and does not replace reading the EWM story as part of the review. Verify this list matches the EWM story before reviewing.

  • Correct handling of mask workspaces within Reduction Workflow execution

@neutrons neutrons deleted a comment from codecov bot Dec 13, 2024
@darshdinger darshdinger marked this pull request as ready for review December 13, 2024 15:34
Copy link

codecov bot commented Dec 13, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 95.65%. Comparing base (0ad840a) to head (fba843e).

Files with missing lines Patch % Lines
src/snapred/backend/recipe/ReductionRecipe.py 90.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next     #521      +/-   ##
==========================================
- Coverage   95.69%   95.65%   -0.04%     
==========================================
  Files          67       67              
  Lines        5012     5017       +5     
==========================================
+ Hits         4796     4799       +3     
- Misses        216      218       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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