laszukdawid / PyEMD

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

EEMD not running #40

Closed bs2019 closed 5 years ago

bs2019 commented 5 years ago

Hello! Thank you for your EMD implementations. I used EMD but with EEMD just not running. Can you help me with this?

laszukdawid commented 5 years ago

Hi,

It's always good to hear that someone find the project helpful.

Unfortunately, you didn't provide enough information for me to understand what's the problem. Could you paste how are you trying to run scripts and what is the output?

bs2019 commented 5 years ago

Hi, Thanks for your reply. With any example (like: https://github.com/laszukdawid/PyEMD/blob/master/example/eemd_example.py) in Python Shell there is simply no response.

I hope you can help me to determine what is wrong.

laszukdawid commented 5 years ago

Ok, let's rule out some options. Please provide:

1) What OS are you using (Win / Mac / Linux)? 2) How exactly are you running this script? 3) Have you tried running other examples, like simple_emd.py? 4) Do you see any Traceback or error after executing example_eemd? 5) When you run EEMD could you check your CPU activity, whether it's running? 6) What happens when you run in Python from PyEMD import EEMD?

bs2019 commented 5 years ago
  1. Win 10 Pro
  2. I copied the code example_eemd , saved and run it.
  3. Yes, I don't have trouble with simple_emd.py or the other examples of EMD.
  4. No, there is not Traceback. The process does not end. This does not happen with EMD.
  5. Yes, it's running.
  6. If i run in Python from PyEMD import EEMD this is the fast answer >>. Thanks!
laszukdawid commented 5 years ago

Then I'm guessing it simply takes a lot of time on your machine. Let's check that by modifying the number of trails in the example.

Per documentation, please update line 20 to be eemd = EEMD(trials=5). You can also decrease signal's complexity by commenting one of the lines between 13 and 17.

Hope this helps!

bs2019 commented 5 years ago

hello! I have tried in other machines. And I saw the same result. I hope can you help in: 1st There is other experience with EEMD, CEEMDAN etc without trouble?. 2nd I run the code of exampleEEMD.py from win cmd and this was the result

"C:\Users\USUARIO\AppData\Local\Programs\Python\Python37\lib\multiprocessing\popen_spawn_win32.py", line 33, in init prep_data = spawn.get_preparation_data(process_obj._name)​ File "C:\Users\USUARIO\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 143, in get_preparation_data​ _check_not_importing_main()​ File "C:\Users\USUARIO\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main​ is not going to be frozen to produce an executable.''')​ RuntimeError:​ An attempt has been made to start a new process before the​ current process has finished its bootstrapping phase.​ ​ This probably means that you are not using fork to start your​ child processes and you have forgotten to use the proper idiom​ in the main module:​ ​ if name == 'main':​ freeze_support()​ ...​ ​ The "freeze_support()" line can be omitted if the program​ is not going to be frozen to produce an executable.​ Traceback (most recent call last):​ File "", line 1, in ​ File "C:\Users\USUARIO\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 105, in spawn_main​ exitcode = _main(fd)​ File "C:\Users\USUARIO\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 114, in _main​ prepare(preparation_data)

Thanks a lot for your patience!

laszukdawid commented 5 years ago

Ok, that error means that in Windows you need to run your code from within __main__ case. Please take a look at a similar issue https://github.com/laszukdawid/PyEMD/issues/31.

In short, try this:

from EEMD import EEMD
import numpy as np

if __name__ == "__main__":
  s = np.random.random(100)
  eemd = EEMD()
  eIMFs = eemd(s)
bs2019 commented 5 years ago

Thank you for your valuable contribution and help to this implement in Python. Finally, it works!