Skip to content

Commit

Permalink
Re #9579. Forgot to change an example.
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Jun 9, 2014
1 parent d21cb83 commit cab0a26
Showing 1 changed file with 38 additions and 7 deletions.
45 changes: 38 additions & 7 deletions Code/Mantid/docs/source/algorithms/GroupDetectors-v2.rst
Expand Up @@ -108,8 +108,6 @@ for version 1 here. <GroupDetectors-v1.html>`_
Usage
-----

.. include:: ../usagedata-note.txt

Example 1: specifying a map file
################################

Expand Down Expand Up @@ -148,7 +146,7 @@ Example 1: specifying a map file

# Create a workspace filled with a constant value = 0.3
ws=CreateSampleWorkspace()
# Group detectots according to the created file.
# Group detectors according to the created file.
grouped = GroupDetectors( ws, MapFile = groupingFilePath )

# Check the result
Expand Down Expand Up @@ -287,12 +285,41 @@ Example 5: keeping ungrouped spectra

.. testcode:: ExKeep

import os

# Create a grouping file from the example above.
# It makes 2 groups of 64 and 60 detectors respectively.
groupingFileContent = \
"""
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
"""
# Save the data to a file
groupingFilePath = os.path.expanduser('~/MantidUsageExample_GroupDetectorsGrouping.txt')
f = open(groupingFilePath, 'w')
f.write( groupingFileContent )
f.close()

# Create a workspace filled with a constant value = 0.3
ws=CreateSampleWorkspace()
# Group detectots according to GroupDetectorsGrouping.txt from UsageData.
# The file is a copy of the example above. It makes 2 groups of 64 and 60 detectors respectively.
grouped = GroupDetectors(ws,MapFile='GroupDetectorsGrouping.txt',KeepUngroupedSpectra=True)

# Group detectors according to the created file.
grouped = GroupDetectors( ws, MapFile=groupingFilePath, KeepUngroupedSpectra=True )

# Check the result
print 'Number of spectra in grouped workspace is', grouped.getNumberHistograms()
Expand All @@ -319,4 +346,8 @@ Output
...
Spectrum 77 is ungrouped, it has 1 detector

.. testcleanup:: ExKeep

os.remove( groupingFilePath )

.. categories::

0 comments on commit cab0a26

Please sign in to comment.