\(\renewcommand\AA{\unicode{x212B}}\)

NormaliseToUnity v1

../_images/NormaliseToUnity-v1_dlg.png

NormaliseToUnity dialog.

Summary

NormaliseToUnity takes a 2D workspace or an EventWorkspace as input and normalises it to 1. Optionally, the range summed can be restricted in either dimension.

See Also

Divide

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

The name of the input workspace.

OutputWorkspace

Output

MatrixWorkspace

Mandatory

The name with which to store the output workspace in the [[Analysis Data Service]]

RangeLower

Input

number

Optional

The X (frame) value to integrate from

RangeUpper

Input

number

Optional

The X (frame) value to integrate to

StartWorkspaceIndex

Input

number

0

The lowest workspace index of the specta that will be integrated

EndWorkspaceIndex

Input

number

Optional

The highest workspace index of the spectra that will be integrated

IncludePartialBins

Input

boolean

False

If true then partial bins from the beginning and end of the input range are also included in the integration.

IncludeMonitors

Input

boolean

True

Whether to include monitor spectra in the sum (default: yes)

Description

NormaliseToUnity uses Integration v1 to sum up all the X bins, then sums up the resulting spectra using SumSpectra v1. Each bin of the input workspace is then divided by the total sum, regardless of whether a bin was included in the sum or not. It is thus possible to normalize a workspace so that a range of X bins and spectra sums to 1. In that case the sum of the whole workspace will likely not be equal to 1.

Usage

Example - Normalise for 4 spectra each with 5 values

# Create a workspace with 4 spectra each with 5 values
ws = CreateSampleWorkspace("Histogram",  NumBanks=1, BankPixelWidth=2, BinWidth=10, Xmax=50)

# Run algorithm
wsNorm = NormaliseToUnity (ws)

print("Normalised Workspace")
for i in range(4):
   print("[ {:.4f}, {:.4f}, {:.4f}, {:.4f}, {:.4f} ]".format(
         wsNorm.readY(i)[0], wsNorm.readY(i)[1], wsNorm.readY(i)[2],
         wsNorm.readY(i)[3], wsNorm.readY(i)[4]))

Output:

Normalised Workspace
[ 0.2239, 0.0065, 0.0065, 0.0065, 0.0065 ]
[ 0.2239, 0.0065, 0.0065, 0.0065, 0.0065 ]
[ 0.2239, 0.0065, 0.0065, 0.0065, 0.0065 ]
[ 0.2239, 0.0065, 0.0065, 0.0065, 0.0065 ]

Categories: AlgorithmIndex | CorrectionFunctions\NormalisationCorrections

Source

C++ header: NormaliseToUnity.h

C++ source: NormaliseToUnity.cpp