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.
The feeder will first take unique portions of the prime AAR according
to what buttons have been pushed. It will then make a decision about
which part of the reference scale to feed the routine. If the reference
has a tag present like the one that is selected for the prime data, then
the reference data with those matching the prime tag values are feed.
However, if the reference does not have that tag present, then that tag
is not used as a criteria for rejecting reference data. That is,
no match is required in this case, and any reference data can be feed.
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 from the prime AAR contains multiple points at the same wavelength value from the reference AAR. 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 of xarr within the range, refarr(0) to xmid(0) are used if there are no xarr points to the left of the refarr(0). 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)