laszukdawid / PyEMD

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

TypeError with EMD_matlab #165

Closed LeonardoLancia closed 1 month ago

LeonardoLancia commented 1 month ago

Describe the bug the fix for using numpy>=2 introduces a Type Error when using EMD_matlab:

TypeError: unhashable type: 'list'

To Reproduce from PyEMD import EMD_matlab as EMDm import numpy as np x=np.sin(np.linspace(0,24,200)) emdObj = EMDm.EMD() IMFs=emdObj.emd(x)

Expected behavior no error is expected here

Running environment Windows 10, PyEMD version 1.6.2

laszukdawid commented 1 month ago

Thanks for letting me know. It should be fixed now in 1.6.3. Please give it a go, and please let me know if it's actually fixed.

LeonardoLancia commented 1 month ago

I tried it and could make it work with two furhter (small) changes:

1) comment line 431: @staticmethod

2) change line 460 from:

S, T = unify_type(S, T)

to

S, T = unify_types(S, T)

Thank you!

laszukdawid commented 1 month ago

Thanks for testing. EMD_matlab was never really the focus so it was created, tested and left. My bad, there should've been at least regression tests to make sure things aren't broken. Will add these shortly. The typo is embarrassing ^_^

As for commenting @staticmethod... 10 years ago there must have been some reason for it but looking at it now, I don't know why it's there, especially that self is passed as the first argument. I cannot "fix" this now because this might break some people's workflows. However, this should be "resolved" in major version upgrade.

laszukdawid commented 1 month ago

Fix added in 1.6.4 (#166 )