FilterByXValue v1

../_images/FilterByXValue-v1_dlg.png

FilterByXValue dialog.

Summary

Filters events according to a min and/or max value of X.

Properties

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)

Description

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.

Usage

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
 11... events after filtering

Categories: AlgorithmIndex | Events\EventFiltering

Source

C++ source: FilterByXValue.cpp (last modified: 2019-07-17)

C++ header: FilterByXValue.h (last modified: 2018-10-05)