StitchByBackground v1

Summary

Stitch banks together at given x-axis values, without rebinning the data to preserve resolution.

Properties

Name

Direction

Type

Default

Description

InputWorkspaces

Input

str list

Mandatory

List of workspaces to be stitched together. Allowed values: [‘002192_Beam’, ‘002192_Beam_Flux’, ‘002193_Transmission’, ‘002194_Transmission’, ‘002195_Transmission’, ‘002196_Transmission’, ‘002197_Transmission’, ‘002219_Beam’, ‘002219_Beam_Flux’, ‘002227_Absorber’, ‘002228_Container’, ‘AgBE’, ‘AgBE_#1_d2.0m_c7.8m_w6.0A’, ‘D2O’, ‘D2O_#1_d2.0m_c7.8m_w6.0A’, ‘D33Mask2’, ‘D33_2m_SolidAngle’, ‘F127_D2O’, ‘F127_D2O_#1_d2.0m_c7.8m_w6.0A’, ‘F127_D2O_Anethol’, ‘F127_D2O_Anethol_#1_d2.0m_c7.8m_w6.0A’, ‘H2O’, ‘H2O_#1_d2.0m_c7.8m_w6.0A’, ‘SofTT’, ‘stitched’, ‘trans1’, ‘ws’, ‘ws1’, ‘ws2’]

OutputWorkspace

Output

Workspace

Mandatory

The stitched workspace.

StitchPoints

Input

dbl list

Values on the x-axis (between adjacent spectra) where the stitch should take place. i.e. Overlaps in the data.

OverlapWidth

Input

number

0.05

A linear background is fitted to data in the region StitchPoint +/- OverlapWidth (i.e. the data is fitted to span range 2*OverlapWidth).

CropLowerBound

Input

number

0

The XMin to use when cropping the output workspace.

CropUpperBound

Input

number

0

The XMax to use when cropping the output workspace.

Description

This algorithm allows for the stitching of a list of single-spectra workspaces into one workspace by using a number of user-defined stitch points at x values and an overlap region around these points in which to perform a linear background fit.

In comparison to Stitch1DMany v1 or MatchAndMergeWorkspaces v1, this algorithm does not perform any rebinning during the stitching process, creating a ragged workspace that can be rebinned appropriately later in the reduction.

StitchByBackground example. Shows 5 different spectra on the right and the stitched result on the left.

Usage

Example - StitchByBackground

ws_list = []
stitch_points = []

for i in range(5):
    CreateSampleWorkspace(OutputWorkspace=f"ws_{i+1}", NumBanks=1, BankPixelWidth=1, Function="Multiple Peaks", XMin=20000*i, XMax=20000*(i+1))
    ws_list.append(f"ws_{i+1}")
    stitch_points.append(20000*(i+1))
stitch_points.pop(-1)

StitchByBackground(InputWorkspaces=ws_list, StitchPoints=stitch_points, OutputWorkspace="out", OverlapWidth=2000, CropUpperBound=95000, CropLowerBound=0)
print(f"Stitched workspace has {mtd['out'].blocksize()} bins.")

Output:

Stitched workspace has 475 bins.

Categories: AlgorithmIndex | Utility

Source

Python: StitchByBackground.py