\(\renewcommand\AA{\unicode{x212B}}\)

GenerateGroupingPowder v1

../_images/GenerateGroupingPowder-v1_dlg.png

GenerateGroupingPowder dialog.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory A workspace from which to generate the grouping.
AngleStep Input number Mandatory The angle step for grouping, in degrees.
GroupingFilename Input string Mandatory A grouping file that will be created. Allowed extensions: [‘.xml’]
GenerateParFile Input boolean True If true, a par file with a corresponding name to the grouping file will be generated.

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) and an optional par file (.par), by grouping detectors in intervals i*step to (i+1)*step. 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.

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,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 grouped workspace has {} histograms".format(wsg.getNumberHistograms()))

Output:

Found file powder.xml
Found file powder.par
The grouped workspace has 14 histograms

If one would use LoadDetectorsGroupingFile on powder.xml one would get a workspace that looks like

GenerateGroupingPowder.png

Categories: AlgorithmIndex | DataHandling\Grouping | Transforms\Grouping | Diffraction\Utility