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

SANSConvertToWavelengthAndRebin v1

Summary

Convert the units of time-of-flight workspace to units of wavelength and performs a rebin.

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

The workspace which is to be converted to wavelength

WavelengthPairs

Input

string

A JSON encoded list of wavelength ranges. E.g. [[1., 2.], [2., 3.]]

WavelengthStep

Input

number

Optional

The step size of the wavelength binning.

WavelengthStepType

Input

string

Lin

The step type for rebinning. Allowed values: [‘Log’, ‘Lin’]

RebinMode

Input

string

Rebin

The method which is to be applied to the rebinning. Allowed values: [‘Rebin’, ‘InterpolatingRebin’]

OutputWorkspace

Output

WorkspaceGroup

Mandatory

A grouped workspace containing the output workspaces in the same order as the input pairs.

Description

This algorithm converts the input workspace and a JSON list of wavelength tuples into n workspaces with wavelength units. Subsequently it rebins the wavelength-valued workspace. Either Rebin v1 or InterpolatingRebin v1 is used for rebinning. This algorithm is geared towards SANS workspaces.

Usage

Note

To run these usage examples please first download the usage data, and add these to your path. In Mantid this is done using Manage User Directories.

Example - Convert sample workspace to wavelength and rebin:

ws = CreateSampleWorkspace(NumBanks=1, BankPixelWidth=1)
wavelength = (1, 4)  # 1-4λ

# import json
# json_string = json.dumps([wavelength])  # this can be used for wavelength pairs too
converted_ws_group = SANSConvertToWavelengthAndRebin(InputWorkspace=ws, WavelengthPairs="[[1, 4]]",
                                                    WavelengthStep="1", WavelengthStepType="Lin",
                                                    RebinMode="Rebin")
first_workspace = converted_ws_group.getItem(0)
print("There should be 4 values and got {}.".format(len(first_workspace.dataX(0))))

Output:

There should be 4 values and got 4.

Categories: AlgorithmIndex | SANS\Wavelength

Source

Python: SANSConvertToWavelengthAndRebin.py