LowRank.LowRankInfo

LowRank.LowRankInfo#

LowRank.LowRankInfo.py

This module contains the class LowRankInfo, which is used to store information about the components of a SecSaxsData, which is mathematically interpreted as a low rank approximation of a matrix.

get_denoised_data(D, rank=3, svd=None)#

Get the denoised data by low rank approximation using SVD.

Parameters:
  • D (2D array-like) – The data matrix to be denoised.

  • rank (int, optional) – The rank for the low rank approximation, by default 3.

  • svd (tuple or None, optional) – Precomputed SVD (U, s, VT) to use instead of computing it again

Returns:

D_ – The denoised data matrix.

Return type:

2D array-like

compute_lowrank_matrices(M, ccurves, E, ranks, **kwargs)#

Compute the matrices for the low rank approximation. The low rank approximation is computed using the formula:

M_ = P @ C

where M_ is the denoised data matrix, P is the projected matrix, and C is the component matrix. :param M: The data matrix to be approximated. :type M: 2D array-like :param ccurves: The list of component curves. :type ccurves: list of ComponentCurve :param E: The error matrix corresponding to M. It can be None if errors are not available. :type E: 2D array-like or None :param ranks: The list of ranks for each component curve. If None, all ranks are assumed to be 1. :type ranks: list of int or None :param kwargs: Additional keyword arguments for the low rank approximation.

Possible keys include:
  • svd_rank: int or None

    The rank for the SVD used in the low rank approximation. If None, it will be set to the sum of ranks.

Returns:

  • M_ (2D array-like) – The denoised data matrix.

  • C (2D array-like) – The concentration matrix.

  • P (2D array-like) – The spectral factor matrix.

  • Pe (2D array-like or None) – The propagated error matrix corresponding to P. It can be None if E is None.