\(\renewcommand\AA{\unicode{x212B}}\)
FindSXPeaksConvolve v1¶
Summary¶
Find singlecrystal Bragg peaks in MatrixWorkspaces for instruments comprising rectangular detctors (such as SXD at ISIS).
See Also¶
Properties¶
Name 
Direction 
Type 
Default 
Description 

InputWorkspace 
Input 
Mandatory 
A MatrixWorkspace to integrate (xaxis 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 singlecrystal Bragg peaks in a MatrixWorkspace with detector banks of type RectangularDetector (e.g. SXD, TOPAZ).
There are two peak finding strategies set by PeakFindingStrategy
:
PeakFindingStrategy="IOverSigma"
 by integrating the data by convolution with a shoebox kernel and looking for regions with statistically significant I/sigma (larger thanThresholdIoverSigma
). Note a valid peak would be expected to have intensity/sigma > 3 and stronger peaks will have a larger intensity/sigma.PeakFindingStrategy="VarianceOverMean"
 by looking for regions with ratio of variance/mean larger thanThresholdVarianceOverMean
 note for a poisson distributed counts with a constant countrate 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:
Provide
NBins
 number of TOF bins in the kernelSetting
GetNBinsFromBackToBackParams=True
and providingNFWHM
 in which caseNBins
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, backtoback 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