emd.sift.mask_sift#

emd.sift.mask_sift(X, mask_amp=1, mask_amp_mode='ratio_sig', mask_freqs='zc', mask_step_factor=2, ret_mask_freq=False, max_imfs=9, sift_thresh=1e-08, nphases=4, nprocesses=1, verbose=None, imf_opts=None, envelope_opts=None, extrema_opts=None)[source]#

Compute Intrinsic Mode Functions using a mask sift.

This function implements a masked sift from a dataset using a set of masking signals to reduce mixing of components between modes [1], multiple masks of different phases can be applied when isolating each IMF [2].

This function can either compute the mask frequencies based on the fastest dynamics in the data (the properties of the first IMF from a standard sift) or apply a pre-specified set of masks.

Parameters:
Xndarray

1D input array containing the time-series data to be decomposed

mask_ampfloat or array_like

Amplitude of mask signals as specified by mask_amp_mode. If float the same value is applied to all IMFs, if an array is passed each value is applied to each IMF in turn (Default value = 1)

mask_amp_mode{‘abs’,’ratio_imf’,’ratio_sig’}

Method for computing mask amplitude. Either in absolute units (‘abs’), or as a ratio of the standard deviation of the input signal (‘ratio_sig’) or previous imf (‘ratio_imf’) (Default value = ‘ratio_imf’)

mask_freqs{‘zc’,’if’,float,,array_like}

Define the set of mask frequencies to use. If ‘zc’ or ‘if’ are passed, the frequency of the first mask is taken from either the zero-crossings or instantaneous frequnecy the first IMF of a standard sift on the data. If a float is passed this is taken as the first mask frequency. Subsequent masks are defined by the mask_step_factor. If an array_like vector is passed, the values in the vector will specify the mask frequencies.

mask_step_factorfloat

Step in frequency between successive masks (Default value = 2)

mask_type{‘all’,’sine’,’cosine’}

Which type of masking signal to use. ‘sine’ or ‘cosine’ options return the average of a +ve and -ve flipped wave. ‘all’ applies four masks: sine and cosine with +ve and -ve sign and returns the average of all four.

nphasesint > 0

The number of separate sinusoidal masks to apply for each IMF, the phase of masks are uniformly spread across a 0<=p<2pi range (Default=4).

ret_mask_freqbool

Boolean flag indicating whether mask frequencies are returned (Default value = False)

max_imfsint

The maximum number of IMFs to compute. (Default value = None)

sift_threshfloat

The threshold at which the overall sifting process will stop. (Default value = 1e-8)

Returns:
imfndarray

2D array [samples x nimfs] containing he Intrisic Mode Functions from the decomposition of X.

mask_freqsndarray

1D array of mask frequencies, if ret_mask_freq is set to True.

Other Parameters:
imf_optsdict

Optional dictionary of keyword arguments to be passed to emd.get_next_imf

envelope_optsdict

Optional dictionary of keyword options to be passed to emd.interp_envelope

extrema_optsdict

Optional dictionary of keyword options to be passed to emd.get_padded_extrema

verbose{None,’CRITICAL’,’WARNING’,’INFO’,’DEBUG’}

Option to override the EMD logger level for a call to this function.

Notes

Here are some example mask_sift variants you can run:

A mask sift in which the mask frequencies are determined with zero-crossings and mask amplitudes by a ratio with the amplitude of the previous IMF (note - this is also the default):

>>> imf = emd.sift.mask_sift(X, mask_amp_mode='ratio_imf', mask_freqs='zc')

A mask sift in which the first mask is set at .4 of the sampling rate and subsequent masks found by successive division of this mask_freq by 3:

>>> imf = emd.sift.mask_sift(X, mask_freqs=.4, mask_step_factor=3)

A mask sift using user specified frequencies and amplitudes:

>>> mask_freqs = np.array([.4,.2,.1,.05,.025,0])
>>> mask_amps = np.array([2,2,1,1,.5,.5])
>>> imf = emd.sift.mask_sift(X, mask_freqs=mask_freqs, mask_amp=mask_amps, mask_amp_mode='abs')

References

[1]

Ryan Deering, & James F. Kaiser. (2005). The Use of a Masking Signal to Improve Empirical Mode Decomposition. In Proceedings. (ICASSP ’05). IEEE International Conference on Acoustics, Speech, and Signal Processing, 2005. IEEE. https://doi.org/10.1109/icassp.2005.1416051

[2]

Tsai, F.-F., Fan, S.-Z., Lin, Y.-S., Huang, N. E., & Yeh, J.-R. (2016). Investigating Power Density and the Degree of Nonlinearity in Intrinsic Components of Anesthesia EEG by the Hilbert-Huang Transform: An Example Using Ketamine and Alfentanil. PLOS ONE, 11(12), e0168108. https://doi.org/10.1371/journal.pone.0168108