SDDSlib
|
Functions for smoothing data and removing spikes from data arrays. More...
#include "mdb.h"
Go to the source code of this file.
Functions | |
void | smoothData (double *data, long rows, long smoothPoints, long smoothPasses) |
Smooth a data array using a moving average. | |
long | despikeData (double *data, long rows, long neighbors, long passes, long averageOf, double threshold, long countLimit) |
Remove spikes from a data array by comparing each point to its neighbors. | |
Functions for smoothing data and removing spikes from data arrays.
This file provides two main functions:
Definition in file smooth.c.
long despikeData | ( | double * | data, |
long | rows, | ||
long | neighbors, | ||
long | passes, | ||
long | averageOf, | ||
double | threshold, | ||
long | countLimit ) |
Remove spikes from a data array by comparing each point to its neighbors.
This function identifies and replaces "spikes" in a data array. A spike is defined as a value that differs significantly from its neighboring values. The function compares each point to its neighbors over multiple passes and replaces values exceeding a given threshold with an average of their neighbors. The process can be halted if too many spikes are found (based on countLimit).
data | Pointer to the data array. |
rows | The number of data points. |
neighbors | The number of neighboring points to consider around each point. |
passes | The maximum number of passes to attempt when removing spikes. |
averageOf | The number of points to average when replacing a spiked value. |
threshold | The threshold for determining if a value is a spike. |
countLimit | The maximum number of spikes allowed before the process stops. |
Definition at line 86 of file smooth.c.
void smoothData | ( | double * | data, |
long | rows, | ||
long | smoothPoints, | ||
long | smoothPasses ) |
Smooth a data array using a moving average.
This function applies a moving average smoothing operation to an array of data points a specified number of times. It uses a window defined by smoothPoints, averaging over this number of points and performing the operation for smoothPasses iterations.
data | Pointer to the array of data to be smoothed. |
rows | The number of data points. |
smoothPoints | The number of points to include in the smoothing window. |
smoothPasses | The number of smoothing passes to perform. |
Definition at line 35 of file smooth.c.