title: AVT Statistical filtering algorithm
text: # AVT Statistical filtering algorithm
  
  AVT Statistical filtering algorithm is an approach to improving quality of raw data collected from various sources. It is most effective in cases when there is inband noise present. In those cases AVT is better at filtering data then, band-pass filter or any digital filtering based on variation of.
  
  Conventional filtering is useful when signal/data has different frequency than noise and signal/data is separated/filtered by frequency discrimination of noise. Frequency discrimination filtering is done using Low Pass, High Pass and Band Pass filtering which refers to relative frequency filtering criteria target for such configuration. Those filters are created using passive and active components and sometimes are implemented using software algorithms based on Fast Fourier transform (FFT).
  
  AVT filtering is implemented in software and its inner working is based on statistical analysis of raw data.
  
  When signal frequency/(useful data distribution frequency) coincides with noise frequency/(noisy data distribution frequency) we have inband noise. In this situations frequency discrimination filtering does not work since the noise and useful signal are indistinguishable and where AVT excels. To achieve filtering in such conditions there are several methods/algorithms available which are briefly described below.
  
  ## Averaging algorithm
  
  * Collect n samples of data
  * Calculate average value of collected data
  * Present/record result as actual data
  
  ## Median algorithm
  
  * Collect n samples of data
  * Sort the data in ascending or descending order. Note that order does not matter
  * Select the data that happen to be in n/2 position and present/record it as final result representing data sample
  
  ## AVT algorithm
  
  AVT algorithm stands for Antonyan Vardan Transform and its implementation explained below.
  
  * Collect n samples of data
  * Calculate the standard deviation and average value
  * Drop any data that is greater or less than average ± one standard deviation
  * Calculate average value of remaining data
  * Present/record result as actual value representing data sample
  
  This algorithm is based on amplitude discrimination and can easily reject any noise that is not like actual signal, otherwise statistically different then 1 standard deviation of the signal. Note that this type of filtering can be used in situations where the actual environmental noise is not known in advance. Notice that it is preferable to use the median in above steps than average. Originally the AVT algorithm used average value to compare it with results of median on the data window.
  
  ## Filtering algorithms comparison
  
  Using a system that has signal value of 1 and has noise added at 0.1% and 1% levels will simplify quantification of algorithm performance. The R script is used to create pseudo random noise added to signal and analyze the results of filtering using several algorithms. Please refer to "Reduce Inband Noise with the AVT Algorithm" article for details. This graphs show that AVT algorithm provides best results compared with Median and Averaging algorithms while using data sample size of 32, 64 and 128 values. Note that this graph was created by analyzing random data array of 10000 values. Sample of this data is graphically represented below. From this graph it is apparent that AVT outperforms other filtering algorithms by providing 5% to 10% more accurate data when analyzing same datasets. Considering random nature of noise used in this numerical experiment that borderlines worst case situation where actual signal level is below ambient noise the precision improvements of processing data with AVT algorithm are significant.
  
  ## AVT algorithm variations
  
  ### Cascaded AVT
  
  In some situations better results can be obtained by cascading several stages of AVT filtering. This will produce singular constant value which can be used for equipment that has known stable characteristics like thermometers, thermistors and other slow acting sensors.
  
  ### Reverse AVT
  
  * Collect n samples of data
  * Calculate the standard deviation and average value
  * Drop any data that is within one standard deviation ± average band
  * Calculate average value of remaining data
  * Present/record result as actual data
  
  This is useful for detecting minute signals that are close to background noise level.
  
  ## Possible applications and uses
  
  * Use to filter data that is near or below noise level
  * Used in planet detection to filter out raw data from Kepler (spacecraft)
  * Filter out noise from sound sources where all other filtering methods (Low-pass filter, High-pass filter, Band-pass filter, Digital filter) fail.
  * Pre-process scientific data for data analysis (Smoothness) before plotting see (Plot (graphics))
  * Used in SETI (Search for extraterrestrial intelligence) for detecting/distinguishing extraterrestrial signals from cosmic background
  * Use AVT as image filtering algorithm to detect altered images, please see Python program that is available for download. This image of Jupiter generated from this program, detecting alterations in original picture that was modified to be visually appealing by applying filters.
  
  Another version of this comparison is the Reverse AVT filter applied to the same original Jupiter Image, where we only see that altered portion as Noise that was eliminated by AVT algorithm.
  
  * Use AVT as image filtering algorithm to estimate data density from images, please see Python program program. Picture of Pillars of Creation Nebula shows data density in filtered images from Hubble and Webb. Note that image on the left has big patches of missing data marked with simpler color patterns.
  