Rebin()

Rebin a workspace given the specified binning scheme.

REBIN
[/LIN]
[/LOG]
wksp=Workspace bound1=Real step1=Real bound2=Real [step2=Real] [bound3=Real] [step3=Real] [bound4=Real] Rebin a workspace in linear or logarithmic steps
REBIN wksp=Workspace xmin=Real xmax=Real Rebin over a range
REBIN wksp=Workspace xarray=Realarray Rebin to the given X values.

example:

	# Read a spectrum and re-bin the same as an
	# already loaded vanadium workspace
	>> w = s(1)
	>> w = rebin( w, vanadium.x )

Note: You can combine rebins by concatenating the results with the & operator.

Rebin

The rebin command performs what can loosely be described as an interpolation from one histogram into another histogram with the same integrated count but with modified X-boundaries. Some numerical precision is lost during a re-binning operation and there is usually a degree of peak broadening so multiple re-binning is to be avoided.

The essential element in all the Rebin() command formats is to provide a new set of X-values for the spectra being re-binned. The first format allows ranges of linear or logarithmic steps to be specified explicitly. The second, simply acts to trim or expand a workspace to fit the given range, often useful when a series of spectra with different offsets need combining. The final form ensures the compatibility of two spectra by re-binning one spectrum to the X-values of the other.

Linear and logarithmic re-binning can be provided together by concatenating the different rebin ranges with the "&" operator (an end-on join of two spectra, see workspace operations). For example,

	w = rebin:lin(s(1), 303, 700) & rebin:log(s(1), 700, 0.01, 800)

(note that for an append to work, the ending value of the first range must be identical to the starting value of the next range).

Parameters:

/Lin

Linear rebinning between the boundaries specified in steps given by the "Stepn" parameters.

/Log

Gives logarithmic bin widths. The bin widths are calculated such that for for any given binning range

Xn+1 - Xn = Step * Xn

where Step is the step value chosen for the range. For example, given the command

w = rebin:log(w, 10.0, 0.1, 15.0)

The bin boundaries generated will be [10, 11, 12.1, 13.31, 14.641, 15].

Wksp (Workspace)

The workspace to be re-binned

Boundn, Stepn (Real)

Lower bound and step value (Dn above). There must always be one more bound specified than step value.

Xmin, Xmax (Real)

Interval over which to re-bin. If the interval is not on a bin boundary, the counts are automatically corrected proportionally to the amount of the bin included. This command leaves all complete bin boundaries within the range the same as before. It is used for extending or contracting the X-range of the spectra in a data safe way.

Xarray (Realarray)

An X-array to completely specify the desired bin boundaries. This could be an array from a comparable spectrum or it may be automatically generated by the Fill() command as an arithmetic or geometric progression.

RESULT = (Restype)

The re-binned workspace. If the rebin command is used in the keyword form (ie Rebin w ...), workspace will be destructively re-binned. In the functional form, the input workspace will remain unaltered.