sddssmooth

**description:**`sddssmooth`smooths columns of data using multipass nearest-neighbor averaging and/or despiking. Any number of columns may be smoothed. The smoothed data may be put in place of the original data, or included as a new column.Nearest-neighbor averaging involves repeatedly replacing each point by the average of its N nearest-neighbors; this is the type of smoothing that is done if nothing is specified. Despiking consists of replacing the most extreme of N nearest neighbors with the average of the same points; the most extreme point is the one with the largest mean absolute difference from the other points.

**examples:**Smooth data in a Fourier transform:`sddssmooth data.fft data.peaks -column=FFTamplitude`**synopsis:**`sddssmooth [-pipe=[input][,output]] [`*inputfile*] [*outputfile*] -columns=*name*[,*name*...] [-points=*oddInteger*] [-passes=*integer*] [-SavitzkyGolay=*left*,*right*,*order*,[*derivativeOrder*]] [-despike[=neighbors=*integer*][,passes=*integer*]] [-newColumns] [-differenceColumns] [-medianFilter=widowSize=*integer*]**files:***inputFile*contains the data to be smoothed.*outputFile*contains all of the array and parameter data from*inputFile*, plus at least one column for every column in*inputFile*. Columns that are not smoothed will appear unchanged in*outputFile*. If*inputFile*contains multiple pages, each is treated separately and is delivered to a separate page of*outputFile*.**switches:**`-pipe[=input][,output]`

-- The standard SDDS Toolkit pipe option.`-columns=`-- Specifies the names of the column to smooth. The names may include wildcards.*columnName*[,*columnName...*`-points=`-- Specifies the number of points to average to create a smoothed value for each point. The default is three, which implies replacing each point by the average of itself and its two nearest neighbors.*oddInteger*`-passes=`-- Specifies the number of nearest-neighbor-averaging smoothing passes to make over each column of data. The default is 1. If 0, no such smoothing is done. In the limit of an infinite number of passes, every point will tend toward the average value of the original data. If*integer*`-despike`is also given, then despiking occurs first.`-SavitzkyGolay=`-- Specifies smoothing by use of a Savitzky-Golay filter, which involves fitting a polynomial of order*left*,*right*,*order*,[*derivativeOrder*]*order*through*left*+*right*+1 points. Optionally, takes the*derivativeOrder*-th derivative of the data. If this option is given, the nearest-neighbor-averaging smoothing is not done. If`-despike`is also given, then despiking occurs first.`-despike[=neighbors=`-- Specifies smoothing by despiking, as described above. By default, 4 nearest-neighbors are used and 1 pass is done. If this option is not given, no despiking is done.*integer*][,passes=*integer*]`-newColumns`-- Specifies that the smoothed data will be placed in new columns, rather than replacing the data in each column with the smoothed result. The new columns are given names of the form, where*columnName*Smoothed*columnName*is the original name of a column.`-differenceColumns`-- Specifies that additional columns be created in the output file, containing the difference between the original data and the smoothed data. The new columns are given names of the form*columnName*`Unsmooth`, where*columnName*is the orignal name of the column.`-medianFilter`- Speficies median smooth and the window size (W, an odd integer, default is 3). It smooths the orignal data through finding the median of a data point among the nearest left (W-1)/2 points, the data point, and the nearest right (W-1)/2 points.

**see also:**- sddsdigfilter
`sddsdigfilter`()sddsdigfilter

- sddsdigfilter
**author:**M. Borland, ANL/APS.