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

HFIRGoniometerIndependentBackground v1

Summary

Generates a background from a 3 dimensional MDHistoWorkspace.

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

IMDHistoWorkspace

Mandatory

Input workspace, must be a 3 dimensional MDHistoWorkspace

BackgroundLevel

Input

number

50

Backgound level defines percentile range, (default 50, median filter)

BackgroundWindowSize

Input

number

Optional

Background Window Size, only applies to the rotation axis, assumes the detectors are already grouped. Integer value or -1 for All values

FilterMode

Input

string

nearest

Mode should be ‘nearest’ if the rotation is incomplete or ‘wrap’ if complete within a reasonable tolerance. Allowed values: [‘nearest’, ‘wrap’]

OutputWorkspace

Output

Workspace

Mandatory

Description

This algorithm is used to generate a background for HFIR monochromatic diffraction data. This algorithm wraps Scipy.ndimage.percentile_filter to generate the background for the input workspace. In the case that BackgroundWindowSize is -1, Numpy.percentile is used to generate the background as it is much faster.

Usage

# create workspace
import numpy as np
signal = np.random.randint(low=0, high=10, size=(100,100,100))
workspace = CreateMDHistoWorkspace(SignalInput=signal,
                                   ErrorInput=np.ones_like(signal),
                                   Dimensionality=3,
                                   Extents='0,10,0,10,0,10',
                                   Names='x,y,z',
                                   NumberOfBins='100,100,100',
                                   Units='number,number,number',
                                   OutputWorkspace='output')



# Perform the background interpolation
outputWS = HFIRGoniometerIndependentBackground(workspace, BackgroundWindowSize=10)

# Check output
print("Shape of the resulting Signal is: {}".format(outputWS.getSignalArray().shape))

Output:

Shape of the resulting Signal is: (100, 100, 100)

Categories: AlgorithmIndex | Diffraction\Reduction | Diffraction\Utility

Source

Python: HFIRGoniometerIndependentBackground.py