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

InterpolateBackground v1

Summary

Interpolates the background temperature for two empty container runs.

Properties

Name

Direction

Type

Default

Description

WorkspaceGroup

Input

WorkspaceGroup

Mandatory

Workspace Group with two workspaces containing data from empty container runs

InterpolateTemp

Input

number

0

Target temperature to interpolate at

OutputWorkspace

Output

Workspace

Mandatory

Output Workspace with interpolated data

Description

This algorithm is useful for Powder Diffraction Reduction. In practice, when we have data collected for samples at various temperature points, we don’t want to repeat the measurement for the empty background at all the temperature points. Instead, we want to measure the empty container background at selected critical temperature points and for the rest of points, we want to do perform the interpolation to estimate the empty container.

This algorithm will perform a linear interpolation on the background temperature for two empty container runs. Below is the function used for the interpolation:

\[factor = (temp_{interpo} - temp_{low}) / (temp_{high} - temp_{low}) WS_{interpolated} = WS_{high} * factor + WS_{low} * (1 - factor)\]

where \(WS_{low}\) and \(WS_{high}\) are the workspaces containing the run data, \(temp_{low}\) and \(temp_{high}\) are the two extreme temperatures the empty containers were measured at, and \(temp_{interpo}\) is the target temperature to interpolate at.

Usage

Example - Background Interpolation:

# create workspace
dataX = [0,1,2,3,4,5,6,7,8,9] # or use dataX=range(0,10)
dataY1 = [1,1,1,1,1,1,1,1,1,1] # or use dataY=[1]*10
dataY2 = [2,2,2,2,2,2,2,2,2,2] # or use dataY=[2]*10
ws1 = CreateWorkspace(dataX, dataY1)
ws2 = CreateWorkspace(dataX, dataY2)
wsGroup = GroupWorkspaces("ws1,ws2")
interpoTemp = "200"
# CreateWorkspace does not add the "SampleTemp" property so we need to add it here
ws1.getRun().addProperty("SampleTemp", "100", False)
ws2.getRun().addProperty("SampleTemp", "300", False)

# Perform the background interpolation
outputWS = InterpolateBackground(wsGroup, interpoTemp)

# Check output
print("Interpolated Y values are: {}".format(outputWS.readY(0)))

Output:

Interpolated Y values are: [1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5]

Categories: AlgorithmIndex | Diffraction\Reduction | Diffraction\Utility

Source

Python: InterpolateBackground.py