Skip to content
New issue

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

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

Already on GitHub? # to your account

ReductionRecipe: check fully-masked group using PGP.isMasked flags #546

Merged
merged 2 commits into from
Feb 19, 2025

Conversation

ekapadi
Copy link
Contributor

@ekapadi ekapadi commented Feb 18, 2025

Description of work

This fixes a critical defect due to the previous implementation of the _isGroupFullyMasked method. In addition, the current implementation makes use of the already calculated PixelGroupingParameters.isMasked flags, which are set for any fully-masked subgroups in a grouping schema.

Explanation of work

This commit includes the following changes:

  • Repair the implementation of ReductionRecipe._isGroupFullyMasked so it actually evaluates whether or not every pixel within every subgroup of a grouping schema is masked.

The previous implementation of this method was based on the assumption that each spectrum of a grouping workspace contained a list of the indices of all of the pixels participating in a subgroup of the schema, with the subgroup-id corresponding to spectrum index. On the contrary, each spectrum of a grouping workspace contains a single value, which is the subgroup-id of the pixel with the same detector-index as that the spectrum-index. The net effect if this confusion was that any mask workspace that had a small number of the lowest-index pixels masked, corresponding to the number of subgroups in the schema (+ 1), would result in the method determining that every subgroup in the schema was fully masked, which was clearly incorrect.

To test

Dev testing

Existing unit tests have been modified to cover these new changes.

CIS testing

To duplicate the original defect, please see the EWM item.

Link to EWM item

EWM#9603

Copy link

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.03%. Comparing base (53e9326) to head (4d4c4c0).
Report is 2 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next     #546      +/-   ##
==========================================
+ Coverage   96.02%   96.03%   +0.01%     
==========================================
  Files          71       71              
  Lines        5463     5454       -9     
==========================================
- Hits         5246     5238       -8     
+ Misses        217      216       -1     

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

@ekapadi ekapadi force-pushed the EWM9603_fully_masked_grouping branch from 20345bd to 489c216 Compare February 18, 2025 20:54
This commit includes the following changes:

  * Repair the implementation of `ReductionRecipe._isGroupFullyMasked` so it actually evaluates whether or not every pixel within every subgroup of a grouping schema is masked.

  * This fixes a critical defect due to the previous implementation of the `_isGroupFullyMasked` method.  In addition, the current implementation makes use of the already calculated `PixelGroupingParameters.isMasked` flags, which are set for any fully-masked subgroups in a grouping schema.

  The previous implementation of this method was based on the assumption that each spectrum of a grouping workspace contained a list of the indices of all of the pixels participating in a subgroup of the schema, with the subgroup-id corresponding to spectrum index.  On the contrary, each spectrum of a grouping workspace contains a single value, which is the subgroup-id of the pixel with the same detector-index as that the spectrum-index.  The net effect if this confusion was that any mask workspace that had a small number of the lowest-index pixels masked, corresponding to the number of subgroups in the schema (+ 1), would result in the method determining that every subgroup in the schema was fully masked, which was clearly incorrect.
@ekapadi ekapadi force-pushed the EWM9603_fully_masked_grouping branch from e049026 to 72bf428 Compare February 18, 2025 21:27
Copy link
Contributor

@darshdinger darshdinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. Pytests pass. Correct behavior seen within SNAPRed on analysis using a completely masked masking workspace.

@darshdinger darshdinger merged commit 4b6648a into next Feb 19, 2025
8 checks passed
@darshdinger darshdinger deleted the EWM9603_fully_masked_grouping branch February 19, 2025 15:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants