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

GeneralisedSecondDifference v1

../_images/GeneralisedSecondDifference-v1_dlg.png

GeneralisedSecondDifference dialog.

Summary

Computes the generalised second difference of a spectrum or several spectra.

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

M

Input

number

0

The number of points for averaging, i.e. summing will be done in the range [y(i-m),y(i+m)]

Z

Input

number

0

The number of iteration steps in the averaging procedure

WorkspaceIndexMin

Input

number

0

Lower bound of the spectrum range (default 0)

WorkspaceIndexMax

Input

number

0

Upper bound of the spectrum range (default workspace max)

Description

Compute the generalised second difference of a spectrum or several spectra based on the method described by M.A. Mariscotti., Nuclear Instruments and Methods 50, 309 (1967). Given a spectrum with value yi (0<=i<n), the generalised second difference corresponds to the second difference curve, smoothed by averaging each point in the interval [-m,+m], and applying this procedure z times.

Usage

Example - Use on a single peak

# Create Workspace with peak around x=15.0
ws = CreateSampleWorkspace(BankPixelWidth=1, Xmax=30, BinWidth=1)

# Apply algorithm.
wsD = GeneralisedSecondDifference(ws,M=2,Z=2)

# Show values around the peak
print("{:.2f}, {:.2f}, {:.2f}, {:.2f}, {:.2f}".format(wsD.readY(0)[8], wsD.readY(0)[9], wsD.readY(0)[10], wsD.readY(0)[11], wsD.readY(0)[12]))
print("Peak at {}".format(wsD.readX(0)[10]))

Output:

-0.34, -7.21, -20.00, -7.21, -0.34
Peak at 15.0

Categories: AlgorithmIndex | Arithmetic

Source

C++ header: GeneralisedSecondDifference.h

C++ source: GeneralisedSecondDifference.cpp