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

Rebunch v1

Summary

Rebins data by adding together ‘n_bunch’ successive bins.

See Also

Rebin

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

The input workspace

OutputWorkspace

Output

MatrixWorkspace

Mandatory

The result of rebinning

NBunch

Input

number

1

The number of bins that will be summed in each bunch

Description

The algorithm rebins data by adding together NBunch successive bins.

Usage

# Create a workspaces
ws = CreateSampleWorkspace()

# Rebunch it
rebunched = Rebunch( ws, 3 )

# Check the result
print('Input workspace has             {} bins'.format(ws.blocksize()))
print('"Rebunched" workspace has       {} bins'.format(rebunched.blocksize()))
print('Input workspace bin width       {:.1f}'.format(ws.readX(0)[1] - ws.readX(0)[0]))
print('"Rebunched" workspace bin width {:.1f}'.format(rebunched.readX(0)[1] - rebunched.readX(0)[0]))
print('Input workspace values          {:.1f} {:.1f} {:.1f}'.format(ws.readY(0)[0], ws.readY(0)[50], ws.readY(0)[70]))
print('"Rebunched" workspace values    {:.1f} {:.1f} {:.1f}'.format(rebunched.readY(0)[0], rebunched.readY(0)[50//3], rebunched.readY(0)[70//3]))

Output

Input workspace has             100 bins
"Rebunched" workspace has       34 bins
Input workspace bin width       200.0
"Rebunched" workspace bin width 600.0
Input workspace values          0.3 10.3 0.3
"Rebunched" workspace values    0.9 10.9 0.9

Categories: AlgorithmIndex | Transforms\Rebin

Source

C++ header: Rebunch.h

C++ source: Rebunch.cpp