pysdkit.vncmd#

Created on Sat Mar 8 21:45:02 2024 @author: Whenxuan Wang @email: wwhenxuan@gmail.com

pysdkit._vncmd.vncmd

Created on Sat Mar 18 12:11:34 2024 @author: Whenxuan Wang @email: wwhenxuan@gmail.com

pysdkit._vncmd.incmd

Created on 2025/02/12 12:31:39 @author: Whenxuan Wang @email: wwhenxuan@gmail.com

vncmd.vncmd#

Created on Sat Mar 18 12:11:34 2024 @author: Whenxuan Wang @email: wwhenxuan@gmail.com

MATLAB code source https://www.mathworks.com/matlabcentral/fileexchange/64292-variational-nonlinear-chirp-mode-decomposition

class pysdkit._vncmd.vncmd.VNCMD(eIF: ~numpy.ndarray | None = None, fs: float | None = None, alpha: float = 0.0003, beta: float = 1e-09, var: float = 1.0, max_iter: int = 300, tol: float = 1e-05, dtype: ~numpy.dtype = <class 'numpy.float64'>)[source]#

Bases: Base

Variational Nonlinear Chirp Mode Decomposition

Chen S, Dong X, Peng Z, et al. Nonlinear chirp mode decomposition: A variational method[J]. IEEE Transactions on Signal Processing, 2017, 65(22): 6024-6037.

__annotations__ = {}#
__call__(signal: ndarray, eIF: ndarray | None = None)[source]#

allow instances to be called like functions

__init__(eIF: ~numpy.ndarray | None = None, fs: float | None = None, alpha: float = 0.0003, beta: float = 1e-09, var: float = 1.0, max_iter: int = 300, tol: float = 1e-05, dtype: ~numpy.dtype = <class 'numpy.float64'>)[source]#
Parameters:
  • eIF – initial instantaneous frequency (IF) time series for all the signal modes; each row of eIF corresponds to the IF of each mode

  • fs – sampling frequency

  • alpha – penalty parameter controling the filtering bandwidth of VNCMD;the smaller the alpha is, the narrower the bandwidth would be

  • beta – penalty parameter controling the smooth degree of the IF increment during iterations;the smaller the beta is, the more smooth the IF increment would be

  • var – the variance of the Gaussian white noise; if we set var to zero, the noise variable u (see the following code) will be dropped.

  • max_iter – the maximum number of iterations

  • tol – tolerance of convergence criterion; typically 1e-7, 1e-8, 1e-9…

  • dtype – data types used by all operations

__module__ = 'pysdkit._vncmd.vncmd'#
__str__() str[source]#

Get the full name and abbreviation of the algorithm

differ(y: ndarray, delta: float) ndarray[source]#

Compute the derivative of a discrete time series y.

Parameters:
  • y – The input time series.

  • delta – The sampling time interval of y.

Returns:

numpy.ndarray: The derivative of the time series.

difference_matrix(N: int) ndarray[source]#

Constructs an NxN second-order difference matrix.

Parameters:

N – The size of the matrix.

Returns:

The second-order difference matrix.

fit_transform(signal: ndarray, eIF: ndarray | None = None)[source]#

Execute VNCMD algorithm for signal decomposition

Parameters:
  • signal – the time domain signal (1D numpy array) to be decomposed

  • eIF – initial instantaneous frequency (IF) time series for all the signal modes; each row of eIF corresponds to the IF of each mode

Returns:

  • IFmset: the collection of the obtained IF time series of all the signal modes at each iteration

  • smset: the collection of the obtained signal modes at each iteration

  • IA: the finally estimated instantaneous amplitudes of the obtained signal modes

init_K_N(eIF: ndarray | None) Tuple[int, int, ndarray][source]#

Initialize the frequency and get its size

static projec(vec: ndarray, var: float) ndarray[source]#

Projection operation.

Parameters:
  • vec – The vector for projection.

  • var – The variance of the noise.

Returns:

numpy.ndarray: The projected vector.

vncmd.incmd#

Created on 2025/02/12 12:31:39 @author: Whenxuan Wang @email: wwhenxuan@gmail.com

class pysdkit._vncmd.incmd.INCMD(K: int = 2, max_iter: int | None = 8000, rho: float | None = 0.001, mu: float | None = 0.0001, tol: float | None = 1e-06)[source]#

Bases: object

Iterative nonlinear chirp mode decomposition.

A novel method termed the INCMD is proposed to deal with nonlinear data, which The combines the framework of the HHT with that of the VNCMD. Using the INCMD, intra-wave modulations can be captured with high accuracy and strong noise-robustness. Extracted modulation features by the INCMD greatly help to detect and identify nonlinear systems.

Note: This algorithm is very sensitive to parameters. If you are not satisfied with the decomposition effect, please readjust the parameters K, max_iter, mu and rho to initialize the algorithm instance.

Tu, Guowei, Xingjian Dong, Shiqian Chen, Baoxuan Zhao, Lan Hu, and Zhike Peng. “Iterative Nonlinear Chirp Mode Decomposition: A Hilbert-Huang Transform-like Method in Capturing Intra-Wave Modulations of Nonlinear Responses.” Journal of Sound and Vibration 485 (October 2020): 115571. https://doi.org/10.1016/j.jsv.2020.115571.

Python code: sheadan/IterativeNCMD

_NCMD(signal: ndarray, time: ndarray, g_factor: ndarray, f_filter: ndarray) Tuple[ndarray, ndarray, ndarray, ndarray][source]#

Execute a nonlinear frequency modulation mode decomposition algorithm

__call__(signal: ndarray, time: ndarray | None = None, K: int | None = None, return_all: bool | None = False) Tuple[ndarray, ndarray, ndarray, ndarray] | ndarray[source]#

allow instances to be called like functions

__init__(K: int = 2, max_iter: int | None = 8000, rho: float | None = 0.001, mu: float | None = 0.0001, tol: float | None = 1e-06) None[source]#

Initialize the parameters of the Iterative nonlinear chirp mode decomposition algorithm.

Note:

This algorithm is very sensitive to parameters. If you are not satisfied with the decomposition effect, please readjust the parameters K, max_iter, mu and rho to initialize the algorithm instance.

Parameters:
  • K – The number of intrinsic mode functions obtained by decomposition, that is the number of sub-signals obtained by decomposition.

  • max_iter – Maximum number of iterations within one mode decomposition

  • rho – To initialize the g-mode prefactor

  • mu – The mean value used to initialize the filter

  • tol – Maximum tolerance of the algorithm

__module__ = 'pysdkit._vncmd.incmd'#
__str__() str[source]#

Get the full name and abbreviation of the algorithm

__weakref__#

list of weak references to the object (if defined)

static _compute_mode(phi_1: ndarray, g_d1: ndarray, phi_2: ndarray, g_d2: ndarray) ndarray[source]#

Compute and return the estimated signal from mode g_k

static _compute_new_f(g1: ndarray, g2: ndarray, old_f: ndarray, time: ndarray, f_filter: ndarray) ndarray[source]#

Get a new filter based on the input of the original filter

static _compute_new_g(signal: ndarray, phi: ndarray, g_factor: ndarray) ndarray[source]#

Compute the phi^T phi term (which, for diagonal phi is diag(phi) squared)

static _compute_new_phi_1(new_f: ndarray, time: ndarray) ndarray[source]#

Compute new phi_1

static _compute_new_phi_2(new_f: ndarray, time: ndarray) ndarray[source]#

Compute new phi_2

static _get_D_matrix(signal: ndarray) ndarray[source]#

Get a D matrix that’s sized n x n for a given signal of length n

static _welch_method_estimate(signal: ndarray, time: ndarray) ndarray[source]#

Create an initial estimate on the frequency vector using the Welch PSD method

fit_transform(signal: ndarray, time: ndarray | None = None, K: int | None = None, return_all: bool | None = False) Tuple[ndarray, ndarray, ndarray, ndarray] | ndarray[source]#

Start executing the INCMD algorithm for signal decomposition.

Note:

This algorithm is very sensitive to parameters. If you are not satisfied with the decomposition effect, please readjust the parameters K, max_iter, mu and rho to initialize the algorithm instance.

Parameters:
  • signal – The input numpy ndarray 1D univariate signal

  • time – Timestamp array for the input signal, initialized by the length of the signal if not specified explicitly

  • K – The number of modes to be decomposed. If not explicitly specified in the fit_transform method, the default parameter when creating the instance is used.

  • return_all – Whether to return all information about the decomposition process

Returns:

The intrinsic mode function obtained by signal decomposition