Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | EventWorkspace | Mandatory | The input workspace. |
OutputWorkspace | Output | EventWorkspace | Mandatory | The output workspace. |
XMin | Input | number | Optional | The minimum X value (in the units of the input workspace) for which events will be retained (default: event list min) |
XMax | Input | number | Optional | The maximum X value (in the units of the input workspace) for which events will be retained. Must be greater than XMin. (default: event list max) |
This algorithm filters events outside of the given values (in whatever units the workspace possesses). This can be a one or two-sided filter depending on which of xmin & xmax are given. This algorithm pays no attention whatsoever to any binning that has been set on the input workspace (though it will be carried over to the output). If you need to affect the bin boundaries as well, or want to remove some spectra/pixels, consider using CropWorkspace v1 instead.
Example: Applying a Max in TOF
ws = CreateSampleWorkspace("Event",BankPixelWidth=1)
print("%i events before filtering" % ws.getNumberEvents())
wsOut = FilterByXValue(ws,XMax=15000)
print("%i events after filtering" % wsOut.getNumberEvents())
Output:
1900 events before filtering
1550 events after filtering
Example: Applying Max and Min in Wavelength
ws = CreateSampleWorkspace("Event",BankPixelWidth=1)
ws = ConvertUnits(ws,"Wavelength")
print("%i events before filtering" % ws.getNumberEvents())
wsOut = FilterByXValue(ws,XMin=1,XMax=3)
print("%i events after filtering" % wsOut.getNumberEvents())
Output:
1900 events before filtering
1118 events after filtering
Categories: Algorithms | Events\EventFiltering
C++ source: FilterByXValue.cpp (last modified: 2016-10-15)
C++ header: FilterByXValue.h (last modified: 2016-06-13)