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

FindSXPeaksConvolve v1

Summary

Find single-crystal Bragg peaks in MatrixWorkspaces for instruments comprising rectangular detctors (such as SXD at ISIS).

See Also

FindSXPeaks

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

A MatrixWorkspace to integrate (x-axis must be TOF).

PeaksWorkspace

Output

IPeaksWorkspace

Mandatory

A PeaksWorkspace containing the peaks to integrate.

ThresholdIoverSigma

Input

number

5

Threshold value for I/sigma used to identify statistically significant peaks.

NRows

Input

number

5

Number of row components in the detector to use in the convolution kernel. For WISH row components correspond to pixels along a single tube.

NCols

Input

number

5

Number of column components in the detector to use in the convolution kernel. For WISH column components correspond to tubes.

NBins

Input

number

10

Number of TOF bins to use in the convolution kernel.

GetNBinsFromBackToBackParams

Input

boolean

False

If true the number of TOF bins used in the convolution kernel will be calculated from the FWHM of the BackToBackExponential peak using parameters defined in the instrument parameters.xml file.

NFWHM

Input

number

4

If GetNBinsFromBackToBackParams=True then the number of TOF bins will be NFWHM x FWHM of the BackToBackExponential peak at the center of each detector panel at the middle of the spectrum.

MinFracSize

Input

number

0.125

Minimum peak size as a fraction of the kernel size.

PeakFindingStrategy

Input

string

IOverSigma

PeakFindingStrategy=IOverSigma will find peaks by integrating data using a shoebox kernel and looking for peaks with I/sigma > ThresholdIoverSigma. PeakFindingStrategy=VarianceOverMean will look for peaks with local variance/mean > ThresholdVarianceOverMean. Allowed values: [‘VarianceOverMean’, ‘IOverSigma’]

ThresholdVarianceOverMean

Input

number

3

Threshold value for variance/mean used to identify peaks.

Description

This is an algorithm to find single-crystal Bragg peaks in a MatrixWorkspace with detector banks of type RectangularDetector (e.g. SXD, TOPAZ).

There are two peak finding strategies set by PeakFindingStrategy:

  1. PeakFindingStrategy="IOverSigma" - by integrating the data by convolution with a shoebox kernel and looking for regions with statistically significant I/sigma (larger than ThresholdIoverSigma). Note a valid peak would be expected to have intensity/sigma > 3 and stronger peaks will have a larger intensity/sigma.

  2. PeakFindingStrategy="VarianceOverMean" - by looking for regions with ratio of variance/mean larger than ThresholdVarianceOverMean - note for a poisson distributed counts with a constant count-rate the ratio is expected to be 1. This peak finding criterion taken from DIALS [1].

The size of the kernel is defined in the input to the algorithm and should match the approximate extent of a typical peak. The size on the detector is governed by NRows and NCols which are in units of pixels. The size of the kernel along the TOF dimension can be specified in one of two ways:

  1. Provide NBins - number of TOF bins in the kernel

  2. Setting GetNBinsFromBackToBackParams=True and providing NFWHM - in which case NBins will be NFWHM x FWHM of a BackToBackExponential peak at the center of each detector panel/bank at the middle of the spectrum.

Note to use method 2, back-to-back exponential coefficients must be defined in the Parameters.xml file for the instrument.

The shoebox integration (for PeakFindingStrategy="IOverSigma") requires a background shell with negative weights, such that the total kernel size is increased by a factor 1.25 along each dimension (such that there are approximately the same number of elements in the kernel and the background shell). The integral of the kernel and background shell together is zero.

The integrated intensity is evaluated by convolution of the signal array with the kernel and the square of the error on the integrated intensity is determined by convolution of the squared error array with the squared value of the kernel.

Usage

Example - FindSXPeaksConvolve

from mantid.simpleapi import *

ws = Load(Filename="SXD23767.raw", OutputWorkspace="SXD23767")
peaks = FindSXPeaksConvolve(InputWorkspace=ws, PeaksWorkspace='peaks_out', GetNBinsFromBackToBackParams=True, ThresholdIoverSigma=5.0)

print(f"Found {peaks.getNumberPeaks()} peaks")

Output:

Found 261 peaks

References

Categories: AlgorithmIndex | Diffraction\Reduction

Source

Python: FindSXPeaksConvolve.py