$$\renewcommand\AA{\unicode{x212B}}$$

# Scale v1¶

## Summary¶

Scales an input workspace by the given factor, which can be either multiplicative or additive.

ScaleX

## Properties¶

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

OutputWorkspace

Output

MatrixWorkspace

Mandatory

Factor

Input

number

1

The value by which to scale the input workspace

Operation

Input

string

Multiply

## Description¶

Uses the binary operation algorithms Multiply v1 or Plus v1 to scale the input workspace by the amount requested. This algorithm is provided as a simple, but less powerful, alternative to the python workspace algebra functionality.

## Usage¶

ws = CreateSampleWorkspace(BankPixelWidth=1)
print("Every 10th bin value of " + ws.name())

print("Every 10th bin value of " + wsOffset.name())

wsOffset2 = ws + 2
print("Every 10th bin value of " + wsOffset2.name())


Output:

Every 10th bin value of ws
[  0.3   0.3   0.3   0.3   0.3  10.3   0.3   0.3   0.3   0.3]
Every 10th bin value of wsOffset
[  2.3   2.3   2.3   2.3   2.3  12.3   2.3   2.3   2.3   2.3]
Every 10th bin value of wsOffset2
[  2.3   2.3   2.3   2.3   2.3  12.3   2.3   2.3   2.3   2.3]


Example: Multiplying by a value

ws = CreateSampleWorkspace(BankPixelWidth=1)
print("Every 10th bin value of " + ws.name())

# Multiply by 10 using scale
wsScaled = Scale(ws,10,"Multiply")
print("Every 10th bin value of " + wsScaled.name())

# Multiply by 10 using the workspace operator overloads
wsScaled2 = ws * 10
print("Every 10th bin value of " + wsScaled2.name())


Output:

Every 10th bin value of ws
[  0.3   0.3   0.3   0.3   0.3  10.3   0.3   0.3   0.3   0.3]
Every 10th bin value of wsScaled
[   3.    3.    3.    3.    3.  103.    3.    3.    3.    3.]
Every 10th bin value of wsScaled2
[   3.    3.    3.    3.    3.  103.    3.    3.    3.    3.]


Categories: AlgorithmIndex | Arithmetic | CorrectionFunctions