laszukdawid / PyEMD

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

Problem with EEMD code #72

Closed cscp230198 closed 4 years ago

cscp230198 commented 4 years ago

Hello, we´re trying to use your EEMd code for an EEG signal analysis, however when we try to run our code all of the eIMFs are flat lines. Our signal is called ST2 and has its own linspace (t) defined at the very beginning of our code. Hope you can help us. Thank you! image

laszukdawid commented 4 years ago

Hey,

I'm not sure why this isn't working. Seems fine. My initial guesses are that it's either a problem with converting your data format or the scale on displayed eIMFs is too high, thus it looks like a flat line.

Let me recommend to start with minimal working example and then add complexity until it breaks. Also, since you're working with Jupyter, it's easier to restart the kernel to make sure that you're not reusing some old variables.

Code below was tested and should work. Let me know if you have any problems.

[1] Basic example

import numpy as np
import pylab as plt
from PyEMD import EEMD

t = np.linspace(0, 1, 100)
s = np.random.normal(size=100)

eemd = EEMD(trails=5)
eIMFs = eemd(s, t)
n_imfs, sample_size = eIMFs.shape

fig, axes = plt.subplots(n_imfs, 1, figsize=(2*n_imfs, 8))
for n, imf in enumerate(eIMFs):
    ax = axes[n]
    ax.plot(t, imf)

plt.show()
cscp230198 commented 4 years ago

Hi, thanks for answering so quickly , I tried running the basic example you sent us , however we still got flat lines. Is it possible something is wrong with my computer? I made sure I restarted the kernel, several times . I am using Windows 10 64-bits . Thank you image

laszukdawid commented 4 years ago

It's unlikely computer's fault; more likely implementation or environment settings.

How and when did you install the PyEMD?

Could you please send me or attqch to the thread the sample data that doesn't work?

On Mon, Feb 17, 2020, at 18:00, cscp230198 wrote:

Hi, thanks for answering so quickly , I tried running the basic example you sent us , however we still got flat lines. Is it possible something is wrong with my computer? I made sure I restarted the kernel, several times . I am using Windows 10 64-bits . Thank you image https://user-images.githubusercontent.com/61157875/74697396-3308b200-51c0-11ea-9f4a-fa9a62c7756f.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/laszukdawid/PyEMD/issues/72?email_source=notifications&email_token=ACXNLKYHMCJQJAAZPVU67Z3RDM6NTA5CNFSM4KWVFKX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMAITQQ#issuecomment-587237826, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXNLK5WHUZA6KI3CM5CISLRDM6NTANCNFSM4KWVFKXQ.

cscp230198 commented 4 years ago

I send you my notebook and the Excel file with all the data. The last cell on our python notebook is where we tried implementing your EEMD code but didn´t work. Thank you

epilepsy.zip

cscp230198 commented 4 years ago

This is the link I used for installing the PyEMD. https://pyemd.readthedocs.io/en/latest/intro.html I should mention I have tried your EMD example and it worked perfectly so I´m not sure it is something about my PyEMD installation. image

laszukdawid commented 4 years ago

Hey @cscp230198, Apologies for the delay. I just checked your code and it looks fine. The problem is the same as reported by another user (https://github.com/laszukdawid/PyEMD/issues/65) and it has been resolved in the last two weeks.

To resolve the issue please delete current version (pip uninstall EMD-signal), restart the jupyter environment and install the newest version (pip install EMD-signal).

Hope this helps. Please let me know of the progress.

laszukdawid commented 4 years ago

Hey @cscp230198 , I'm closing this ticket since there wasn't any communication in the past 17 days. Feel free to reopen if you are still having problems.