Mojo
Mojo

Reputation: 19

How to calculate wavelet energy-to-Shannon entropy ratio to select best mother discrete wavelet in python?

I'm doing a wavelet analysis to sensor data, however, I realise that there are a lot of wavelet families to select from. I have read an article that says: "The method firstly uses a criterion of maximum energy-to-Shannon entropy ratio to select the appropriate wavelet base for signal analysis.". So, I would like to know how to calculate the energy-to-Shannon entropy ratio of a sensor signal in python?

Upvotes: 1

Views: 1909

Answers (2)

I think NRG's code have a confusion.

import pywt
import numpy as np
#series - input data
#wave   - current wavelet
data=pywt.wavedec(series,wave)
S=0
Etot=0
for d in data:
    E=d**2
    Etot+=np.sum(E)
    P=E/Etot
    S+=-np.sum(P*np.log(P))
ratio=Etot/S

That is Etot and np.sum(E)

Upvotes: 1

NRG
NRG

Reputation: 91

Best guess assuming the text meant : np.max(Total Energy/Total Entropy)|wavelet

import pywt
import numpy as np

#series - input data
#wave   - current wavelet
data=pywt.wavedec(series,wave)
S=0
Etot=0
for d in data:
    E=d**2
    P=E/np.sum(E)
    S+=-np.sum(P*np.log(P))
    Etot+=np.sum(E)
ratio=Etot/S

Then repeated for each candidate wavelet

Upvotes: 1

Related Questions