mlpsvd#

torchspin.mlpsvd(data, time, method='ss', order='mdl', method2d='sum')[source]#

Perform 2D Linear Prediction SVD on spectral data.

Parameters:
  • data (ndarray, shape (N,) or (nSpectra, N)) – Input data. N must match len(time).

  • time (ndarray, shape (N,)) – Time vector.

  • method ({'ss', 'kt', 'tls'}) –

    LPSVD algorithm:

    • 'ss' — state-space (default) [2, 3]

    • 'kt' — Kumaresan-Tufts [1]

    • 'tls' — Hankel total least squares [4]

  • order (int or {'mdl', 'aic'}) – Model order (number of sinusoidal components). 'mdl' (default) or 'aic' for automatic estimation [5].

  • method2d ({'sum', 'stack'}) –

    Method for handling multiple spectra:

    • 'sum' — sum of time series for pole determination (default)

    • 'stack' — stacked Hankel matrices

Returns:

  • y (ndarray, same shape as *data*) – Predicted spectrum.

  • parameters (MLPSVDResult) – Fitted parameters (damping, frequency, amplitude, phase, model).

Return type:

tuple[ndarray, MLPSVDResult]

Examples

>>> t = np.linspace(0, 1, 256)
>>> sig = 2*np.exp(-3*t)*np.cos(2*np.pi*50*t) + np.random.randn(256)*0.1
>>> y, params = mlpsvd(sig, t)
>>> print(params.frequency)