Ticket #8288 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

LineViewer Crash

Reported by: Owen Arnold Owned by: Owen Arnold
Priority: blocker Milestone: Release 3.0
Component: GUI Keywords:
Cc: Blocked By:
Blocking: Tester: Martyn Gigg

Description

Run the following, then open the line viewer on the output binned MDWorkspace and start to draw a line. -> Crash

import os.path

def  runAlgorithm():
        workspace_name = "POLREF00004699"
        workspace_nexus_file = workspace_name + ".nxs"
        
        PIX=1.1E-3 #m
        SC=75
        avgDB=29
        Load(Filename=workspace_nexus_file,OutputWorkspace=workspace_name)
        X=mtd[workspace_name]
        X = ConvertUnits(InputWorkspace=X,Target="Wavelength",AlignBins="1")
        # Reference intensity to normalise by
        CropWorkspace(InputWorkspace=X,OutputWorkspace='Io',XMin=0.8,XMax=14.5,StartWorkspaceIndex=2,EndWorkspaceIndex=2)
        # Crop out transmission and noisy data 
        CropWorkspace(InputWorkspace=X,OutputWorkspace='D',XMin=0.8,XMax=14.5,StartWorkspaceIndex=3)
        Io=mtd['Io']
        D=mtd['D']
    
        # Peform the normaisation step
        Divide(LHSWorkspace=D,RHSWorkspace=Io,OutputWorkspace='I',
               AllowDifferentNumberSpectra='1',ClearRHSWorkspace='1')
        I=mtd['I'][0]
        
        # Automatically determine the SC and averageDB 
        FindReflectometryLines(InputWorkspace=I, StartWavelength=10, OutputWorkspace='spectrum_numbers')
        spectrum_table = mtd['spectrum_numbers']
        
        # Move the detector so that the detector channel matching the reflected beam is at 0,0
        MoveInstrumentComponent(Workspace=I,ComponentName="lineardetector",X=0,Y=0,Z=-PIX*( (SC-avgDB)/2.0 +avgDB) )
        
        # Should now have signed theta vs Lambda
        ConvertSpectrumAxis(InputWorkspace=I,OutputWorkspace='SignedTheta_vs_Wavelength',Target='signed_theta')
        
        # Check that signed two theta is being caluclated correctly (not normalised)
        ws1 = mtd['SignedTheta_vs_Wavelength']
        upperHistogram = ws1.getNumberHistograms()-1
        # MD transformations
        ConvertToReflectometryQ(InputWorkspace='SignedTheta_vs_Wavelength',OutputWorkspace='QxQyMD',OutputDimensions='Q (lab frame)', Extents='-0.0005,0.0005,0,0.12')

        BinMD(InputWorkspace='QxQyMD',AxisAligned='0',BasisVector0='Qx,(Ang^-1),1,0',BasisVector1='Qz,(Ang^-1),0,1',OutputExtents='-0.0005,0.0005,0,0.12',OutputBins='100,100',Parallel='1',OutputWorkspace='QxQy_rebinned')
       
runAlgorithm()

Change History

comment:1 Changed 7 years ago by Owen Arnold

  • Status changed from new to inprogress

comment:2 Changed 7 years ago by Owen Arnold

This is a result of dereferencing a pointer at an invalid address. This is the result of the find returning nothing. Need to check for this condition before continuing.

comment:3 Changed 7 years ago by Owen Arnold

refs #8288. Fix dereference of invalid pointer

Handle the case that no minimum or maximum is found. This prevents the crash.

Changeset: 7ddfe8079d410aa04368fccdef1f7a828f840f2b

comment:4 Changed 7 years ago by Owen Arnold

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:5 Changed 7 years ago by Owen Arnold

Tester:

  • Run the script above.
  • Open the output workspace in the SliceViewer
  • Switch to the LineViewer mode. If it doesn't crash at this point, then it's fixed.

comment:6 Changed 7 years ago by Martyn Gigg

  • Status changed from verify to verifying
  • Tester set to Martyn Gigg

comment:7 Changed 7 years ago by Martyn Gigg

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/8288_lineviewer_crash'

Full changeset: b5be1ab986e766469ac51d8f4dbe28a383dfa3b3

comment:8 Changed 7 years ago by Martyn Gigg

Confirmed that crash has been fixed.

#8299 has been opened for maintenance to cut down on getYMin code duplication.

comment:9 Changed 7 years ago by Peter Peterson

  • Milestone changed from Backlog to Release 3.0

comment:10 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9133

Note: See TracTickets for help on using tickets.