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

Add property to Divide algorithm to override default output value of distribution flag #38578

Open
rbauststfc opened this issue Jan 9, 2025 · 0 comments

Comments

@rbauststfc
Copy link
Contributor

rbauststfc commented Jan 9, 2025

The Divide algorithm sets the output workspace distribution flag to True in the following cases:

  1. If both workspaces are ragged
  2. If both workspaces have the same units and the RHS workspace (i.e. the denominator workspace) has multiple bins

Some other Mantid algorithms (e.g. the Integration algorithm) assume that a workspace with the distribution flag set to True will have had it's counts divided by the bin width, so you get different results depending on what the flag is set to. In some scenarios a divide such as the one described in case 2 above will result in a distribution (e.g. if you divide a workspace by a vanadium measurement then you will have also accounted for the bin-width), however some will not (e.g. absorption corrections, which are just the attenuation at the bin-centre).

The way the Divide algorithm automatically sets the distribution flag can be missed/cause confusion and has had to be worked around in a few scenarios at ISIS (see #38466 as a recent example). Having discussed this with ORNL, their workflows are not currently affected by this, but they would be OK with us adding an extra property to the Divide algorithm to allow the default behaviour to be overridden when appropriate.

The suggestion from Pete is to add the additional property as an EnumeratedStringProperty with values of histogram, distribution, and auto (default).

It may also be good to add a description to the algorithm documentation to ensure users aren't caught out by this behaviour.

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

No branches or pull requests

1 participant