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:
trials : int (default: 100)

Number of trials or EMD performance with added noise.

epsilon : float (default: 0.005)

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

ext_EMD : EMD (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.

parallel : bool (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.

processes : int 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_scale : float (default: 1)

Scale (amplitude) of the added noise.

noise_kind : str (default: “normal”)

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

range_thr : float (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_thr : float (default: 0.05)

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

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: numpy.ndarray, T: Optional[numpy.ndarray] = None, max_imf: int = -1) → numpy.ndarray[source]

Perform CEEMDAN decomposition.

Parameters:
S : numpy array

Original signal on which CEEMDAN is to perform.

T : Optional(numpy array) (default: None)

Time (x) values for the signal. If not passed, i.e. T = None, then it’s assumed that values are equidistant.

max_imf : int (default: -1)

Maximum number of components to extract.

Returns:
components : np.ndarray

CEEMDAN components.

emd(S: numpy.ndarray, T: Optional[numpy.ndarray] = None, max_imf: int = -1) → numpy.ndarray[source]

Vanilla EMD method.

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

end_condition(S: numpy.ndarray, cIMFs: numpy.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:
S : numpy array

Original signal on which CEEMDAN was performed.

cIMFs : numpy 2D array

Set of cIMFs where each row is cIMF.

max_imf : int

The maximum number of imfs to extract.

Returns:
end : bool

Whether to stop CEEMDAN.

generate_noise(scale: float, size: Union[int, Sequence[int]]) → numpy.ndarray[source]

Generate noise with specified parameters. Currently supported distributions are:

  • normal with std equal scale.
  • uniform with range [-scale/2, scale/2].
Parameters:
scale : float

Width for the distribution.

size : int or shape

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

Returns:
noise : numpy array

Noise sampled from selected distribution.

get_imfs_and_residue() → Tuple[numpy.ndarray, numpy.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.