FindCenterOfMassPosition v1

../_images/FindCenterOfMassPosition-v1_dlg.png

FindCenterOfMassPosition dialog.

Summary

Finds the beam center in a 2D SANS data set.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory  
Output Input string   If not empty, a table workspace of that name will contain the center of mass position.
NPixelX Input number 192 Number of detector pixels in the X direction.
NPixelY Input number 192 Number of detector pixels in the Y direction.
DirectBeam Input boolean True If true, a direct beam calculation will be performed. Otherwise, the center of mass of the scattering data will be computed by excluding the beam area.
BeamRadius Input number 20 Radius of the beam area, in pixels, used the exclude the beam when calculating the center of mass of the scattering pattern.

Description

Finds the beam center using the direct beam method. This algorithm is used by the EQSANS and HFIR SANS reduction.

The position of the beam center p is given by

\vec{p}=\frac{\sum_iI_i\vec{d}_i}{\sum_iI_i}

where i runs over all pixels within the largest square detector area centered on the initial guess for the beam center position. The initial guess is the center of the detector. I_i is the detector count for pixel i, and \vec{d}_i is the pixel coordinates. The calculation above is repeated iteratively by replacing the initial guess with the position found with the previous iteration. The process stops when the difference between the positions found with two consecutive iterations is smaller than 0.25 pixel.

If DirectBeam is set to False, the beam center will be found using the scattered beam method. The process is identical to the direct beam method, with the only difference being that the pixels within a distance R (the beam radius) of the beam center guess are excluded from the calculation. The direct beam is thus excluded and only the scattered data is used.

If the Output property is set, the beam centre will be placed in a table workspace. Otherwise, the result is placed in an ArrayProperty named CenterOfMass.

Usage

Note

To run these usage examples please first download the usage data, and add these to your path. In MantidPlot this is done using Manage User Directories.

Example - Find the beam center for a BioSANS data file:

# Load your data file
workspace = LoadSpice2D('BioSANS_empty_cell.xml')

# Compute the center position, which will be put in a table workspace
FindCenterOfMassPosition('workspace', Output='center', Version=1)

Categories: AlgorithmIndex | SANS

Source

C++ source: FindCenterOfMassPosition.cpp (last modified: 2019-07-17)

C++ header: FindCenterOfMassPosition.h (last modified: 2018-10-05)