EEMD

Info

Ensemble empirical mode decomposition (EEMD) creates an ensemble of worker each of which performs an EMD on a copy of the input signal with added noise. When all workers finish their work a mean over all workers is considered as the true result.

Note

Given the nature of EEMD, each time you decompose a signal you will obtain a different set of components. That’s the expected consequence of adding noise which is going to be random. To make the decomposition reproducible, one needs to set a seed for the random number generator used in EEMD. This is done using PyEMD.EEMD.noise_seed() method on the instance.

Class

class PyEMD.EEMD(trials: int = 100, noise_width: float = 0.05, ext_EMD=None, parallel: bool = False, **kwargs)[source]

Ensemble Empirical Mode Decomposition

Ensemble empirical mode decomposition (EEMD) [Wu2009] is noise-assisted technique, which is meant to be more robust than simple Empirical Mode Decomposition (EMD). The robustness is checked by performing many decompositions on signals slightly perturbed from their initial position. In the grand average over all IMF results the noise will cancel each other out and the result is pure decomposition.

Parameters:
trialsint (default: 100)

Number of trials or EMD performance with added noise.

noise_widthfloat (default: 0.05)

Standard deviation of Gaussian noise (\(\hat\sigma\)). It’s relative to absolute amplitude of the signal, i.e. \(\hat\sigma = \sigma\cdot|\max(S)-\min(S)|\), where \(\sigma\) is noise_width.

ext_EMDEMD (default: None)

One can pass EMD object defined outside, which will be used to compute IMF decompositions in each trial. If none is passed then EMD with default options is used.

parallelbool (default: False)

Flag whether to use multiprocessing in EEMD execution. Since each EMD(s+noise) is independent this should improve execution speed considerably. Note that it’s disabled by default because it’s the most common problem when EEMD takes too long time to finish. If you set the flag to True, make also sure to set processes to some reasonable value.

processesint or None (optional)

Number of processes harness when executing in parallel mode. The value should be between 1 and max that depends on your hardware.

separate_trendsbool (default: False)

Flag whether to isolate trends from each EMD decomposition into a separate component. If true, the resulting EEMD will contain ensemble only from IMFs and the mean residue will be stacked as the last element.

References

[Wu2009]

Z. Wu and N. E. Huang, “Ensemble empirical mode decomposition: A noise-assisted data analysis method”, Advances in Adaptive Data Analysis, Vol. 1, No. 1 (2009) 1-41.

property all_imfs

A dictionary with all computed imfs per given order.

eemd(S: ndarray, T: ndarray | None = None, max_imf: int = -1, progress: bool = False) ndarray[source]

Performs EEMD on provided signal.

For a large number of iterations defined by trials attr the method performs emd() on a signal with added white noise.

Parameters:
Snumpy array,

Input signal on which EEMD is performed.

Tnumpy array or None, (default: None)

If none passed samples are numerated.

max_imfint, (default: -1)

Defines up to how many IMFs each decomposition should be performed. By default (negative value) it decomposes all IMFs.

Returns:
eIMFnumpy array

Set of ensemble IMFs produced from input signal. In general, these do not have to be, and most likely will not be, same as IMFs produced using EMD.

emd(S: ndarray, T: ndarray, max_imf: int = -1) ndarray[source]

Vanilla EMD method.

Provides emd evaluation from provided EMD class. For reference please see PyEMD.EMD.

ensemble_count() List[int][source]

Count of imfs observed for given order, e.g. 1st proto-imf, in the whole ensemble.

ensemble_mean() ndarray[source]

Pointwise mean over computed ensemble. Same as the output of eemd() method.

ensemble_std() ndarray[source]

Pointwise standard deviation over computed ensemble.

generate_noise(scale: float, size: int | Sequence[int]) ndarray[source]

Generate noise with specified parameters. Currently supported distributions are:

  • normal with std equal scale.

  • uniform with range [-scale/2, scale/2].

Parameters:
scalefloat

Width for the distribution.

sizeint

Number of generated samples.

Returns:
noisenumpy array

Noise sampled from selected distribution.

get_imfs_and_residue() Tuple[ndarray, ndarray][source]

Provides access to separated imfs and residue from recently analysed signal.

Returns:
(imfs, residue)(np.ndarray, np.ndarray)

Tuple that contains all imfs and a residue (if any).

noise_seed(seed: int) None[source]

Set seed for noise generation.