Skip to content

Commit de52674

Browse files
committed
Add seed to whiten function
1 parent 9d0f15b commit de52674

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/spikeinterface/preprocessing/tests/test_whiten.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def get_test_recording(self, dtype, means=None):
5656

5757
return means, cov_mat, recording
5858

59-
def get_test_data_with_known_distribution(self, num_samples, dtype, means=None):
59+
def get_test_data_with_known_distribution(self, num_samples, dtype, means=None, seed=0):
6060
"""
6161
Create multivariate normal data with known means and covariance matrixs.
6262
If `dtype` is int16, scale to full range of int16 before cast.
@@ -68,7 +68,8 @@ def get_test_data_with_known_distribution(self, num_samples, dtype, means=None):
6868

6969
cov_mat = np.array([[1, 0.5, 0], [0.5, 1, -0.25], [0, -0.25, 1]])
7070

71-
data = np.random.multivariate_normal(means, cov_mat, num_samples)
71+
rng = np.random.RandomState(seed)
72+
data = rng.multivariate_normal(means, cov_mat, num_samples)
7273

7374
# Set the dtype, if `int16`, first scale to +/- 1 then cast to int16 range.
7475
if dtype == np.float32:

0 commit comments

Comments
 (0)