GroupDetectors, given a Grouping Pattern, will put the first listed group in workspace index 0 in the output, the second in 1, etc.
The groups are placed in the workspace in order of the lowest numbered DetectorID they contain. Why - was this specified for some unique application?
Note: the Map File option (text or XML) does preserve the intended order, as does MuonGroupDetectors given a grouping table. However MuonGroupDetectors doesn’t preserve the mapping from histograms to Detector Groups - try Instrument View! And a Map File is not easy to use from a script if it wanted to generate a custom mapping and then use it.
GroupDetectors(InputWorkspace=“Raw”,GroupingPattern=“10-19,30-39,50-59,0+60+61+62+63,40-49,1-9,20-29”,OutputWorkspace=“Grouped”) # note arbitrary order
for h in range(w.getNumberHistograms()):
print “Histogram index “,h,” came from detectors”,d.getDetectorIDs() # note sorted!
Probably all. Using Mantid 3.12.1