SmoothData v1

../_images/SmoothData-v1_dlg.png

SmoothData dialog.

Summary

Smooths out statistical fluctuations in a workspace’s data.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory Name of the input workspace
OutputWorkspace Output MatrixWorkspace Mandatory The name of the workspace to be created as the output of the algorithm
NPoints Input int list 3 The number of points to average over (minimum 3). If an even number is given, it will be incremented by 1 to make it odd (default value 3)
GroupingWorkspace Input GroupingWorkspace   Optional: GroupingWorkspace to use for vector of NPoints.

Description

Smooths out statistical jitter in a workspace’s data by making each point the mean average of itself and one or more points lying symmetrically either side of it. The statistical error on each point will be reduced by sqrt(npts) because more data is now contributing to it. For points at the end of each spectrum, a reduced number of smoothing points will be used. For example, if NPoints is 5 the first value in the spectrum will be smoothed by making it the average of the first 3 values, the next will use the first 4 and then the third and onwards will use the full 5 points in the averaging.

Usage

Example 1: use same NPoints for all spectra

# Create a workspace
ws = CreateSampleWorkspace()

# Smooth the spectra in ws NPoints = 3
smooth = SmoothData( ws, 3)

Example 2: use different NPoints for groups of spectra

# Create a workspace
ws = CreateSampleWorkspace()
# Greate a grouping workspace to put detectors from banks
# bank1 and bank2 into two separate groups
gr = CreateGroupingWorkspace(ws,GroupNames='bank1,bank2')

# Smooth the spectra in ws: first group with NPoints = 3 and
# second group with NPoints = 5
smooth = SmoothData( ws, [3,5], GroupingWorkspace='gr')

Categories: Algorithms | Transforms\Smoothing

Source

C++ source: SmoothData.cpp

C++ header: SmoothData.h