pyeeg.preprocess.Whitener.compute_rotation
- Whitener.compute_rotation(C=None)
Compute the whitening rotation matrix from the (stored) covariance.
The eigenvalues/eigenvectors of the covariance matrix (either
self.sigmaor the providedC) are used to build the whitening matrixW. PCA whitening usesW = diag(1/sqrt(eigval)) @ eigvec.Tand ZCA whitening usesW = eigvec @ diag(1/sqrt(eigval)) @ eigvec.T.- Parameters:
C (ndarray (nchannels, nchannels), optional) – Covariance matrix to diagonalize. If None,
self.sigma(as computed bycov()) is used.- Returns:
Stores
self.scale,self.Uandself.Win place.- Return type:
None
- Raises:
AssertionError – If
self.sigmahas not been computed yet andCis None.