Skip to content

Commit

Permalink
Add usage example to MDHistoToWorkspace2D-v1.rst re #9726
Browse files Browse the repository at this point in the history
Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Aug 6, 2014
1 parent 99dfaba commit 7af3197
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Code/Mantid/docs/source/algorithms/MDHistoToWorkspace2D-v1.rst
Expand Up @@ -19,4 +19,30 @@ This tool is useful as many algorithms in Mantid only apply to
Workspace2D. After conversion with MDHistoToWorkspace2D such algorithms
can also be applied to MD data.

Usage
-----

**Example - Flatten a small workspace:**

.. testcode:: ExMDHistoToWorkspace2D

# Create input workspace
CreateMDWorkspace(Dimensions=3, Extents='-10,10,-10,10,-10,10', Names='A,B,C', Units='U,U,U', OutputWorkspace='demo')
FakeMDEventData(InputWorkspace='demo', PeakParams='32,0,0,0,1')
input = BinMD(InputWorkspace='demo', AlignedDim0='A,-2,2,4', AlignedDim1='B,-2,2,4', AlignedDim2='C,-2,2,4')

# Run the algorithm
output = MDHistoToWorkspace2D(InputWorkspace='input')

# print 6th group of 4 bins in both input and output workspaces
print "part of MD workspace",input.getSignalArray()[1,1]
print "corresponding part of 2D workspace",output.dataY(5)

Output:

.. testoutput:: ExMDHistoToWorkspace2D

part of MD workspace [ 0. 4. 5. 0.]
corresponding part of 2D workspace [ 0. 4. 5. 0.]

.. categories::

0 comments on commit 7af3197

Please sign in to comment.