Historically, all smoothing was performed in *SNAP* itself, using a
relatively simple smoothing algorithm that applied a weighted average
of neighboring data points. One undesirable feature of this algorithm
is that it *rounds off* profiles that are triangular in shape,
i.e., the central value of the smoothed profile is systematically less
than the unsmoothed profile. The same smoothing radius was used for
all profiles.

A disadvantage of smoothing the profiles in *SNAP* is that you don't
see the consequences of the smoothing until *SNAP* is complete--which
requires 12 minutes of CPU time for beam shots. You may
find that the chosen smoothing radius was too large or too small,
leading to over-smoothed or under-smoothed profiles. Smoothing the
profiles in *SNAPIN* provides immediate feedback on the effects of the
selected smoothing procedure. Several smoothing algorithms are
offered in *SNAPIN*.

The smoothing algorithm used in *SNAP* and *SNAPIN* was taken directly
from the FILTR6 routine in the *TRANSP* code. The algorithm uses
a simple local weighted average to generate the smoothing action. The
user specifies a *smoothing radius*, , for the local
weighted average. The weighting function is triangularly shaped, with
a base width , symmetric about and peaked at the point where
the local average is being computed (see Figure 3).
This function has been found to generate almost equivalent smoothing
action to more complicated weighting functions, with a considerable
savings in CPU time. The formula for the weighting function is:

**Figure 3:** Triangular Weighting Function

where *W*(*x*-*x*_{0}) is the weight applied of the data point at *x* for
the smoothing being performed at *x*_{0}. The algorithm evaluates the
smoothed data by computing the local weighted average about each
point, *j*, using the weighting function:

where *f*(*t*) is the linearly interpolated (i.e., continuous, piecewise
linear) function of the original data (*x*(1),*y*(1)) through
(*x*(*n*),*y*(*n*)).

The original FILTR6 routine offered the capability to suppress
smoothing of high amplitude features, i.e., features whose amplitude
exceeded a preset threshold. Also, the original FILTR6 routine
allowed the smoothing radius to vary in the independent coordinate
(i.e., major radius or time). Neither of these features has been
retained in *SNAP*. The smoothing radius is a constant in *SNAP* and
*SNAPIN* (although in *SNAPIN* the user can repetitively smooth
various sections of the data with different smoothing radii, which
amounts to the same thing), and all of the data points within the
smoothing interval are smoothed, irrespective of their deviation from
the smoothed curve.

No provision is offered in *SNAP* to restrict the smoothing to a
subset of the input profile; the entire profile is subject to
smoothing. If however the smoothing is performed in *SNAPIN*, the user
identifies the smoothing region with mouse clicks; data points outside
the smoothing region are unaffected by the smooth. Such ``smooths''
can be performed sequentially, e.g., one could smooth the data in
several segments. Any part of the data can also be smoothed multiple
times in *SNAPIN* if that is desired.

After a user defines the smoothing parameters in *SNAPIN*, it will draw
a temporary curve illustrating the smoothed data. If the user *
accepts* the smooth, then the temporary curve data is written into the
processed array for the source being edited; if it is rejected, the
contents of the temporary curve are deleted and nothing new is written
into the processed array. Note that if *n* smooths have been
performed on a profile and the user elects to delete the *n*+1st
smooth, the *processsed* array still represents the *n*-fold
smoothed data; only the most recent one is recinded. The only way to
undo multiple smooths is to reread the input data.

When you have smoothed a profile interactively in *SNAPIN*, the manual
smoothing parameter is set and the largest radius used for smoothing
that profile is passed through *SNAP*. Once you have smoothed a profile
manually, you cannot request that *SNAP* smooth it (unless, of course,
you reread the profile).

The FILTR6 algorithm offers some control of the behavior of
smoothing near the endpoints of the smoothing region: it may be set to
keep the original endpoint *values* fixed, or to set the *
derivative* (with respect to the independent variable, radius or time
for example) of the smoothed data zero at the endpoints, or a linear
combination of these two limits.

The *SM* option in *SNAPIN* (which is the setting used in *SNAP*)
forces the smoothing algorithm to keep the *values* fixed at both
the left and right endpoints of the smoothing region. The *SML*
option keeps the left endpoint fixed, but imposes the condition *d*/*dx*
= 0 on the smoothed curve on the right endpoint. This option is
probably most relevant to smoothing the *left-half* of a profile,
for which one might expect *d*/*dx* = 0 at the right side by symmetry.
Similarly, *SMR* option keeps the right endpoint fixed, but
imposes the condition *d*/*dx* = 0 on the smoothed curve on the left
endpoint. This option is probably most relevant to smoothing the *
right-half* of a profile, for which one might expect *d*/*dx* = 0 at the
left side by symmetry. Finally, the *SMG* option gives the *
user* control over the smoothing near the endpoints: for each endpoint
(left and right), the user specifies a real number between 0 and 1.
Here 0 corresponds to fixing the endpoint *value* and 1
corresponds to imposing *d*/*dx* = 0 at the endpoint, while intermediate
values imply a linear interpolation between these limits.

Fri Jul 11 15:18:44 EDT 1997