mdlearn.data.preprocess.decorrelation.spatial
Spatial decorrelation functions.
Functions
|
Perform spatial decorrelation of 2nd order of real signals. |
|
SD4 - Spatial Decorrelation of 4th order of real signals. |
- mdlearn.data.preprocess.decorrelation.spatial.SD2(data: numpy.ndarray, m: int | None = None, verbose: bool = False)
Perform spatial decorrelation of 2nd order of real signals.
- Parameters:
data (np.ndarray) – data array of shape (T, 3N) where T is the number of frames in the MD trajectory, N is the number of atoms in the system and 3 is due to the x,y,z coordinates for each atom.
m (Optional[int], default=None) – Dimensionality of the subspace we are interested in. Default value is None, in which case m=n. If m is omitted, U is a square 3n x 3n matrix (as many sources as sensors).
verbose (bool, default=False) – Print progress.
- Returns:
Y (np.ndarray) – A 3n x m matrix U (NumPy matrix type), such that \(Y = U \times\)
datais a 2nd order spatially whitened source extracted from the 3n x T data matrixdataby performing PCA onmcomponents of the real data.Yis a matrix of spatially uncorrelated components.S (np.ndarray) – Eigen values of the
datacovariance matrix.B (np.ndarray) – Eigen vectors of the
datacovariance matrix. The eigen vectors are orthogonal.U (np.ndarray) – The sphering matrix used to transform
databy \(Y = U \times\)data.
- Raises:
TypeError – If
verboseis not of type bool.TypeError – If
datais not of type np.ndarray.ValueError – If
datadoes not have 2 dimensions.ValueError – If
mis greater than 3N, the second dimension ofdata.
- mdlearn.data.preprocess.decorrelation.spatial.SD4(Y: numpy.ndarray, m: int | None = None, U: numpy.ndarray | None = None, verbose: bool = False) numpy.ndarray
SD4 - Spatial Decorrelation of 4th order of real signals.
SD4 does joint diagonalization of cumulant matrices of order 4 to decorrelate the signals in spatial domain. It allows us to extract signals which are as independent as possible and which were not obtained while performing SD2. Here we consider signals which are spatially decorrelated of order 2, meaning that SD2 should be run first.
- Parameters:
Y (np.ndarray) – An
n x Tspatially whitened matrix (nsubspaces,Tsamples). May be a numpy array or matrix wherenis the number of subspaces we are interested in andTis the number of frames in the MD trajectory.m (Optional[int], default=None) – The number of subspaces we are interested in. Defaults to None, in which case m=k.
U (Optional[np.ndarray], default=None) – Whitening matrix obtained after doing the PCA analysis on
ncomponents of real data.verbose (bool, default=False) – Print progress.
- Returns:
W (np.ndarray) – Separating matrix which is spatially decorrelated of 4th order.
- Raises:
ValueError – If
mis greater thann, the first dimension ofY.