Depending on the AOT type, some of the scan, detector, line, and scan-direction buttons will be preselected for the user's convenience. The user may override these selections. When any of these buttons is selected, then the rebinning will be performed across the data ignoring the corresponding tags. When the buttons are not selected, data will be rebinned separately.An Example: Suppose the selected data has three scans for each of ten detectors and only one value for the lines and scan-directions tags. Then only the scan and detector buttons will appear and the user has four different ways to rebin this data. First, if both buttons are not turned on, then thirty rebinned spectra will appear corresponding to each scan from each detector. Second, if only the scan button is selected, then the scans corresponding to each detector are rebinned together such that ten spectra (one for each detector) are produced. Third, if only the detector button is pressed, then for each scan, all the detector data will be rebinned together; hence, only three spectra results corresponding to each scan. Finally, when the both button are turned on, then only one spectrum appears because all the scan and detector data are rebinned together.
Resolution is defined as lambda/delta-lambda.One or two lists of the wavelengths found in the input data are shown under the define scale option so that the user may easily select (by clicking) a new starting or stopping wavelength for the grid.
epsilon is used to eliminate multiple x-values as discussed below.
Next, the "chk_multix" routine is performed. This checks if any array of x values contains multiple points at the same value. Here, the "same" value means value +- epsilon. If so, this routine computes the mean of the corresponding y values and stdev values at the mean of the duplicated points in the x-array and modifies the x-array, y-array, and stdev-array accordingly. In addition, this routine remembers the number of multiple points used for each of the modified y-array elements. This information will be used later, when rebinning the data, as the weight of each flux value. This is intended as a pre-binning operation to simplify interpolation and rebinning of a spectrum.
Finally, the rebin is performed conserving flux via approximate trapezoidal
integration method. This is outlined as follows.
1. The middle point array is generated from the user-defined
wavelength scale according to
where w_av is (weight(k-1) + weight(k)) / 2
for all k such that xmid(i-1) <= xarr(k) <= xmid(i).
Because of the boundary, the first k in this range will not be applied
to this formula. The weight(k) is the product of the
chk_multix
routine explained above; it is a number equal to or greater than one, and
it shows how many data points were used in calculating this modified yarr(k).
3. For the edges at the xmid(i-1) and xmid(i), there are two cases. First, if a data point coincidentally exists at either of these points, then its corresponding flux is used to compute the integration. If not (which is the usual case), then the fluxes at these points are linearly interpolated from the two nearest points to each side of them.
4. For the first element, refarr(0), all the points at xarr within the range, refarr(0) to xmid(0) are used. Note that "(0)" designates the first element in the array.
5. If there are no points inside a bin, the value for that bin is found by linearly interpolating between the nearest two data point on either side of the bin: call these: (x_lo, y_lo), (x_hi, y_hi):
6. New "STDEV" values are computed as the errors in
the mean. Specifically:
where yc = computed flux for the bin
and n = number of data points found in the bin + 2 (for bin
edges)