Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 4, 2023
1 parent 6c57b5c commit 39ef079
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/spikeinterface/preprocessing/whiten.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ def __init__(
if M is not None:
M = np.asarray(M)
else:
W, M = compute_whitening_matrix(
recording, mode, random_chunk_kwargs, apply_mean, radius_um=radius_um
)
W, M = compute_whitening_matrix(recording, mode, random_chunk_kwargs, apply_mean, radius_um=radius_um)

BasePreprocessor.__init__(self, recording, dtype=dtype_)

Expand Down Expand Up @@ -175,11 +173,11 @@ def compute_whitening_matrix(recording, mode, random_chunk_kwargs, apply_mean, r
# whitening. We therefore check to see if the data is float
# type and we estimate a more reasonable eps in the case
# where the data is on a scale less than 1.
eps = 1e-6 # the default
eps = 1e-6 # the default
if data.dtype.kind == "f":
median_data_sqr = np.median(data ** 2) # use the square because cov (and hence S) scales as the square
median_data_sqr = np.median(data**2) # use the square because cov (and hence S) scales as the square
if median_data_sqr < 1 and median_data_sqr > 0:
eps = max(1e-16, median_data_sqr * 1e-3) # use a small fraction of the median of the squared data
eps = max(1e-16, median_data_sqr * 1e-3) # use a small fraction of the median of the squared data

if mode == "global":
U, S, Ut = np.linalg.svd(cov, full_matrices=True)
Expand Down

0 comments on commit 39ef079

Please sign in to comment.