SmoothMD v1

../_images/SmoothMD-v1_dlg.png

SmoothMD dialog.

Summary

Smooth an MDHistoWorkspace according to a weight function

Properties

Name Direction Type Default Description
InputWorkspace Input IMDHistoWorkspace Mandatory An input MDHistoWorkspace to smooth.
WidthVector Input int list Mandatory Width vector. Either specify the width in n-pixels for each dimension, or provide a single entry (n-pixels) for all dimensions.
Function Input string Hat Smoothing function. Defaults to Hat. Allowed values: [‘Hat’]
InputNormalizationWorkspace Input IMDHistoWorkspace   Multidimensional weighting workspace. Optional.
OutputWorkspace Output IMDHistoWorkspace Mandatory An output smoothed MDHistoWorkspace.

Description

Provides smoothing of MDHistoWorkspace in n-dimensions. The WidthVector relates to the number of pixels to include in the width for each dimension. WidthVector must contain entries that are odd numbers.

A InputNormalizationWorkspace may optionally be provided. Such workspaces must have exactly the same shape as the InputWorkspace. Where the signal values from this workspace are zero, the corresponding smoothed value will be NaN. Any un-smoothed values from the InputWorkspace corresponding to zero in the InputNormalizationWorkspace will be ignored during neighbour calculations, so effectively omitted from the smoothing altogether. Note that the NormalizationWorkspace is not changed, and needs to be smoothed as well, using the same parameters and InputNormalizationWorkspace as the original data.

PreSmooth.png

No smoothing

PreSmooth.png

Smooth with WidthVector=5

Usage

Example - SmoothMD

ws = CreateMDWorkspace(Dimensions=2, Extents=[-10,10,-10,10], Names='A,B', Units='U,U')
FakeMDEventData(InputWorkspace=ws, PeakParams='100000,-5,0,1')
FakeMDEventData(InputWorkspace=ws, PeakParams='100000,5,0,1')
histogram = BinMD(InputWorkspace=ws, AlignedDim0='A,-10,10,50', AlignedDim1='B,-10,10,50', OutputExtents='-10,10,-10,10,-10,10', OutputBins='10,10,10')
# plotSlice(histogram)
smoothed = SmoothMD(InputWorkspace=histogram, WidthVector=5, Function='Hat')
# plotSlice(smoothed)

print 'Smoothed has %i points' % smoothed.getNPoints()

Output:

Smoothed has 2500 points

Categories: Algorithms | MDAlgorithms\Transforms

Source

C++ source: SmoothMD.cpp

C++ header: SmoothMD.h