mdlearn.data.preprocess.decorrelation.spatial

Spatial decorrelation functions.

Functions

SD2(data[, m, verbose])

Perform spatial decorrelation of 2nd order of real signals.

SD4(Y[, m, U, verbose])

SD4 - Spatial Decorrelation of 4th order of real signals.

mdlearn.data.preprocess.decorrelation.spatial.SD2(data: numpy.ndarray, m: Optional[int] = 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\)data is a 2nd order spatially whitened source extracted from the 3n x T data matrix data by performing PCA on m components of the real data. Y is a matrix of spatially uncorrelated components.

  • S (np.ndarray) – Eigen values of the data covariance matrix.

  • B (np.ndarray) – Eigen vectors of the data covariance matrix. The eigen vectors are orthogonal.

  • U (np.ndarray) – The sphering matrix used to transform data by \(Y = U \times\)data.

Raises
  • TypeError – If verbose is not of type bool.

  • TypeError – If data is not of type np.ndarray.

  • ValueError – If data does not have 2 dimensions.

  • ValueError – If m is greater than 3N, the second dimension of data.

mdlearn.data.preprocess.decorrelation.spatial.SD4(Y: numpy.ndarray, m: Optional[int] = None, U: Optional[numpy.ndarray] = 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 T spatially whitened matrix (n subspaces, T samples). May be a numpy array or matrix where n is the number of subspaces we are interested in and T is 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 n components 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 m is greater than n, the first dimension of Y.