-
Notifications
You must be signed in to change notification settings - Fork 2
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
Reduction process: effective-instrument geometry. #461
Conversation
I'm adding a cis-test script to help with verifying acceptance criterion #4. |
104f557
to
a5f0817
Compare
I ran into a snag with the acceptance criteria, so please wait to review this PR. There are some required Mantid changes in order to get the CIS-test to work. :( |
73f62a4
to
db7ea42
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #461 +/- ##
==========================================
+ Coverage 96.55% 96.58% +0.03%
==========================================
Files 66 67 +1
Lines 4960 5010 +50
==========================================
+ Hits 4789 4839 +50
Misses 171 171 ☔ View full report in Codecov by Sentry. |
a88b80f
to
4267063
Compare
Everything is now ready for review! :) |
(the cis test script did pass with my data subbed in) |
413b15d
to
35c7f34
Compare
At the end of the reduction process, the instrument associated with each output workspace is modified. A new _effective_ instrument is substituted for each workspace. This instrument has the same number of pixels as there are group-ids, and the location of each pixel is set to the mean location of the _unmasked_ original pixels participating in that pixel group. By implication, this substitution results in there being one pixel per spectrum in the output workspaces. This commit includes the following changes: * A new `EffectiveInstrumentRecipe` implemented as a subrecipe called by `ReductionRecipe` for each grouping; * Modifications to `LocalDataService.writeReductionData` to use updated Mantid algorithms, now allowing limited I/O of programmatically-generated instruments; * Modification of `ReductionIngredients` to include the _unmasked_ `PixelGroup`s; * Modification of `SousChef.prepReductionIngredients` to prepare the _unmasked_ `PixelGroup`s; * Modification of existing unit tests, and implementation of new unit tests to verify the new subrecipe's execution. Associated with this PR are three Mantid PRs, including changes to the `EditInstrumentGeometry`, `SaveNexusESS`, and `LoadNexusProcessed` algorithms.
8bb61d7
to
28cc34f
Compare
for more information, see https://pre-commit.ci
* Reduction process: effective-instrument geometry. At the end of the reduction process, the instrument associated with each output workspace is modified. A new _effective_ instrument is substituted for each workspace. This instrument has the same number of pixels as there are group-ids, and the location of each pixel is set to the mean location of the _unmasked_ original pixels participating in that pixel group. By implication, this substitution results in there being one pixel per spectrum in the output workspaces. This commit includes the following changes: * A new `EffectiveInstrumentRecipe` implemented as a subrecipe called by `ReductionRecipe` for each grouping; * Modifications to `LocalDataService.writeReductionData` to use updated Mantid algorithms, now allowing limited I/O of programmatically-generated instruments; * Modification of `ReductionIngredients` to include the _unmasked_ `PixelGroup`s; * Modification of `SousChef.prepReductionIngredients` to prepare the _unmasked_ `PixelGroup`s; * Modification of existing unit tests, and implementation of new unit tests to verify the new subrecipe's execution. Associated with this PR are three Mantid PRs, including changes to the `EditInstrumentGeometry`, `SaveNexusESS`, and `LoadNexusProcessed` algorithms. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Kort Travis <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Description of work
At the end of the reduction process, the instrument associated with each output workspace is modified. A new effective instrument is substituted for the instrument attached to each workspace. This instrument has the same number of pixels as there are group-ids, and the location of each pixel is set to the mean location of the unmasked original pixels participating in that pixel group. By implication, this substitution results in there being one pixel per spectrum in each output workspace. (An exception to this substitution is the combined pixel-mask workspace, which is not modified.)
Explanation of work
This commit includes the following changes:
A new
EffectiveInstrumentRecipe
implemented as a subrecipe called byReductionRecipe
for each grouping;Modification of
ReductionIngredients
to include the unmaskedPixelGroup
s;Modification of
SousChef.prepReductionIngredients
to include the unmaskedPixelGroup
s;Modification of existing unit tests, and implementation of new unit tests to verify the new subrecipe's execution.
A known issue:
EditInstrumentGeometry
deletes, but does not regenerate the XML associated with the newly-edited instrument. Unfortunately, this tends to generate a lot of misleading log messages when the associated workspaces are saved, and then reloaded. This isn't so much an issue withEditInstrumentGeometry
specifically, but rather with the Mantid instrument framework.To test
Existing unit tests have been modified, and new unit tests have been added to cover the new subrecipe. A new CIS-test script has been added at
tests/cis_tests/effective_instrument_script.py
.Dev testing
In addition to running the unit tests, and the CIS-test script, the GUI-panels should be run for the full set of workflows. There should be no observable behavior changes. (With the exception of the log messages associated with the new output changes, and a warning message associated with the "known issue" indicated above.) Note that you'll also need the newly-saved output from the reduction workflow to test this PR.
The instrument associated with any output workspace can be examined directly. It should now have the same number of pixels as there are spectra in the workspace. Please see (and run through) the new CIS-test script at:
tests/cis_tests/effective_instrument_script.py
.CIS testing
The new changes function automatically as part of the reduction process.
The instruments attached to the reduction-output workspaces should be examined, and verified to be as expected.
For comparison purposes, or in the case a work-around is required, the "application.yml" flag
reduction.output.useEffectiveInstrument
can be used to turn off the effective-instrument substitution.Link to EWM item
EWM#6549
Verification
Acceptance Criteria
Where possible, all new changes are covered by unit tests.
Reduction output workspaces will have a new effective instrument that has the same number of pixels as there are spectra in the workspace. (And by assumption, these workspaces will have a number of spectra that correspond to the number of group-ids in the associated grouping.)
The name of the effective instrument will be "SNAP_<grouping name>".
Locations of each effective pixel will correspond to those of the unmasked PGP values for that pixel's group-id. Note that
tests/cis_tests/effective_instrument_script.py
can be used to obtain and verify these values. Mantid-workbench instrument view might also be a useful way to verify this quickly.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.