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 new integration algorithm for single-crystal Bragg peaks #37103

Merged
merged 22 commits into from May 1, 2024

Conversation

RichardWaiteSTFC
Copy link
Contributor

@RichardWaiteSTFC RichardWaiteSTFC commented Apr 2, 2024

Description of work

Add new integration algorithm for single-crystal Bragg peaks adapted and extended from an algorithm in SXD2001 [1].
It uses scipy.minimize to fit peaks in adjacent pixels until the I/sigma ratio drops below some threshold - note scipy.minimize is used because mantid fitting currently does not perform well for this type of function - in principle it should be straightforward to use the mantid fitting at a later date.

[1] Gutmann, M. J. (2005). SXD2001. ISIS Facility, Rutherford Appleton Laboratory, Oxfordshire, England.

Fixes #33629

Report to: Matthias Gutmann (SXD)

To test:

(1) Run this script (maybe delete a few rows/peaks from the table if it takes too long)

Load(Filename='/archive/ndxsxd/Instrument/data/cycle_10_3/SXD23767.raw', OutputWorkspace='SXD23767')
FindSXPeaksConvolve(InputWorkspace='SXD23767', PeaksWorkspace='peaks_out', GetNBinsFromBackToBackParams=True, ThresholdIoverSigma=20)
IntegratePeaks1DProfile(InputWorkspace='SXD23767', PeaksWorkspace='peaks_out', OutputWorkspace='peaks_int_poisson', GetNBinsFromBackToBackParams=True, NFWHM=6, CostFunction='Poisson', FixPeakParameters='A', FractionalChangeDSpacing=0.02, OutputFile='/mnt/babylon/Public/RWaite/SXD23767_1D_profile_poisson.pdf')
IntegratePeaks1DProfile(InputWorkspace='SXD23767', PeaksWorkspace='peaks_out', OutputWorkspace='peaks_int', GetNBinsFromBackToBackParams=True, NFWHM=6, CostFunction='RSq', FixPeakParameters='A', FractionalChangeDSpacing=0.02, OutputFile='/mnt/babylon/Public/RWaite/SXD23767_1D_profile_Rsq.pdf')

(2) Check the output pdf (it should have a couple of plots per peak)
image


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 Apr 2, 2024
@RichardWaiteSTFC RichardWaiteSTFC added this to the Release 6.10 milestone Apr 2, 2024
@RichardWaiteSTFC RichardWaiteSTFC marked this pull request as draft April 2, 2024 17:42
System test previously not run due to indentation level typo. When enabled the test failed due to a bug trying to get the shoebox dimensions from a strong peak when there was no output file specified (as no ShoboxResult associated with the peak).
Not sure why the discrepancy with my local build - recent change to numpy version?
@RichardWaiteSTFC RichardWaiteSTFC force-pushed the 33629_line_integration_algorithm_for_SX branch from 8a1046c to 2888cc4 Compare April 9, 2024 12:40
Help see why the test is failing!
@RichardWaiteSTFC RichardWaiteSTFC force-pushed the 33629_line_integration_algorithm_for_SX branch from 2888cc4 to af0df07 Compare April 11, 2024 11:14
@RichardWaiteSTFC RichardWaiteSTFC marked this pull request as ready for review April 15, 2024 09:05
@robertapplin robertapplin self-assigned this Apr 16, 2024
Copy link
Contributor

@robertapplin robertapplin left a comment

Choose a reason for hiding this comment

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

Looks good, still need to test. Spotted a few typos but other than that the code is neatly divided into functions where possible :)

@github-actions github-actions bot added the Has Conflicts Used by the bot to label pull requests that have conflicts label May 1, 2024
Copy link

github-actions bot commented May 1, 2024

👋 Hi, @RichardWaiteSTFC,

Conflicts have been detected against the base branch. Please rebase your branch against the base branch.

@github-actions github-actions bot removed the Has Conflicts Used by the bot to label pull requests that have conflicts label May 1, 2024
Copy link
Contributor

@robertapplin robertapplin 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 the changes! Code looks good and is working as expected according to the test instructions. Happy to approve!
image

@SilkeSchomann SilkeSchomann merged commit c3ea43e into main May 1, 2024
10 checks passed
@SilkeSchomann SilkeSchomann deleted the 33629_line_integration_algorithm_for_SX branch May 1, 2024 14:30
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: Merged
Status: Done
Development

Successfully merging this pull request may close these issues.

Implement line integration as in SXD2001
3 participants