Table of Contents
Creates a workspace with different x-value bin boundaries where the new y-values are estimated using cubic splines.
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | Workspace containing the input data |
OutputWorkspace | Output | MatrixWorkspace | Mandatory | The name to give the output workspace |
Params | Input | dbl list | Mandatory | A comma separated list of first bin boundary, width, last bin boundary. Optionally this can be followed by a comma and more widths and last boundary pairs. Optionally this can also be a single number, which is the bin width. In this case, the boundary of binning will be determined by minimum and maximum TOF values among all events, or previous binning boundary, in case of event Workspace, or non-event Workspace, respectively. Negative width values indicate logarithmic binning. |
This algorithm is useful for increasing the time resolution of spectra whose bins have large numbers of counts which vary smoothly e.g. monitor spectra.
The “params” property defines the new bin boundaries using the same syntax as in Rebin. That is, the first number is the first bin boundary and the second number is the width of the bins. Bins are created until the third number would be exceeded, the third number is the x-value of the last bin. There can be further pairs of numbers, the first in the pair will be the bin width and the last number the last bin boundary.
The bin immediately before the specified boundaries ,
, ...
is likely to have a different width from
its neighbors because there can be no gaps between bins. Rebin ensures
that any of these space filling bins cannot be less than 25% or more
than 125% of the width that was specified.
To calculate the y-values the input spectra are approximated with a time series where the value at the center of each bin is the mean count rate over the bin. This series is interpolated by calculating cubic splines that fit this series and evaluating the splines at the centers of the requested bin. The splines have natural boundary conditions and zero second derivative at the end points, they are calculated using the gsl.
The errors on the count rates are estimated as a weighted mean of the errors values for the nearest input bin centers. These weights are inversely proportional to the distance of the output bin center to the respective input bin data points.
The input rebin parameter string is identical to that used by Rebin.
Example - rebin with single bin width:
# create histogram workspace
dataX = [0,1,2,3,4,5,6,7,8,9] # or use dataX=range(0,10)
dataY = [1,1,1,1,1,1,1,1,1] # or use dataY=[1]*9
ws = CreateWorkspace(dataX, dataY)
# rebin from min to max with size bin = 0.5
ws = InterpolatingRebin(ws, 0.5)
print("First 5 rebinned X values are: {}".format(ws.readX(0)[0:5]))
print("First 5 rebinned Y values are: {}".format(ws.readY(0)[0:5]))
Output:
First 5 rebinned X values are: [ 0. 0.5 1. 1.5 2. ]
First 5 rebinned Y values are: [ 0.5 0.5 0.5 0.5 0.5]
For further examples with more complex parameter strings see Rebin examples.
Categories: Algorithm Index | Transforms\Rebin
C++ source: InterpolatingRebin.cpp (last modified: 2019-01-07)
C++ header: InterpolatingRebin.h (last modified: 2018-10-05)