Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_covariances():
"""Test covariance for multiple estimator"""
x = np.random.randn(2, 3, 100)
cov = covariances(x)
cov = covariances(x, estimator='oas')
cov = covariances(x, estimator='lwf')
cov = covariances(x, estimator='scm')
cov = covariances(x, estimator='corr')
cov = covariances(x, estimator='mcd')
cov = covariances(x, estimator=np.cov)
assert_raises(ValueError, covariances, x, estimator='truc')
def test_covariances():
"""Test covariance for multiple estimator"""
x = np.random.randn(2, 3, 100)
cov = covariances(x)
cov = covariances(x, estimator='oas')
cov = covariances(x, estimator='lwf')
cov = covariances(x, estimator='scm')
cov = covariances(x, estimator='corr')
cov = covariances(x, estimator='mcd')
cov = covariances(x, estimator=np.cov)
assert_raises(ValueError, covariances, x, estimator='truc')
def test_covariances():
"""Test covariance for multiple estimator"""
x = np.random.randn(2, 3, 100)
cov = covariances(x)
cov = covariances(x, estimator='oas')
cov = covariances(x, estimator='lwf')
cov = covariances(x, estimator='scm')
cov = covariances(x, estimator='corr')
cov = covariances(x, estimator='mcd')
cov = covariances(x, estimator=np.cov)
assert_raises(ValueError, covariances, x, estimator='truc')
"""
if isinstance(self.delays, int):
delays = range(1, self.delays)
else:
delays = self.delays
X2 = []
for x in X:
tmp = x
for d in delays:
tmp = numpy.r_[tmp, numpy.roll(x, d, axis=-1)]
X2.append(tmp)
X2 = numpy.array(X2)
covmats = covariances(X2, estimator=self.estimator)
return covmats
def transform(self, X):
"""Estimate covariance matrices.
Parameters
----------
X : ndarray, shape (n_trials, n_channels, n_samples)
ndarray of trials.
Returns
-------
covmats : ndarray, shape (n_trials, n_channels, n_channels)
ndarray of covariance matrices for each trials.
"""
covmats = covariances(X, estimator=self.estimator)
return covmats