Skip to content

Commit

Permalink
Bugfix: zeros in thFFTspec
Browse files Browse the repository at this point in the history
replace zeros with eps to avoid inf when logging
  • Loading branch information
ryanharvey1 committed Nov 20, 2024
1 parent 64c7f63 commit fa32263
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions brainStates/SleepScoreMaster/PickSWTHChannel_km.m
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@
specdt = mode(diff(t_FFT));
thFFTspec = (abs(thFFTspec));

% if thFFTspec is zero, log will make inf, so add eps
thFFTspec(thFFTspec == 0) = eps;

[zFFTspec, mu, sig] = zscore(log10(thFFTspec)');

thfreqs = find(thFFTfreqs >= f_theta(1) & thFFTfreqs <= f_theta(2));
Expand Down

0 comments on commit fa32263

Please sign in to comment.