pyhctsa.operations.wavelet.wpd_best_tree¶
-
pyhctsa.operations.wavelet.wpd_best_tree(y, w_name=
'db3', max_level=5)¶ Adaptive best-basis wavelet packet decomposition.
Decomposes the time series with a full wavelet packet tree and then prunes it to the entropy-optimal (“best basis”) subtree using the Coifman-Wickerhauser algorithm: working up from the deepest level, a node’s two children are kept only if their (best-subtree) Shannon entropies sum to strictly less than the node’s own. Unlike a standard DWT, which always splits the frequency axis into the same octave bands, the best basis is a non-uniform partition tailored to the signal. The statistics summarize the shape of that adaptively chosen partition and how energy is spread across it.
- Parameters:¶
- y : array-like¶
The input time series.
- w_name : str, optional¶
The mother wavelet, e.g., ‘db3’, ‘sym2’. Default is ‘db3’.
- max_level : int or 'max', optional¶
The maximum depth of the initial (pre-pruning) wavelet packet tree; ‘max’ uses the maximum level allowed for the series length and wavelet. Default is 5 (reduced to the maximum allowed level for short series).
- Returns:¶
Dictionary containing:
numLeaves: the number of terminal nodes in the best-basis tree.
meanDepth: the mean depth of terminal nodes.
stdDepth: the spread of terminal-node depths (zero if the best basis is uniform in depth).
entropy: the Shannon entropy of the energy distribution across terminal nodes.
NaN if the series is too short for a wavelet packet decomposition.
- Return type:¶
dict or float