MergeRuns v1

../_images/MergeRuns-v1_dlg.png

MergeRuns dialog.

Summary

Combines the data contained in an arbitrary number of input workspaces.

Properties

Name Direction Type Default Description
InputWorkspaces Input str list Mandatory The names of the input workspaces as a comma-separated list. You may also group workspaces using the GUI or [[GroupWorkspaces]], and specify the name of the group instead.
OutputWorkspace Output Workspace Mandatory Name of the output workspace

Description

Combines the data contained in an arbitrary number of input workspaces. If the input workspaces do not have common binning, the bins in the output workspace will cover the entire range of all the input workspaces, with the largest bin widths used in regions of overlap.

The combination of each workspace is performed using the Plus v1 algorithm, this does not preform any weighting based on the duration of collection, or proton charge. If you wish to perform Merge runs that should not be equally weighted then they should be corrected individually prior to merging.

Restrictions on the input workspace

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.

Workspace2Ds: Each input workspace must have common binning for all its spectra.

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.

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.

Processing Group Workspaces

Multi-period Group Workspaces

Group workspaces will be merged respecting the periods within each group. For example if you have two multiperiod group workspaces A and B and an output workspace C. A contains matrix workspaces A_1 and A_2, and B contains matrix workspaces B_1 and B2. Since this is multiperiod data, A_1 and B_1 share the same period, as do A_2 and B_2. So merging must be with respect to workspaces of equivalent periods. Therefore, merging is conducted such that A_1 + B_1 = C_1 and A_2 + B_2 = C_2.

Group Workspaces that are not multiperiod

If group workspaces are provided that are not multi-period, this algorithm will merge across all nested workspaces, to give a singe output matrix workspace.

ChildAlgorithms used

The Rebin v1 algorithm is used, if neccessary, to put all the input workspaces onto a common binning.

The Plus v1 algorithm is used to combine each of the workspaces together one pair at a time.

Usage

Example: Merge Two Workspaces

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))
a      = [  6.  15.  21.   9.]
b      = [  6.  15.  21.   9.]
merged = [ 12.  30.  42.  18.]

Example: Merge Two GroupWorkspaces

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))
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: Algorithms | Transforms\Merging

Source

C++ source: MergeRuns.cpp

C++ header: MergeRuns.h