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

FindEPP v2

Summary

Performs Gaussian fits over each spectrum to find the Elastic Peak Position (EPP).

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

An input workspace.

OutputWorkspace

Output

TableWorkspace

Mandatory

An output workspace.

Description

This utility algorithm attempts to search for the elastic peak position (EPP) in each spectrum of the given workspace. The algorithm estimates the starting parameters and performs Gaussian fit using the Fit v1 algorithm.

Note

This algorithm uses very simple approach to search for an elastic peak: it suggests that the elastic peak has maximal intensity. This approach may fail in the case if the dataset contains Bragg peaks with higher intensities.

As a result, TableWorkspace with the following columns is produced: WorkspaceIndex, PeakCentre, PeakCentreError, Sigma, SigmaError, Height, HeightError, chiSq and FitStatus. Table rows correspond to the workspace indices.

Last column will contain the status of peak finding as follows:

  • success : If the fit succeeded, the row is populated with the corresponding values obtained by the fit.

  • fitFailed : If the fit failed (for whatever reason). A debug message will be logged with a detailed failure message from the fit algorithm. PeakCentre is filled with the maximum.

  • narrowPeak : If there are <3 bins around the maximum, that have >0.5*MAX. An information is logged, fit is not tried. PeakCentre is filled with the maximum.

  • negativeMaximum : If the maximum of the spectrum is not positive. A message will be logged in notice channel. Fit is not attempted.

Usage

Example: Find EPP in the given workspace.

# create sample workspace
ws = CreateSampleWorkspace(Function="User Defined", UserDefinedFunction="name=LinearBackground, \
            A0=0.3;name=Gaussian, PeakCentre=6000, Height=5, Sigma=75", NumBanks=2, BankPixelWidth=1,
            XMin=4005.75, XMax=7995.75, BinWidth=10.5, BankDistanceFromSample=4.0)

# search for elastic peak positions
table = FindEPP(ws)

# print some results
print("The fit status is {}".format(table.row(0)['FitStatus']))
print("The peak centre is at {} microseconds".format(round(table.row(0)['PeakCentre'], 2)))
print("The peak height is {}".format(round(table.row(0)['Height'],2)))

Output:

The fit status is success
The peak centre is at ... microseconds
The peak height is ...

Categories: AlgorithmIndex | Workflow\MLZ\TOFTOF | Utility

Source

C++ header: FindEPP.h

C++ source: FindEPP.cpp