\(\renewcommand\AA{\unicode{x212B}}\)
SpatialGrouping v1¶
Summary¶
This algorithm creates an XML grouping file, which can be used in GroupDetectors or ReadGroupsFromFile, which groups the detectors of an instrument based on the distance between the detectors. It does this by querying the getNeighbours method on the Detector object.
See Also¶
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
Input |
Mandatory |
Name of the input workspace, which is used only as a means of retrieving the instrument geometry. |
|
Filename |
Input |
string |
Mandatory |
Name (and location) in which to save the file. Having a suffix of ‘’.xml’’ is recommended. Allowed extensions: [‘.xml’] |
SearchDistance |
Input |
number |
2.5 |
The number of pixel widths in which to search for neighbours of the detector. |
GridSize |
Input |
number |
3 |
The size of the grid that should be grouped. i.e, 3 (the default) will select a group of nine detectors centred in a 3 by 3 grid. |
Description¶
This algorithm creates an XML Grouping file of the form:
<?xml version="1.0" encoding="UTF-8" ?>
<detector-grouping>
<group name="fwd"><detids val="1,2,17,32"/></group>
<group name="bwd"><detids val="33,36,38,60,64"/> </group>
</detector-grouping>
nased on information retrieved from the Nearest Neighbours class in Mantid Geometry.
Usage¶
Caution
The following is a contrived example to show the functionaity of the algorithm, However, since the sample workspace does not have a valid instrument, the written grouping file is invalid and cannot be used.
# Create a workspace with a single bank and 9x9 pixels.
ws = CreateSampleWorkspace(NumBanks=1, BankPixelWidth=9)
import os
group_file = os.path.join(config["default.savedirectory"], "mygroup.xml")
# Want to get nine groups of 3x3
SpatialGrouping(ws, group_file, SearchDistance=10)
print("File created: {}".format(os.path.exists(group_file)))
Output:
File created: True
Categories: AlgorithmIndex | Transforms\Grouping
Source¶
C++ header: SpatialGrouping.h
C++ source: SpatialGrouping.cpp