MultiplyRange v1

../_images/MultiplyRange-v1_dlg.png

MultiplyRange dialog.

Summary

An algorithm to multiply a range of bins in a workspace by the factor given.

Properties

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

Description

The algorithm multiplies the Y values in a range of bins in a workspace by the factor given.

Usage

# 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])

Output

[ 1.  1.  1.  1.  1.  3.  3.  3.  3.  3.]
[ 3.  3.  3.  3.  3.  3.  1.  1.  1.  1.]

Categories: AlgorithmIndex | Arithmetic | CorrectionFunctions

Source

C++ source: MultiplyRange.cpp (last modified: 2019-08-27)

C++ header: MultiplyRange.h (last modified: 2018-10-05)