Groupbins()

Groups histogram bins by averaging the bin contents.

GROUPBINS wksp=Workspace nbin=Integer [undef=Real] Group bins in a GENIE-V2 format workspace.
GROUPBINS() xarray=Realarray yarray=Realarray earray=Realarray nbin=Integer [undef=Real] Group bins in a spectrum given X, X, and E arrays.

example:

	# Group the bins in a workspace by tens.
	>> work = s(1)
	>> Groupbins work 10 undef=0.0

Note: Undef gives a value to assume when undefined elements are met during the averaging process.

Groupbins

The Groupbins() function provides a way of reducing (in a fairly simple manner) a spectrum with large number of bins. The process is a simple and averages every "nbin" bins by replacing the group of bins with a single new bin. The process is less sophisticated than the Rebin() command and is usually used before displaying a large spectrum graphically to achieve a degree of smoothing.

The first form of the command takes a workspace and modifies the binning to return a re-binned result or to change the original workspace.

The second form of the command takes X, Y, and E data arrays where the E and Y arrays are of the same length and the X array is one element longer (for the extra bin boundary). The result is a workspace containing just the rebinned X, Y and E arrays. The original arrays are unaffected.

Parameters:

Wksp (Workspace)

Any workspace W containing a histogram stored in arrays in W.X, W.Y and W.E. Bin grouping does not work on a two dimensional workspace.

Nbin (Integer)

Number of bins to group together.

Undef (Real) [ default = 0.0 ]

Because Open GENIE allows arrays to contain undefined elements, it is possible that the user may wish to set any undefined elements to a specific value before the bin grouping is carried out (usually zero).

Xarray, Yarray, Earray (Realarray)

These are the three arrays representing the histogram to be grouped. The Xarray parameter specifies the histogram bin boundaries, the Yarray parameter the data values and the E array parameter the Error values for the Y array.

RESULT = (Workspace)

Either the bin-grouped input workspace or a new workspace created to hold just the histogram arrays. Which ever form of the command is used, the resultant workspace will have X, Y and E fields.