2.1.6.1.11. sf_tools.signal.svd module

SVD ROUTINES

This module contains methods for thresholding singular values.

Author:Samuel Farrens <samuel.farrens@gmail.com>
Version:1.2
Date:20/10/2017
sf_tools.signal.svd.find_n_pc(u, factor=0.5)[source]

Find number of principal components

This method finds the minimum number of principal components required

Parameters:
  • u (np.ndarray) – Left singular vector
  • factor (float, optional) – Factor for testing the auto correlation (default is ‘0.5’)
Returns:

Return type:

int number of principal components

sf_tools.signal.svd.svd_thresh(data, threshold=None, n_pc=None, thresh_type='hard')[source]

Threshold the singular values

This method thresholds the input data using singular value decomposition

Parameters:
  • data (np.ndarray) – Input data array
  • threshold (float, optional) – Threshold value
  • n_pc (int or str, optional) – Number of principal components, specify an integer value or ‘all’
  • threshold_type (str {'hard', 'soft'}) – Type of noise to be added (default is ‘hard’)
Returns:

Return type:

np.ndarray thresholded data

Raises:

ValueError – For invalid string entry for n_pc

sf_tools.signal.svd.svd_thresh_coef(data, operator, threshold, thresh_type='hard')[source]

Threshold the singular values coefficients

This method thresholds the input data using singular value decomposition

Parameters:
  • data (np.ndarray) – Input data array
  • operator (class) – Operator class instance
  • threshold (float, optional) – Threshold value
  • threshold_type (str {'hard', 'soft'}) – Type of noise to be added (default is ‘hard’)
Returns:

Return type:

np.ndarray thresholded data

Raises:

ValueError – For invalid string entry for n_pc