mantidproject / mantid

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

Replacing workspace while it's open in Slice Viewer causes crash #36901

Open jclarkeSTFC opened 8 months ago

jclarkeSTFC commented 8 months ago

Found during smoke testing for the 6.9 release, but also present in 6.8.

To Reproduce

from mantid.simpleapi import *

md_4D = CreateMDWorkspace(Dimensions=4, Extents=[0,2,-1,1,-1.5,1.5,-0.25,0.25], Names="H,K,L,E", Frames='HKL,HKL,HKL,General Frame',Units='r.l.u.,r.l.u.,r.l.u.,meV')
FakeMDEventData(InputWorkspace=md_4D, UniformParams='5e5') # 4D data
FakeMDEventData(InputWorkspace=md_4D, UniformParams='1e5,0.5,1.5,-0.5,0.5,-0.75,0.75,-0.1,0.1') # 4D data

# Add a non-orthogonal UB
expt_info = CreateSampleWorkspace()
md_4D.addExperimentInfo(expt_info)
SetUB(Workspace='md_4D', c=2, gamma=120)

# make a 3D MDEvent workspace by integrating over all E
md_3D = SliceMD(InputWorkspace='md_4D', AlignedDim0='H,0,2,100', AlignedDim1='K,-1,1,100', AlignedDim2='L,-1.5,1.5,100')

# Create a peaks workspace and fake data in 3D MD
CreatePeaksWorkspace(InstrumentWorkspace='md_3D', NumberOfPeaks=0, OutputWorkspace='peaks')
CopySample(InputWorkspace='md_3D', OutputWorkspace='peaks', CopyName=False, CopyMaterial=False, CopyEnvironment=False, CopyShape=False)
AddPeakHKL(Workspace='peaks', HKL='1,0,1')
AddPeakHKL(Workspace='peaks', HKL='1,0,0')

Platform/Version (please complete the following information):

jhaigh0 commented 3 months ago

If you, run the script, open the slice viewer, overlay peaks, the run the script again, it resets to the default view (doesn't close) and is in a state where there's an exception every time you mouse over the plot.