Skip to content

Commit

Permalink
Amend eps further.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeZiminski committed Nov 12, 2024
1 parent 14c83af commit 0070301
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/spikeinterface/preprocessing/whiten.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,9 @@ def compute_whitening_matrix(
# type and we estimate a more reasonable eps in the case
# where the data is on a scale less than 1.
if eps is None:
if data.dtype.kind == "f":
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
else:
eps = 1e-8
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

if mode == "global":
W = compute_whitening_from_covariance(cov, eps)
Expand Down

0 comments on commit 0070301

Please sign in to comment.