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

SANSFitShiftScale v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Fits the high angle workspace and to the low angle bank workspace and provides the required shift and scale

Properties

Name

Direction

Type

Default

Description

HABWorkspace

Input

MatrixWorkspace

Mandatory

High angle bank workspace in Q

LABWorkspace

Input

MatrixWorkspace

Mandatory

Low angle bank workspace in Q

Mode

Input

string

None

What to fit. Free parameter(s). Allowed values: [‘ShiftOnly’, ‘ScaleOnly’, ‘Both’, ‘None’]

ScaleFactor

Input

number

Optional

Optional scaling factor

ShiftFactor

Input

number

Optional

Optional shift factor

FitMin

Input

number

0

Optional minimum q for fit

FitMax

Input

number

1000

Optional maximum q for fit

OutScaleFactor

Output

number

Applied scale factor

OutShiftFactor

Output

number

Applied shift factor

Description

This algorithm is used to fit data from the high-angle bank to data from the low-angle bank in a SANS experiment. The degrees of freedom are a shift and a scale factor which determine by how much the high-angle bank data needs to be scaled and then shifted to match the low-angle bank data.

Fit Modes

There are 4 available fit modes used to scale and shift the high angle bank data so that it matches up with the low angle bank data. Where fitting is required Fit v1 is used with a composite function comprised of a FlatBackground and TabulatedFunction. In all cases the shift and scale are used to alter the counts and errors for the high angle bank.

None is the mode for no fit determined scaling or shifting. In this case the ScaleFactor and ShiftFactor properties must both be provided. With Both, fitting is used to establish optimum parameters for both the scaling and shifting of the high angle bank data. ScaleOnly mode ties the shift, so ShiftFactor must be provided. ShiftOnly mode ties the scale so ScaleFactor must be provided.

Usage

Example - Simple shift:

hab_ws= CreateWorkspace(DataX=range(4,10), DataY=[1]*5, UnitX='MomentumTransfer')
lab_ws = CreateWorkspace(DataX=range(0,6), DataY=[6]*5, UnitX='MomentumTransfer')

uniform_binning = [0, 1, 10]
hab_ws= Rebin(hab_ws, Params=uniform_binning)
lab_ws = Rebin(lab_ws, Params=uniform_binning)

scale, shift = SANSFitShiftScale(HABWorkspace = hab_ws, LABWorkspace =lab_ws, Mode='ShiftOnly', ScaleFactor=1.0)

print("{:.1f}".format(scale))
print("{:.1f}".format(shift))

Output:

1.0
2.5

Categories: AlgorithmIndex | SANS

Source

Python: SANSFitShiftScale.py