\(\renewcommand\AA{\unicode{x212B}}\)

CopyDataRange v1

../_images/CopyDataRange-v1_dlg.png

CopyDataRange dialog.

Summary

Replaces a range of data in the destination workspace with a specified continuous range of data from the input workspace

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory The workspace containing a range of data to be used for the replacement.
DestWorkspace Input MatrixWorkspace Mandatory The workspace to have range of data replaced.
StartWorkspaceIndex Input number 0 The index denoting the start of the spectra range.
EndWorkspaceIndex Input number Optional The index denoting the end of the spectra range.
XMin Input number Optional An X value that is equal to the lowest point to copy (point data), or an X value that is within the first bin to copy (histogram data).
XMax Input number Optional An X value that is equal to the highest point to copy (point data), or an X value that is within the last bin to copy (histogram data).
InsertionYIndex Input number 0 The index denoting the histogram position for the start of the data replacement in the DestWorkspace.
InsertionXIndex Input number 0 The index denoting the x position for the start of the data replacement in the DestWorkspace.
OutputWorkspace Output MatrixWorkspace Mandatory The name to give the output workspace.

Description

This algorithm takes a continuous block of data from an input workspace and places this data into a destination workspace, replacing the data in the destination workspace at which the insertion is specified. The block of data to be used is specified by entering spectra indices and x indices within the input workspace into the algorithm. The insertion location is then specified by an InsertionYIndex and InsertionXIndex within the destination workspace.

Note that this algorithm will replace not only the Y values, but also the E values within the destination workspace. The original input workspace remains unchanged.

Usage

Example - Copy Data Range within one workspace over to another

# Create two workspaces
demo_ws1 = CreateWorkspace(DataX=[1,2,3], DataY=[1,2,3], DataE=[1,1,1], NSpec=1)
demo_ws2 = CreateWorkspace(DataX=[1,2,3], DataY=[4,5,6], DataE=[2,2,2], NSpec=1)

# Copy some of the data from the input workspace over to the destination workspace
output = CopyDataRange(InputWorkspace=demo_ws1, DestWorkspace=demo_ws2, StartWorkspaceIndex=0, EndWorkspaceIndex=0,
                       XMin=1, XMax=2, InsertionYIndex=0, InsertionXIndex=0)

# Display the output workpace data
print("Output x data: {0}".format(output.readX(0)))
print("Output y data: {0}".format(output.readY(0)))
print("Output e data: {0}".format(output.readE(0)))

Output:

Output x data: [ 1.  2.  3.]
Output y data: [ 1.  2.  6.]
Output e data: [ 1.  1.  2.]

Categories: AlgorithmIndex | Utility\Workspaces

Source

C++ header: CopyDataRange.h (last modified: 2020-03-20)

C++ source: CopyDataRange.cpp (last modified: 2021-03-31)