ChangeBinOffset v1

../_images/ChangeBinOffset-v1_dlg.png

ChangeBinOffset dialog.

Summary

Adjusts all the time bin values in a workspace by a specified amount.

Alias

This algorithm is also known as: OffsetX

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory Name of the input workspace
OutputWorkspace Output MatrixWorkspace Mandatory Name of the output workspace
Offset Input number 0 The amount to change each time bin by
IndexMin Input number 0 The workspace index of the first spectrum to shift. Only used if IndexMax is set.
IndexMax Input number Optional The workspace index of the last spectrum to shift. Only used if explicitly set.

Description

This algorithm can be used to change the time-of-flight bins of a workspace by a specified amount (defined above as the Offset). A possible use of this algorithm is to correct time bins that have been recorded incorrectly.

Optionally, the range of spectra can be selected to apply this offset selectively using the IndexMin and IndexMax properties.

The output workspace will be an exact copy of the input workspace except for the changed time bins.

Usage

import numpy as np

# Create a workspace
ws = CreateSampleWorkspace()

# Offset the time bins by 1.0
wsOffset = ChangeBinOffset(ws,Offset=1.0)

# Check the offset
x1 = ws.readX(0)
x2 = wsOffset.readX(0)
# Test that all elements of arrays x2 and x1 differ by 1.0
print np.all( x2 - x1 == 1.0 )
y1 = ws.readY(0)
y2 = wsOffset.readY(0)
# Test that arrays y2 and y1 are equal
print np.all( y2 == y1 )
True
True

Categories: Algorithms | Transforms\Axes