\(\renewcommand\AA{\unicode{x212B}}\)
IntegratePeaksShoeboxTOF v1¶
Summary¶
Integrate singlecrystal Bragg peaks in MatrixWorkspaces with xunit of TOF using a shoebox.
See Also¶
Properties¶
Name 
Direction 
Type 
Default 
Description 

InputWorkspace 
Input 
Mandatory 
A MatrixWorkspace to integrate (xaxis must be TOF). 

PeaksWorkspace 
Input 
IPeaksWorkspace 
Mandatory 
A PeaksWorkspace containing the peaks to integrate. 
OutputWorkspace 
Output 
IPeaksWorkspace 
Mandatory 
The output PeaksWorkspace will be a copy of the input PeaksWorkspace with the integrated intensities. 
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 
11 
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 at the peak detector and TOF. 
NShoeboxInWindow 
Input 
number 
3 
Extent of window in TOF and detector row and column as a multiple of the shoebox length along each dimension. 
OptimiseShoebox 
Input 
boolean 
True 
If OptimiseShoebox=True then shoebox size will be optimised to maximise Intensity/Sigma of the peak. 
WeakPeakStrategy 
Input 
string 
Fix 
If WeakPeakStrategy=Fix then fix the shoebox dimensions. If WeakPeakStrategy=NearestStrongPeak thenthe shoebox dimensions will be taken from the nearest strong peak (determined by StrongPeakThreshold).The TOF extent of the shoebox will be scaled by the FWHM of the BackToBackExponential peaks ifGetNBinsFromBackToBackParams=True. Allowed values: [‘Fix’, ‘NearestStrongPeak’] 
WeakPeakThreshold 
Input 
number 
0 
Intenisty/Sigma threshold below which a peak is considered weak. 
IntegrateIfOnEdge 
Input 
boolean 
False 
If IntegrateIfOnEdge=False then peaks with shoebox that includes detector IDs at the edge of the bank will not be integrated. 
NRowsEdge 
Input 
number 
1 
Shoeboxes containing detectors NRowsEdge from the detector edge are defined as on the edge. 
NColsEdge 
Input 
number 
1 
Shoeboxes containing detectors NColsEdge from the detector edge are defined as on the edge. 
LorentzCorrection 
Input 
boolean 
True 
Correct the integrated intensity by multiplying by the Lorentz factor sin(theta)^2 / lambda^4  do not do this if the data have already been corrected. 
OutputFile 
Input 
string 
Optional file path in which to write diagnostic plots (note this will slow the execution of algorithm). Allowed extensions: [‘.pdf’] 
Background¶
Fixed mask/shoebox integration methods have previously been developed for Timeofflight (TOF) neutron diffraction [1]. For monochromatic neutron diffractometers, a dynamic shoebox method that optimised the shoebox dimensions on a 2D detector by maximising the Intensity/sigma ratio of each peak has been shown to improve the Rfactors obtained [2].
This algorithm generalises the 2D dynamic shoebox integration of [2] to 3D peaks in TOF Laue, and several improvements have been made to suit TOF Laue data
Avoids nearby peaks that are closer to another peak position when optimising shoebox position
2. The shoebox dimensions of weak peaks can be obtained from nearby stronger peaks with scaling of the TOF dimension to account for the instrument resolution.
Description¶
This is an algorithm to integrate singlecrystal Bragg peaks in a MatrixWorkspace.
An initial integration is performed by summing up the counts in a fixed shoebox of user specified size NRows
and
NCols
on the detector and NBins
along the TOF direction. The dimensions of the shoebox are then optionally
optimised to maximise I/sigma.
The default Nbins
can be specified in one of two ways:
Provide
NBins
directly  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 integration requires a background shell with negative weights, there are approximately the same number of bins in the background shell as in the peak region.
The algorithm proceeds as follows:
Take a window of the data,
NShoeboxInWindow
the size of the initial user specified shoebox (NRows
xNCols
xNBins
)Convolve the shoebox kernel with the data in the window to find the position with largest Intensity/sigma (closest to the predicted peak position than to any other peaks in the table).
Integrate using the shoebox at the optimal position
If the peak is strong (Intensity/sigma >
WeakPeakThreshold
) andOptimiseShoebox=True
then optimise the shoebox dimensions to maximise Intensity/sigmaIf the peak is weak, it can be integrated using the initial shoebox (
WeakPeakStrategy="Fix"
) or using the shoebox dimensions from the nearest strong peak (WeakPeakStrategy="NearestStrongPeak"
)
When looking for the nearest strong peaks for WeakPeakStrategy="NearestStrongPeak"
, the algorithm first checks for
peaks in detector IDs in the data window around the peak, before looking at the whole peak table.
The closest peak is defined as the one with the smallest angle between the QLab vectors of the two peaks. The TOF extent
of the shoebox is scaled by the ratio of the FWHM of the weak and strong peak if GetNBinsFromBackToBackParams=True
,
otherwise it is scaled by the ratio of TOF (i.e. assumes dTOF/TOF resolution is the same for both peaks).
Optionally if OutputFile
is provided a pdf can be output that shows the shoebox kernel and the data integrated along
each dimension like so
Usage¶
Example  IntegratePeaksShoeboxTOF
from mantid.simpleapi import *
Load(Filename="SXD23767.raw", OutputWorkspace="SXD23767")
CreatePeaksWorkspace(InstrumentWorkspace="SXD23767", NumberOfPeaks=0, OutputWorkspace="peaks")
AddPeak(PeaksWorkspace="peaks", RunWorkspace="SXD23767", TOF=8303.3735339704781, DetectorID=7646)
peaks_out = IntegratePeaksShoeboxTOF(InputWorkspace="SXD23767", PeaksWorkspace="peaks",
GetNBinsFromBackToBackParams=True, WeakPeakThreshold=0.0, LorentzCorrection=False)
print(f"I/sigma = {peaks_out.getPeak(0).getIntensityOverSigma():.2f}")
Output:
I/sigma = 100.80
References¶
Categories: AlgorithmIndex  Diffraction\Reduction
Source¶
Python: IntegratePeaksShoeboxTOF.py