laszukdawid / PyEMD

Python implementation of Empirical Mode Decompoisition (EMD) method
https://pyemd.readthedocs.io/
Apache License 2.0
857 stars 222 forks source link

EMD2d( ) has only 2 IMFs after decomposition ? #138

Closed zhoushuyi-22 closed 1 year ago

zhoushuyi-22 commented 1 year ago

So far I've tried a lot of data forms and only have 2 IMFs after EMD2d decomposition.

And max_imf doesn't seem to control the number of IMF effectively.

For example the following code in EMD2d( ):

rows, cols = 1024, 1024 row_scale, col_scale = 256, 256 x = np.arange(rows) / float(row_scale) y = np.arange(cols).reshape((-1, 1)) / float(col_scale) pi2 = 2 np.pi img = np.zeros((rows, cols)) img = img + np.sin(2 pi2 x) np.cos(y 4 pi2 + 4 x pi2) img = img + 3 np.sin(2 pi2 x) + 2 img = img + 5 x y + 2 (y - 0.2) * y print("Done")

print("Performing decomposition... ", end="") emd2d = EMD2D()

IMFs = emd2d.emd(img, max_imf=4) imfNo = IMFs.shape[0] print("Done")

laszukdawid commented 1 year ago

I'm not sure what's the exact problem here. Stated max_imf means to not produce more than 4 results. As I understand, the code sample generates two IMFs which is less than 4, which is correct.

zhoushuyi-22 commented 1 year ago

Can I specify the number of imf? For example, only 2 imf can be decomposed before, but I hope he can decompose 3 imf.

laszukdawid commented 1 year ago

EMD2D is experimental with the hope that someone will take a look and do it properly. From what I've seen it isn't reliable and one cannot force it to decompose a specific number of imfs. So, no, you can't specific the number of imfs.