Class WaveletPacketDecomposition
An implementation of wavelet pack decomposition (WPD) using the Haar wavelet.
For details on the Haar wavelet, and the source for the details in this code,
read "WAVELETS FOR KIDS, A Tutorial Introduction", by Brani Vidakovic and Peter Mueller, Duke University.
WARNING: This article on the Haar wavelet is NOT for kids!.
Inheritance
WaveletPacketDecomposition
Assembly: TowseyLibrary.dll
Syntax
public class WaveletPacketDecomposition
Constructors
|
Improve this Doc
View Source
WaveletPacketDecomposition(Double[])
Declaration
public WaveletPacketDecomposition(double[] signal)
Parameters
Type |
Name |
Description |
Double[] |
signal |
|
Fields
|
Improve this Doc
View Source
SQRT2
Declaration
public const double SQRT2 = 1.4142135623730951
Field Value
Properties
|
Improve this Doc
View Source
NumberOfLevels
Declaration
public int NumberOfLevels { get; }
Property Value
Methods
|
Improve this Doc
View Source
CalculateUniversalThreshold(Int32, Double)
Declaration
public static double CalculateUniversalThreshold(int n, double sdOfCoefficients)
Parameters
Returns
|
Improve this Doc
View Source
CalculateUniversalThreshold(Int32, Double[])
Returns a universal threshold which is used to zero small or insignificant wavelet coefficients.
See pages 15 & 16 of "Wavelets for kids"!!
The coefficients should be derived from the bottom row of the WPD tree.
I think n = the level number of the coefficients being thresholded.
In other words, the standard deviation is calculated from the bottom row of coeficients but is increased for the higher rows.
THis is because the coefficients in the lower rows have a lower SNR.
Declaration
public static double CalculateUniversalThreshold(int n, double[] coefficients)
Parameters
Type |
Name |
Description |
Int32 |
n |
level number.
|
Double[] |
coefficients |
|
Returns
|
Improve this Doc
View Source
ExampleOfWavelets_1()
These examples are used to do Wavelet Packet Decomposition on test signals to which noise can be added.
Declaration
public static void ExampleOfWavelets_1()
|
Improve this Doc
View Source
GetFrequencyByOscillationsMatrix(Double[], Int32, Int32)
Declaration
public static double[, ] GetFrequencyByOscillationsMatrix(double[] signal, int fftWindowWidth, int wpdLevelNumber)
Parameters
Returns
|
Improve this Doc
View Source
GetTreeOfBinVectors(List<WaveletPacketDecomposition.BinVector>, WaveletPacketDecomposition.BinVector)
NOTE: THIS METHOD IS RECURSIVE.
It performs a depth first calculation of the wavelet coefficients.
Depth first search terminates when the bin vector contains only one element.
Declaration
public static List<WaveletPacketDecomposition.BinVector> GetTreeOfBinVectors(List<WaveletPacketDecomposition.BinVector> list, WaveletPacketDecomposition.BinVector bv)
Parameters
Returns
|
Improve this Doc
View Source
GetTreeOfBinVectors(Double[])
Declaration
public static List<WaveletPacketDecomposition.BinVector> GetTreeOfBinVectors(double[] signal)
Parameters
Type |
Name |
Description |
Double[] |
signal |
|
Returns
|
Improve this Doc
View Source
GetWPDEnergySequence(Double[], Int32)
Returns a matrix whose columns consist of the energy vector derived from the WPD tree for each WPD window of length 2^L where L= levelNumber.
The WPD windows do not overlap.
Declaration
public static double[, ] GetWPDEnergySequence(double[] signal, int levelNumber)
Parameters
Type |
Name |
Description |
Double[] |
signal |
|
Int32 |
levelNumber |
|
Returns
|
Improve this Doc
View Source
GetWPDEnergySpectrumWithoutDC()
Declaration
public double[] GetWPDEnergySpectrumWithoutDC()
Returns
|
Improve this Doc
View Source
GetWPDEnergyVector()
assume tree is full decomposed WPD tree.
Assume original signal is power of 2 in length.
Declaration
public double[] GetWPDEnergyVector()
Returns
|
Improve this Doc
View Source
GetWPDSignalTree()
assume tree is full decomposed WPD tree.
Assume original signal is power of 2 in length.
Declaration
public double[, ] GetWPDSignalTree()
Returns
|
Improve this Doc
View Source
GetWPDSpectralSequence(Double[], Int32)
Returns a matrix whose columns consist of the bottom row of the WPD tree for each WPD window of length 2^L where L= levelNumber.
The WPD windows do not overlap.
Declaration
public static double[, ] GetWPDSpectralSequence(double[] signal, int levelNumber)
Parameters
Type |
Name |
Description |
Double[] |
signal |
|
Int32 |
levelNumber |
|
Returns
|
Improve this Doc
View Source
HiPassAndDecimate(Double[])
implements the Haar high pass filter.
Declaration
public static double[] HiPassAndDecimate(double[] signal)
Parameters
Type |
Name |
Description |
Double[] |
signal |
|
Returns
|
Improve this Doc
View Source
LowPassAndDecimate(Double[])
implements the Haar low pass filter.
Declaration
public static double[] LowPassAndDecimate(double[] signal)
Parameters
Type |
Name |
Description |
Double[] |
signal |
|
Returns
Extension Methods