Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update get_covmat.py #26

Merged
merged 10 commits into from
Apr 4, 2023
Merged
Prev Previous commit
Next Next commit
🎨 Format Python code with psf/black (#37)
Co-authored-by: gcattan <gcattan@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and gcattan authored Apr 4, 2023
commit 8cc1f912126c887314daa61093bccbfbc387559a
5 changes: 3 additions & 2 deletions covmatest/get_covmat.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

_instance = None


def get_covmat(n_trials, n_channels, seed=None):
"""Get a set of covariance matrices.

Expand All @@ -40,7 +41,7 @@ def get_covmat(n_trials, n_channels, seed=None):
-------
covset : ndarray of int, shape (n_matrices, n_channels, n_channels)
A set of covariance matrices.
"""
"""
global _instance
if _instance is None:
_instance = CovmatGen(seed)
Expand Down Expand Up @@ -71,7 +72,7 @@ class CovmatGen:
"""

def __init__(self, seed=None):
if(not seed == None):
if not seed == None:
random.seed(seed)
self._seed = seed
self._dataset = AlphaWaves(useMontagePosition=False)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_get_covmat.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def test_is_spd(is_spd):


def test_seed():
covmat1 = get_covmat(1, 1, 42)
covmat1bis = get_covmat(1, 1, 42)
covmat2 = get_covmat(1, 1, 43)
assert not covmat1[0][0] == covmat2[0][0]
assert covmat1[0][0] == covmat1bis[0][0]
covmat1 = get_covmat(1, 1, 42)
covmat1bis = get_covmat(1, 1, 42)
covmat2 = get_covmat(1, 1, 43)
assert not covmat1[0][0] == covmat2[0][0]
assert covmat1[0][0] == covmat1bis[0][0]