\(\renewcommand\AA{\unicode{x212B}}\)
GenerateGroupingPowder v2¶
Summary¶
Generate grouping by angles.
See Also¶
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
Input |
Mandatory |
A workspace from which to generate the grouping. |
|
GroupingWorkspace |
Output |
GroupingWorkspace |
The grouping workspace created |
|
AngleStep |
Input |
number |
Mandatory |
The polar angle step for grouping, in degrees. |
AzimuthalStep |
Input |
number |
360 |
The azimuthal angle step for grouping, in degrees. |
AzimuthalStart |
Input |
number |
0 |
The azimuthal angle start location, in degrees. |
NumberByAngle |
Input |
boolean |
True |
If true, divide sphere into groups labeled by angular sector.Empty parts of the instrument will effectively have group numbers that do not exist in the output.If false, labels will be assigned in order of highest angle. |
GroupingFilename |
Input |
string |
A grouping file that will be created. Allowed values: [‘xml’, ‘nxs’, ‘nx5’] |
|
GenerateParFile |
Input |
boolean |
True |
If true, a par file with a corresponding name to the grouping file will be generated. Ignored if grouping file is not specified. |
Description¶
For powder samples, with no texture, the scattering consists only of rings. This algorithm reads a workspace and an angle step, then generates a grouping file (.xml or .nxs) and an optional par file (.par), by grouping detectors in one of several methods:
Divide ring into circular sectors labeled i*step to (i+1)*step (see note below). The original and default behavior.
Divide sphere into spherical sectors, similarly to above but including azimuthal angles (see note below). Use NumberByAngle set to true and specify AzimuthalStep and AzimuthalStart.
Divide ring into circular sectors labeled in order, from large 2theta to low 2theta. Use NumberByAngle set to false and specify only AngleStep (or set AzimuthalStep to its default at 360).
Divide ring into circular sectors labeled in order, splitting left/right sides from large 2theta to low 2theta. One side is labeled first, then the other. Use NumberByAngle set to false, specify AngleStep, and specify AzimuthalStep as anything other than 360.
The par file is required for saving in the NXSPE format, since Mantid does not correctly calculate the angles for detector groups. It will contain average distances to the detector groups, and average scattering angles. The x and y extents in the par file are radians(step)*distance and 0.01, and are not supposed to be accurate. A par file can only be saved using the original default labeling scheme.
The grouping file (.xml) can be used with GroupDetectors to perform the grouping.
Usage¶
Note
To run these usage examples please first download the usage data, and add these to your path. In Mantid this is done using Manage User Directories.
# create some grouping file
import mantid
outputFilename=mantid.config.getString("defaultsave.directory")+"powder.xml"
#load some file
ws=Load("CNCS_7860")
#generate the files
GenerateGroupingPowder(ws,10, GroupingFilename=outputFilename)
#check that it works
import os.path
if(os.path.isfile(outputFilename)):
print("Found file powder.xml")
if(os.path.isfile(mantid.config.getString("defaultsave.directory")+"powder.par")):
print("Found file powder.par")
wsg=GroupDetectors(ws,outputFilename)
print("The grouping workspace has {} histograms".format(wsg.getNumberHistograms()))
Output:
Found file powder.xml
Found file powder.par
The grouping workspace has 14 histograms
Similarly, one could instead specify the grouping workspace:
#load some file
ws=Load("CNCS_7860")
gws_name= "a_nice_name_for_grouping_workspace"
#generate the files
GenerateGroupingPowder(ws,10, GroupingWorkspace=gws_name)
#check that it works
gws = mtd[gws_name]
print("The grouping workspace has {} histograms".format(gws.getNumberHistograms()))
Output:
The grouping workspace has 51200 histograms
If one would use LoadDetectorsGroupingFile on powder.xml one would get a workspace that looks like
![GenerateGroupingPowder.png](../_images/GenerateGroupingPowder.png)
Categories: AlgorithmIndex | DataHandling\Grouping | Transforms\Grouping | Diffraction\Utility
Source¶
C++ header: GenerateGroupingPowder2.h
C++ source: GenerateGroupingPowder2.cpp