mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
207 stars 121 forks source link

Fix bug in plotting Qspace integration in BaseSX class #37509

Closed RichardWaiteSTFC closed 2 weeks ago

RichardWaiteSTFC commented 3 weeks ago

Fix bug in plotting Qspace integration in BaseSX class when no signal (i.e. data all 0s) Updated a test to stop regression and noticed that original test was failing on main locally - I think there was a typo in CmakeLists that meant unit tests for BaseSX weren't running - hopefully this fixes it!

Fixes #37506

Report to: Nick Funnell

To test:

(1) Run this without error

from mantid.simpleapi import *
from Diffraction.single_crystal.base_sx import BaseSX

# create  peeak table
ws = LoadEmptyInstrument(Filename="SXD_Definition.xml", OutputWorkspace="empty")
axis = ws.getAxis(0)
axis.setUnit("TOF")
peaks = CreatePeaksWorkspace(InstrumentWOrkspace=ws, NumberOfPeaks=0)
AddPeak(PeaksWorkspace=peaks, RunWorkspace=ws, TOF=1000, DetectorID=35004)

# make empty MD workspace
md = CreateMDWorkspace(Dimensions=3, Extents=[0,1,0,1,0,1], Names="Qx,Qy,Qz", 
                       Frames='QLab,QLab,QLab',Units='Ang^-1,Ang^-1,Ang^-1')
# integrate
peaks_int = IntegratePeaksMD(InputWorkspace=md, PeakRadius=0.1, BackgroundInnerRadius=0.12, 
                            BackgroundOuterRadius=0.13, PeaksWorkspace=peaks)
# plot
BaseSX.plot_integrated_peaks_MD(md, peaks_int, r"\\olympic\Babylon5\Public\RWaite\test_plot_MD.pdf", nbins_max=21, extent=1.5, log_norm=True)

This does not require release notes because was added 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

Functional Tests

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.