GroupDetectors

From MantidProject

Jump to: navigation, search

Contents

Summary

Sums spectra bin-by-bin, equilivent to grouping the data from a set of detectors. Individual groups can be specified by passing the algorithm a list of spectrum numbers, detector IDs or workspace indices. Many spectra groups can be created in one execution via an input file.

Properties

Order Name Direction Type Default Description
1 InputWorkspace Input Workspace2D Mandatory The name of the input workspace on which to perform the algorithm
2 OutputWorkspace Output Workspace2D Mandatory The name to use for the output workspace. Can be the same as the input one
3 MapFile Input string Optional * The name of a file that contains lists of the spectra numbers of the spectra to group (file format below)
4 SpectraList Input integer ArrayProperty Optional * A list of spectra to combine
5 DetectorList Input integer ArrayProperty Optional * A list of detector ID's to combine
6 WorkspaceIndexList Input integer ArrayProperty Optional * A list of the workspace indices to combine
7 KeepUngroupedSpectra Input boolean false If true ungrouped spectra will be copied to the output workspace and placed after the groups

* One, and only one, of these properties should be set. If more than one is set, the algorithm will run and will use the highest listed above of the properties that are set.

Description

This algorithm sums, bin-by-bin, multiple spectra into a single spectra. The errors are summed in quadrature and the algorithm checks that the bin boundaries in X are the same. The new summed spectra are created at the start of the output workspace and have spectra index numbers that start at zero and increase in the order the groups are specified. Each new group takes the spectra numbers from the first input spectrum specified for that group. All detectors from the grouped spectra will be moved (in the SpectraDetectorMap) to belong to the new spectrum.

Not all spectra in the input workspace have to be copied to a group. If KeepUngroupedSpectra is set to true any spectra not listed will be copied to the output workspace after the groups in order. If KeepUngroupedSpectra is set to false only the spectra selected to be in a group will be used.

To create a single group the list of spectra can be identified using a list of either spectrum numbers, detector IDs or workspace indices. The list should be set against the appropriate property.

An input file allows the specification of many groups. The file must have the following format* (extra space and comments starting with # are allowed) :

"unused number1"             
"unused number2"
"number_of_input_spectra1"
"input spec1" "input spec2" "input spec3" "input spec4"
"input spec5 input spec6"
**    
"unused number2" 
"number_of_input_spectra2"
"input spec1" "input spec2" "input spec3" "input spec4"

* each phrase in "" is replaced by a single integer

** the section of the file that follows is repeated once for each group

Some programs require that "unused number1" is the number of groups specified in the file but Mantid ignores that number and all groups contained in the file are read regardless. "unused number2" is in other implementations the group's spectrum number but in this algorithm it is is ignored and can be any integer (not necessarily the same integer)

An example of an input file follows:
2  
1  
64  
1 2 3 4 5 6 7 8 9 10  
11 12 13 14 15 16 17 18 19 20  
21 22 23 24 25 26 27 28 29 30  
31 32 33 34 35 36 37 38 39 40  
41 42 43 44 45 46 47 48 49 50  
51 52 53 54 55 56 57 58 59 60  
61 62 63 64  
2  
60
65 66 67 68 69 70 71 72 73 74  
75 76 77 78 79 80 81 82 83 84  
85 86 87 88 89 90 91 92 93 94  
95 96 97 98 99 100 101 102 103 104  
105 106 107 108 109 110 111 112 113 114  
115 116 117 118 119 120 121 122 123 124

Previous Versions

version 1

The set of spectra to be grouped can be given as a list of either spectrum numbers, detector IDs or workspace indices. The new, summed spectrum will appear in the workspace at the first workspace index of the pre-grouped spectra (which will be given by the ResultIndex property after execution). The detectors for all the grouped spectra will be moved (in the SpectraDetectorMap) to belong to the first spectrum. A technical note: the workspace indices previously occupied by summed spectra will have their data zeroed and their spectrum number set to a value of -1.

Source Code

Header GroupDetectors2.h

Source GroupDetectors2.cpp

Personal tools
Create a book