Skip to content

Conversation

rbauststfc
Copy link
Contributor

@rbauststfc rbauststfc commented Dec 3, 2024

Description of work

Summary of work

A new algorithm that implements the pre-processing steps described on the linked issue. See the "Calibration runs" section for a description of what is required. The purpose of the algorithm is to pre-process the magnetic and non-magnetic calibration runs taken on POLREF so that they are ready to pass to the PolarizationEfficienciesWildes algorithm.

Fixes #35682.

Further detail of work

This PR includes a few workarounds in order to prevent delays to the work. However, ideally more fundamental fixes should be found, so I will open issues for the following:

  • It seems that you cannot retrieve the output workspace group from an OutputWorkspace property when an algorithm is run as a child on a workspace group. As explained in the comment in the code, I have implemented a workaround, but it would be good to try and resolve this at source at some point (Calling child algorithms with workspace groups doesn't populate output workspace property #38473).

  • The Divide algorithm sets the YUnit to an empty string and the distribution flag to True if two workspaces with the same units are divided by each other. However the Mantid Integration algorithm performs the integration differently for distribution data as it assumes that it means the counts in the workspace have been divided by the bin width. The apparent discrepancy between the two definitions of "distribution" can lead to incorrect results when we create the transmission workspace after a flood correction (due to the use of the Integration algorithm within CreateTransmissionWorkspaceAuto in order to normalize by monitors). In this PR, I have manually set the flood corrected workspace back to a non-distribution as a workaround.

To test:

This implements a workflow that the POLREF scientists have already implemented in their own code, so I have validated against their results to check that the new algorithm produces equivalent results.

The reviewer should run the new algorithm and check that the validation is robust. The following script can be used to do that:

out_grp = ReflectometryISISCreateTransmission(InputRuns=["POLREF32130", "POLREF32132"], ProcessingInstructions="272-290")

The algorithm docs should be built and checked to ensure that they are easy to understand, and there are no spelling and grammar issues.

I have run a build from branch to check that the system test passes on all operating systems, although this was a few weeks ago now so could be repeated by the reviewer if they want to.


Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

@rbauststfc rbauststfc added Reflectometry Issues and pull requests related to reflectometry ISIS: LSS Issue and pull requests relating to SANS and Reflectometry (Large Scale Structures) at ISIS labels Dec 3, 2024
@rbauststfc rbauststfc added this to the Release 6.12 milestone Dec 3, 2024
@rbauststfc rbauststfc marked this pull request as ready for review December 4, 2024 12:01
@adriazalvarez adriazalvarez self-assigned this Dec 4, 2024
The background subtraction algorithm has a ProcessingInstructions
property, which is the same name as the property on
ReflectometryISISCreateTransmission. This means that error messages can be
confusing if we don't explicitly mention that they have come from the
background subtraction algorithm.
Use the LoadAndMerge algorithm to load and sum all the runs into a
single workspace as part of the first step.
The flood correction performs a divide which can result in the corrected
workspace being set as a distribution. This affects the result of the integration
that takes place when normalising by monitors during the
transmission workspace creation. The flood corrected workspace should
not be marked as a distribution, according to the definition that the
integration algorithm is using for this, so we need to set the flag
back to False.
@rbauststfc rbauststfc force-pushed the 35682_POLREF_eff_preprocessing branch from 6a56d63 to 70c1eef Compare December 4, 2024 21:22
Copy link
Contributor

@adriazalvarez adriazalvarez left a comment

Choose a reason for hiding this comment

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

Thanks for adding this algorithm. I have followed the test instructions and the transmission workspace is created with the intended properties. Additionally, unit tests and system tests are passing. The docs are well formatted and clear to follow.
I have few -minor- suggestions and questions, but otherwise it looks good.

Add link in the comment explaining the workaround for getting workspace group
outputs from child algorithms to the issue that has been opened for this
on GitHub.
Copy link
Contributor

@adriazalvarez adriazalvarez left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to address my comments.
I approved as the changes won't affect the test output.

@robertapplin robertapplin self-assigned this Dec 10, 2024
@robertapplin robertapplin merged commit 3d040e8 into mantidproject:main Dec 10, 2024
10 checks passed
@rbauststfc rbauststfc deleted the 35682_POLREF_eff_preprocessing branch February 17, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ISIS: LSS Issue and pull requests relating to SANS and Reflectometry (Large Scale Structures) at ISIS Reflectometry Issues and pull requests related to reflectometry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add algorithm for creating POLREF polarisation correction workspaces
3 participants