Suppose I have a workspace where the X values don’t quite match between spectra, and I want to crop based on Xmin, Xmax:
Expected behavior
CropWorkspace includes only those data points in the range, perhaps with padding if the spectra would be of different lengths. Bins where all X values are out of range will be removed. Preferably, the workspace should be no longer (in number of bins) than the longest good portion of any spectrum, with spectra being shifted with respect to each other (in terms of bin numbers) if necessary.
Padding bins should be set to E=Inf or masked or some similar value such that a weighted average, integral, etc of the spectrum ignores them.
Actual behaviour
The workspace is not cropped. The X values are copied across in their entirety including those below Xmin or above Xmax. The Y and E values outside the range are all set to zero.
Steps to reproduce the behavior
Try this (as shown it crops a Point workspace but is easily modified to generate a histogram workspace which shows the same behaviour):
ws=WorkspaceFactory.create("Workspace2D",NVectors=2,XLength=6,YLength=6)
ws.dataX(0)[:]=[1.0,2.0,3.0,4.0,5.0,6.0]
ws.dataX(1)[:]=[1.0,2.0,3.0,4.0,5.1,6.2]
ws.dataY(0)[:]=[3.0,6.0,9.0,12.0,8.0,4.0]
ws.dataY(1)[:]=[3.1,6.1,9.1,12.1,8.1,4.1]
AnalysisDataService.addOrReplace("Uncropped",ws)
CropWorkspace(InputWorkspace="Uncropped",XMin=1.5,XMax=3.5,OutputWorkspace="Cropped")
In this example the cropped workspace ought to include only the points at x=2 and x=3.
Platforms affected
Using the “Muon Nightly Build” from the Download page (3.11.20180103.1049) on Windows 7: may affect others