pyhctsa.operations.entropy.wavelet_entropy

pyhctsa.operations.entropy.wavelet_entropy(y, wavelet_name='sym4', level=5)

Wavelet entropy of a time series.

Decomposes y via the maximal-overlap discrete wavelet transform (MODWT) into level detail scales plus the remaining smooth (scaling) band, i.e., level + 1 bands, computes each band’s share of the signal’s total energy, p_j = E_j / sum(E), and returns the Shannon entropy of this relative-energy distribution across bands, normalized to [0, 1] by its maximum possible value, log2(level + 1) [1]. Low values mean the energy is concentrated in few bands; high values that it is spread evenly across bands. Port of hctsa’s EN_wentropy; the MODWT uses the filters of PyWavelets.

The output is invariant to rescaling y, and is bounded in [0, 1] (the value 1 is reached when the energy is equal in all level + 1 bands). level is fixed by default (rather than left to depend on the series length) because the number of levels sets the normalizing denominator, so letting it grow with the length of y introduces a strong length dependence. With level fixed, the value for white noise is independent of length (about 0.75). level = 5 needs about 64 samples or more for a non-degenerate decomposition.

References

Parameters:
y : array-like

The input time series.

wavelet_name : str, optional

The wavelet used for the MODWT decomposition, a PyWavelets name for an orthogonal wavelet (e.g., 'sym4', 'db2', 'haar'). Default is 'sym4'.

level : int, optional

The number of decomposition levels. Default is 5.

Returns:

The normalized wavelet entropy. NaN if the decomposition fails (e.g., for a series too short for the requested number of levels: level may not exceed floor(log2(N))) or the series has no energy.

Return type:

float