CEEMDAN

Info

Complete ensemble EMD with adaptive noise (CEEMDAN) performs an EEMD with the difference that the information about the noise is shared among all workers.

Note

Given the nature of CEEMDAN, 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 and different. To make the decomposition reproducible, one needs to set a seed for the random number generator used in CEEMDAN. This is done using PyEMD.CEEMDAN.noise_seed() method on the instance.

Class

class PyEMD.CEEMDAN(trials: int = 100, epsilon: float = 0.005, ext_EMD=None, parallel: bool = False, **kwargs)[source]

“Complete Ensemble Empirical Mode Decomposition with Adaptive Noise”

“Complete ensemble empirical mode decomposition with adaptive noise” (CEEMDAN) [Torres2011] is noise-assisted EMD technique. Word “complete” presumably refers to decomposing completely everything, even added perturbation (noise).

Provided implementation contains proposed “improvements” from paper [Colominas2014].

Any parameters can be updated directly on the instance or passed through a configuration dictionary.

Goodness of the decomposition can be configured by modifying threshold values. Two are range_thr and total_power_thr which relate to the value range (max - min) and check for total power below, respectively.

Configuration can be passed through keyword parameters. For example, updating threshold would be through:

Example:

>>> ceemdan = CEEMDAN(range_thr=0.001, total_power_thr=0.01)

To perform the decomposition one can either use directly initiated object, or use the ceemdan method. The following two lines produce the same output:

>>> ceemdan = CEEMDAN()
>>> c_imfs = ceemdan(signal)
>>> c_imfs = ceemdan.ceemdan(signal)

Note that some decompositions can take a while to complete. Please check docs to some tricks on how to improve performance.

Parameters:
trialsint (default: 100)

Number of trials or EMD performance with added noise.

epsilonfloat (default: 0.005)

Scale for added noise (\(\epsilon\)) which multiply std \(\sigma\): \(\beta = \epsilon \cdot \sigma\)

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 CEEMDAN 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.

noise_scalefloat (default: 1)

Scale (amplitude) of the added noise.

noise_kindstr (default: “normal”)

What type of noise to add. Allowed are “normal” (default) and “uniform”.

range_thrfloat (default: 0.01)

Range threshold used as an IMF check. The value is in percentage compared to initial signal’s amplitude. If absolute amplitude (max - min) is below the range_thr then the decomposition is finished.

total_power_thrfloat (default: 0.05)

Signal’s power threshold. Finishes decomposition if sum(abs(r)) < thr.

beta_progressbool (default: True)

Flag whether to scale all noise IMFs by their 1st IMF’s standard deviation.

References

[Torres2011]

M.E. Torres, M.A. Colominas, G. Schlotthauer, P. Flandrin A complete ensemble empirical mode decomposition with adaptive noise. Acoustics, Speech and Signal Processing (ICASSP), 2011, pp. 4144–4147

[Colominas2014]

M.A. Colominas, G. Schlotthauer, M.E. Torres, Improved complete ensemble EMD: A suitable tool for biomedical signal processing, In Biomed. Sig. Proc. and Control, V. 14, 2014, pp. 19–29

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

Perform CEEMDAN decomposition.

Parameters:
Snumpy array

Original signal on which CEEMDAN is to perform.

TOptional(numpy array) (default: None)

Time (x) values for the signal. If not passed, i.e. T = None, then assumes equidistant values.

max_imfint (default: -1)

Maximum number of components to extract.

progressbool (default: False)

Whether to print out ‘.’ every 1s to indicate progress.

Returns:
componentsnp.ndarray

CEEMDAN components.

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

Vanilla EMD method.

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

end_condition(S: ndarray, cIMFs: ndarray, max_imf: int) bool[source]

Test for end condition of CEEMDAN.

Procedure stops if:

  • number of components reach provided max_imf, or

  • last component is close to being pure noise (range or power), or

  • set of provided components reconstructs sufficiently input.

Parameters:
Snumpy array

Original signal on which CEEMDAN was performed.

cIMFsnumpy 2D array

Set of cIMFs where each row is cIMF.

max_imfint

The maximum number of imfs to extract.

Returns:
endbool

Whether to stop CEEMDAN.

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 or shape

Shape of the noise that is added. In case of int an array of that len is generated.

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. :return: (imfs, residue)

noise_seed(seed: int) None[source]

Set seed for noise generation.