spher#

spher(data)#

Return the sphering (whitening) matrix for the given data.

Ports EEGLAB’s spher.m: 2 * inv(sqrtm(cov(data.T))). The result is a symmetric matrix S that whitens the channel covariance C = cov(data.T) so that S @ C @ S.T == 4 * I.

Parameters:

data (Any) – 2-D array shaped (channels, samples).

Returns:

The (channels, channels) sphering matrix.

Return type:

ndarray