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

SetBeam to prevent invalid bounding box error when running AddAbsorptionWeightedPathLengths in ISIS SX reduction classes #38163

Conversation

RichardWaiteSTFC
Copy link
Contributor

@RichardWaiteSTFC RichardWaiteSTFC commented Oct 8, 2024

Description of work

Bounding box error comes from AddAbsorptionWeightedPathLengths algorithm - this sets the beam size to something sensible for each instrument such that the bounding box calculation is correct.

The error is thrown here

error << "Error creating bounding box, inconsistent values given:\n"

I think the max > min comparison is invalid (sometimes - not all the time!) due to to floating point precision? But this doesn't happen when a sensible beam size is used.

There is no associated issue.

Report to: SXD (found during beta testing with SXD scientists)

To test:

(1) Run this script

from mantid.simpleapi import *
from Diffraction.single_crystal.sxd import SXD
from Diffraction.single_crystal.base_sx import PEAK_TYPE

runno = 34768
ws = Load(Filename=f'SXD{runno}.raw', OutputWorkspace=f'SXD{runno}')

SetSample(
    ws,
    Geometry={'Shape': 'Cylinder', 'Height': 0.4, 'Radius': 0.065, 'Center': [0.,0.,0.]},
    Material={"ChemicalFormula": "C2 H4", "SampleNumberDensity": 0.02, "NumberDensityUnit": "Formula Units"},
)
# make peaks workspace and set intensity to 1
peaks = FindSXPeaksConvolve(InputWorkspace=ws, PeaksWorkspace=ws.name() + '_peaks', 
                            ThresholdIoverSigma=50, NRows=3, NCols=3, GetNBinsFromBackToBackParams=True, 
                            NFWHM=3, PeakFindingStrategy="IOverSigma")

sxd = SXD()
sxd.set_ws(runno, ws)
sxd.set_peaks(runno, peaks, PEAK_TYPE.FOUND)
sxd.calc_absorption_weighted_path_lengths(PEAK_TYPE.FOUND)

(2) Check that tbar column is populated in peak table

This does not require release notes because bug in feature added in this release


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.

@RichardWaiteSTFC RichardWaiteSTFC added Diffraction Issues and pull requests related to diffraction Single Crystal Issues and pull requests related to single crystal ISIS Team: Diffraction Issue and pull requests managed by the Diffraction subteam at ISIS labels Oct 8, 2024
@RichardWaiteSTFC RichardWaiteSTFC added this to the Release 6.11 milestone Oct 8, 2024
@RichardWaiteSTFC RichardWaiteSTFC marked this pull request as draft October 8, 2024 15:25
Bounding box error comes from AddAbsorptionWeightedPathLengths algorithm
@RichardWaiteSTFC RichardWaiteSTFC force-pushed the fix_error_bounding_box_AddAbsorptionWeightedPathLengths branch from 8e09cb7 to 1a874c2 Compare October 10, 2024 09:04
@RichardWaiteSTFC RichardWaiteSTFC marked this pull request as ready for review October 10, 2024 15:48
Copy link
Contributor

@SilkeSchomann SilkeSchomann 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 and the script output is as expected 👍🏻

@robertapplin robertapplin self-assigned this Oct 11, 2024
@robertapplin robertapplin merged commit c581f90 into release-next Oct 11, 2024
10 checks passed
@robertapplin robertapplin deleted the fix_error_bounding_box_AddAbsorptionWeightedPathLengths branch October 11, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Diffraction Issues and pull requests related to diffraction ISIS Team: Diffraction Issue and pull requests managed by the Diffraction subteam at ISIS Single Crystal Issues and pull requests related to single crystal
Projects
Status: Done
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants