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

MatchPeaks v1

Summary

Circular shifts (numpy.roll) the data of the input workspace to align peaks without modifying the x-axis.

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

Input workspace

InputWorkspace2

Input

MatrixWorkspace

Input workspace to align peaks with

InputWorkspace3

Input

MatrixWorkspace

Input workspace to align peaks with

MaskBins

Input

boolean

False

Whether to mask shifted bins

MatchInput2ToCenter

Input

boolean

False

Match peaks such that InputWorkspace2 would be centered

OutputWorkspace

Output

MatrixWorkspace

Mandatory

Shifted output workspace

BinRangeTable

Output

TableWorkspace

Table workspace that contains two values defining a range. Bins outside this range are overflown out of range due to circular shiftand can be masked.

Description

This algorithm circular shifts (numpy.roll operation) the Y- and E-values of each spectrum of an input workspace while keeping its X-values. Peak positions of the input workspace can be aligned with the centre of the X-axis as the default option. Optionally, a second input workspace can be given. In this case, the peaks in the first workspace will be aligned to the peaks in the second workspace. If MatchInput2ToCenter option is enabled, first workspace will be rolled according to the difference between the second workspace’s peaks from the center. If the third workspace is given, the first workspace will be shifted according to the difference of peak positions between the second and the third workspaces. A BinRangeTable output contains two values, ‘MinBin’ and ‘MaxBin’. Bins smaller than the ‘MinBin’ value and larger than the ‘MaxBin’ value represent bins that where overflown the x-axis range due to the circular shift. Enabling MaskBins will mask out these bins automatically.

Restrictions

The input workspaces should have one peak (see FindEPP), hence NaN and Inf values will be zeroed, so peak finding can succeed. The peak position is expected to be around the x-axis center, at most quarter of the number of bins away from the center, otherwise no shift will be performed. Furthermore, input workspaces should have the same number of bins and spectra as well as identical x-axes.

Usage

# Create a workspace containing some data.
ws = CreateSampleWorkspace(Function='User Defined',
                           WorkspaceType='Histogram',
                           UserDefinedFunction="name=Gaussian, PeakCentre=3.2, Height=10, Sigma=0.3",
                           NumBanks=1, BankPixelWidth=1,
                           XUnit='DeltaE', XMin=0, XMax=7, BinWidth=0.099)

output_ws = MatchPeaks(InputWorkspace=ws)

print('Peak height at center: {:.11f}'.format(output_ws.readY(0)[ws.blocksize() // 2]))

Output

Peak height at center: ...

Categories: AlgorithmIndex | Transforms

Source

Python: MatchPeaks.py