Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | The name of the input workspace. |
OutputWorkspace | Output | MatrixWorkspace | Mandatory | The name of the output workspace. |
StartBin | Input | number | 0 | Bin index to start from |
EndBin | Input | number | Optional | Bin index to finish at |
Factor | Input | number | 0 | The value by which to multiply the input data range |
The algorithm multiplies the Y values in a range of bins in a workspace by the factor given.
# Create a workspace with 100 bins
ws = CreateSampleWorkspace()
# Multuply the values in bins 25 to 75 by 2
res = MultiplyRange(ws,StartBin=25,EndBin=75,Factor=3.0)
# Check the result
# Get the Y values from the first spectra of the input and output workspaces
y = ws.readY(0)
yres = res.readY(0)
# Print out the ratios yres[i] / y[i] for bins with indices 20 to 30
print(yres[20:30] / y[20:30])
# Print out the ratios yres[i] / y[i] for bins with indices 70 to 80
print(yres[70:80] / y[70:80])
[ 1. 1. 1. 1. 1. 3. 3. 3. 3. 3.]
[ 3. 3. 3. 3. 3. 3. 1. 1. 1. 1.]
Categories: AlgorithmIndex | Arithmetic | CorrectionFunctions
C++ source: MultiplyRange.cpp (last modified: 2019-08-27)
C++ header: MultiplyRange.h (last modified: 2018-10-05)