pysdkit.lmd#
Created on 2025/01/31 21:35:05 @author: Whenxuan Wang @email: wwhenxuan@gmail.com
Created on 2025/01/31 21:35:18 @author: Whenxuan Wang @email: wwhenxuan@gmail.com |
|
Created on 2025/01/31 23:33:43 @author: Whenxuan Wang @coauthor: Wentong Zhao @email: wwhenxuan@gmail.com |
lmd.lmd#
Created on 2025/01/31 21:35:18 @author: Whenxuan Wang @email: wwhenxuan@gmail.com
- class pysdkit._lmd.lmd.LMD(K: int = 5, endpoints: bool = True, max_smooth_iter: int = 15, max_envelope_iter: int = 200, envelope_epsilon: float = 0.01, convergence_epsilon: float = 0.01, min_extrema: int = 5)[source]#
Bases:
objectLocal Mean Decomposition
Jia, Linshan, et al. “The Empirical Optimal Envelope and Its Application to Local Mean Decomposition.” Digital Signal Processing, vol. 87, Elsevier BV, Apr. 2019, pp. 166–77, doi:10.1016/j.dsp.2019.01.024.
Python code: shownlin/PyLMD
MATLAB code: https://www.mathworks.com/matlabcentral/fileexchange/107829-local-mean-decomposition?s_tid=srchtitle
- __call__(signal: ndarray, K: int | None = None) ndarray[source]#
allow instances to be called like functions
- __init__(K: int = 5, endpoints: bool = True, max_smooth_iter: int = 15, max_envelope_iter: int = 200, envelope_epsilon: float = 0.01, convergence_epsilon: float = 0.01, min_extrema: int = 5) None[source]#
- Parameters:
K – the maximum number of IFMs to be decomposed
endpoints – whether to treat the endpoint of the signal as a pseudo-extreme point
max_smooth_iter – maximum number of iterations of moving average algorithm
max_envelope_iter – maximum number of iterations when separating local envelope signals
envelope_epsilon – terminate processing when obtaining pure FM signal
convergence_epsilon – terminate processing when modulation signal converges
min_extrema – minimum number of local extrema
- __module__ = 'pysdkit._lmd.lmd'#
- __weakref__#
list of weak references to the object (if defined)
- extract_product_function(signal: ndarray) ndarray[source]#
Perform one time local mean decomposition algorithm
- fit_transform(signal: ndarray, K: int | None = None) ndarray[source]#
Signal decomposition using Local Mean Decomposition (LMD) algorithm
- Parameters:
signal – the time domain signal (1D numpy array) to be decomposed
K – the maximum number of IFMs to be decomposed
- Returns:
IMFs
- is_monotonous(signal: ndarray) bool[source]#
Determine whether the signal is a (non-strict) monotone sequence
- static is_monotonous_decrease(signal: ndarray) bool[source]#
Determine whether the input signal is monotonically decreasing
- static is_monotonous_increase(signal: ndarray) bool[source]#
Determine whether the input signal is monotonically increasing
lmd.rlmd#
Created on 2025/01/31 23:33:43 @author: Whenxuan Wang @coauthor: Wentong Zhao @email: wwhenxuan@gmail.com
- class pysdkit._lmd.rlmd.RLMD(max_imfs: int | None = 10, max_iter: int | None = 30, smooth_mode: str | None = 'ma', ma_span: str | None = 'liu', ma_iter_mode: str | None = 'fixed', stop_threshold: Tuple[float, float, float] | None = (0.005, 0.7, 0.005), extd_r: float | None = 0.2, sifting_stopping_mode: str | None = 'liu', min_peak: int | None = 3, min_ratio: float | None = 0.001)[source]#
Bases:
objectRobust Local Mean Decomposition
The RLMD is an improved local mean decomposition powered by a set of optimization strategies. The optimization strategies can deal with boundary condition, envelope estimation, and sifting stopping criterion in the LMD. It simultaneously extracts a set of mono-component signals (called product functions) and their associated demodulation signals (i.e. AM signal and FM signal) from a mixed signal, which is the most attracting feature comparing with other adaptive signal processing methods, such as the EMD. The RLMD can be used for time-frequency analysis.
Zhiliang Liu, Yaqiang Jin, Ming J. Zuo, and Zhipeng Feng. Time-frequency representation based on robust local mean decomposition for multi-component AM-FM signal analysis. Mechanical Systems and Signal Processing. 95: 468-487, 2017. Liu Zhiliang (2025). Robust Local Mean Decomposition (RLMD) (https://www.mathworks.com/matlabcentral/fileexchange/66935-robust-local-mean-decomposition-rlmd), MATLAB Central File Exchange. Retrieved July 13, 2025.
- __call__(signal: ndarray, return_all: bool | None = False) ndarray[source]#
Allow instances to be called like functions
- __init__(max_imfs: int | None = 10, max_iter: int | None = 30, smooth_mode: str | None = 'ma', ma_span: str | None = 'liu', ma_iter_mode: str | None = 'fixed', stop_threshold: Tuple[float, float, float] | None = (0.005, 0.7, 0.005), extd_r: float | None = 0.2, sifting_stopping_mode: str | None = 'liu', min_peak: int | None = 3, min_ratio: float | None = 0.001)[source]#
The above parameters are the default parameters of the algorithm. Please modify and adjust them according to the specific data when using them.
- Parameters:
max_imfs – Maximum number of intrinsic mode functions to be decomposed.
max_iter – max iteration number in a PF sifting process.
smooth_mode – ma - moving average, spline - pchip.
ma_span – pdmax span method, see function ma_span.
ma_iter_mode – fixed or dynamic span for iterate ma.
stop_threshold – sifting stopping thresholds for Rilling’s criterion.
extd_r – end extension length to original data.
sifting_stopping_mode – the sifting stoppling optimizaion.
min_peak – When the number of remaining extreme points of the input signal is less than a certain value, the algorithm stops iterating.
min_ratio – When the energy of the remaining signal is less than a certain value, the algorithm stops iterative updating.
- __module__ = 'pysdkit._lmd.rlmd'#
- __weakref__#
list of weak references to the object (if defined)
- _get_best_span(ind_extr: ndarray, x: ndarray) Tuple[ndarray | int, int][source]#
Moving average span selection. Return the best span of moving average
- Parameters:
ind_extr – indices of extremum of x
x – the input signal to be decomposed.
- Returns:
span : int, Optimal moving-average span (always odd).
smax : int, Maximum step between consecutive extrema.
- _initial_inputs(signal: ndarray) Tuple[ndarray | float, ndarray, ndarray, ndarray, ndarray, ndarray][source]#
- _is_sifting_stopping(a_j: ndarray, j: ndarray, fv_i: ndarray) Tuple[bool, ndarray][source]#
Sifting stopping criterion of Robust Local Mean Decomposition.
- _itrma(x: ndarray, span: int, smax: int) ndarray[source]#
Iterative moving average dynamic step.
- Parameters:
x – the input signal to be decomposed.
span – int, moving-average span (always odd).
smax – Maximum step between consecutive extrema.
- Returns:
get the iterative moving average of the input signal.
- _lmd_mean_amp(x: ndarray) Tuple[ndarray, ndarray, ndarray | int][source]#
Compute mean function and amplitude function of x in LMD
- Parameters:
x – the input signal.
- Returns:
the results of mean iterative moving average
- _stop_lmd(signal: ndarray, signal_energy: ndarray | float) bool[source]#
Stopping criterion of LMD algorithm. Check if there are enough (3) extrema to continue the decomposition
- Parameters:
signal – The original input signal or the residual component of the signal
signal_energy – The energy of the original signal
- Returns:
- fit_transform(signal: ndarray, return_all: bool | None = False) ndarray | Tuple[ndarray, ndarray, ndarray][source]#
This funcion perform the local mean decompose (LMD) on the input signal, and return the product function (pfs), and their corresponding instantaneous amplititde(ams) and frequency modulation signal(fms).
- Parameters:
signal – 1D ndarray input signal to be decomposed.
return_all – whether to return all information in the decomposition loop.
- Returns:
the decomposition result of the input 1D ndarray signal by Local Mean Decomposition.