This routine is used typically to average scans for a
given detector (for LWS) or detectors for a given AOT band
or line (for SWS); however, it can also be used for PHT-S and CAM-CVF data.
The user may also wish to average across other tags, such as scans or scan
directions (for SWS) or across detectors or scan directions (for LWS).
The buttons at the top left of the window will allow these choices. Some
care is advised: to be sure to get a uniform number of points averaged
in each bin, the user may wish to first align the x-axis sampling of the
data using the rebin algorithm (e.g., for the case of overlapping LWS detectors).
Also, n.b., when a tag is averaged across, that tag is then removed from
the entire AAR structure. Thus, if you want to average the scans for only
one of the ten LWS detectors, you may wish to first isolate that detector
in a new AAR. This can be done by either using the right mouse button and
the "Make AAR" option, or else the "split AAR" special function. By isolating
the data to be averaged, the tag which is averaged across is not removed
from the data of the other detectors.
Binning the Data:
The binsize is defined either by the routine or by the user. It may be a variable width, changing with wavelength as defined by a resolution, or a fixed width in lambda. The routine tries to preset the binsize to a good choice based on the data.
SWS: The ``Auto'' binsize (a resolution value) represents 5 times the theoretical point source resolution (or one fifth of the resolution element) of the AOT used. The actual resolution can be different (e.g. for extended sources), and it is recommended that the user try out different bin sizes, using the default value as a starting point.
LWS: The ``Auto" binsize (a fixed width value) represents a width smaller than the minimum wavelength sampling possible for the AOT used, but larger than the jitter in wavelength found in any scan. It is chosen so as to preserve the sample spacing of individual scans (see below).
CAM-CVF / PHT-S: The ``Auto'' binsize (a fixed width value) is computed as the median of the separation in wavelength between adjacent data points.
The bins are used to group the data for averaging, but the bin placement on the x-axis is not necessarily uniform. Rather, the first (shortest wavelength) data point defines the start of the first bin. All data within a binwidth of that data point are included in the first bin. The next bin is defined to start at the wavelength of the next nearest data point in increasing wavelength, and etc..
Clipping is preset to 2.5 x rms. This means that
data beyond 2.5 times the rms from the median point in a bin will be discarded
prior to averaging. The same bin is used for clipping and averaging: the
smaller the binsize, fewer points will be clipped out of each bin.
The clipped points are plotted in red in the left panel of the Average
Averaging Techniques available under ISAP:
Common Attributes of the four techniques :
The median used is the IDL median with the /even keyword, i.e., for even numbers of points the median is the average of the central two points. Data with flux = 0 are always discarded. If all data has been discarded from a bin, no average value is produced for that bin. If there is only one point remaining in a bin, the routine returns the flux and wavelength of the single point and sets the new STDEV = 0. the RMS of N data points, when N>1, is defined as: RMS = (sum (flux_i - median)^2 / (N-1) ) ^ 0.5 the result wavelength of the averaging techniqueis always the median of the wavelengths of all points not deleted or removed by clipping. the resulting flux of the averaging technique (except the Median technique) is the unweighted mean value of all points not deleted or removed by clipping. the error in the mean, or equivalently, the new STDEV, is defined as the STDEV = RMS / (N^ 0.5) for the two sigma clipping techniques below, the user may select the variable CLIP
Mean (No Clip) Method:
compute the mean and STDEV of all data in a bin
Median (No Clip) Method:
compute the median and STDEV of all data in a bin
Standard Clip & Mean Method:
Clip (delete) all data in a bin that is more than CLIP * RMS greater or less than the median compute the mean and STDEV of all remaining data in a bin
Special Clip & Mean Method:
If there are 5 or more points in a bin, continue. Else go to the last step clip away the maximum and/or minimum flux value in a bin if it is CLIP*RMS greater or less than the median value, where the median and RMS are determined without including the minimum and maximum flux values If the previous step removed one or two points, and there are still 5 or more points remaining in a bin, repeat the previous step. Else, go to the last step. Use the remaining points to calculate the mean and STDEV.
Try all four options when averaging a spectrum, and check if there are systematic differences between results. However, because outliers are known to be present in SWS and LWS spectra, we recommend that you average your data with one of the clipping algorithms; the ``Special Clip & Mean'' technique clips out more points than the ``Standard Clip & Mean'' technique.