Skip to content

Commit

Permalink
Refs #9587 - Docs for MergeRuns.
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterParker committed Jun 12, 2014
1 parent 1f74f41 commit 7910d60
Showing 1 changed file with 64 additions and 8 deletions.
72 changes: 64 additions & 8 deletions Code/Mantid/docs/source/algorithms/MergeRuns-v1.rst
Expand Up @@ -21,16 +21,14 @@ The input workspaces must contain histogram data with the same number of
spectra and matching units and instrument name in order for the
algorithm to succeed.

**For `Workspace2Ds <Workspace2D>`__**: Each input workspace must have
common binning for all its spectra.
**Workspace2Ds**: Each input workspace must have common binning for all
its spectra.

**For `EventWorkspaces <EventWorkspace>`__**: This algorithm is
Event-aware; it will append event lists from common spectra. Binning
parameters need not be compatible; the output workspace will use the
first workspaces' X bin boundaries.
**EventWorkspaces**: This algorithm is Event-aware; it will append
event lists from common spectra. Binning parameters need not be compatible;
the output workspace will use the first workspaces' X bin boundaries.

**For `WorkspaceGroups <WorkspaceGroup>`__**: Each nested has to be one
of the above.
**WorkspaceGroups**: Each nested has to be one of the above.

Other than this it is currently left to the user to ensure that the
combination of the workspaces is a valid operation.
Expand Down Expand Up @@ -63,4 +61,62 @@ ChildAlgorithms used
The :ref:`algm-Rebin` algorithm is used, if neccessary, to put all the
input workspaces onto a common binning.

Usage
-----

**Example: Merge Two Workspaces**

.. testcode:: ExWs

dataX = [1, 2, 3, 4, 5]
dataY = [6, 15, 21, 9]

a = CreateWorkspace(dataX, dataY)
b = CreateWorkspace(dataX, dataY)

merged = MergeRuns(InputWorkspaces="a, b")

print "a = " + str(a.readY(0))
print "b = " + str(b.readY(0))
print "merged = " + str(merged.readY(0))

.. testoutput:: ExWs

a = [ 6. 15. 21. 9.]
b = [ 6. 15. 21. 9.]
merged = [ 12. 30. 42. 18.]

**Example: Merge Two GroupWorkspaces**

.. testcode:: ExWsGroup

dataX = [1, 2, 3, 4, 5]
dataY = [6, 15, 21, 9]

a = CreateWorkspace(dataX, dataY)
b = CreateWorkspace(dataX, dataY)
c = CreateWorkspace(dataX, dataY)
d = CreateWorkspace(dataX, dataY)

group_1 = GroupWorkspaces(InputWorkspaces="a, b")
group_2 = GroupWorkspaces(InputWorkspaces="c, d")

merged = MergeRuns(InputWorkspaces="group_1, group_2")

print "group_1 = [" + str(group_1[0].readY(0)) + ","
print " " + str(group_1[1].readY(0)) + "]"

print "group_2 = [" + str(group_2[0].readY(0)) + ","
print " " + str(group_2[1].readY(0)) + "]"

print "merged = " + str(merged.readY(0))

.. testoutput:: ExWsGroup

group_1 = [[ 6. 15. 21. 9.],
[ 6. 15. 21. 9.]]
group_2 = [[ 6. 15. 21. 9.],
[ 6. 15. 21. 9.]]
merged = [ 24. 60. 84. 36.]

.. categories::

0 comments on commit 7910d60

Please sign in to comment.