From fa322634ece6137a49e59b28be760e4848320028 Mon Sep 17 00:00:00 2001 From: Ryan Harvey Date: Wed, 20 Nov 2024 11:11:05 -0500 Subject: [PATCH] Bugfix: zeros in thFFTspec replace zeros with eps to avoid inf when logging --- brainStates/SleepScoreMaster/PickSWTHChannel_km.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/brainStates/SleepScoreMaster/PickSWTHChannel_km.m b/brainStates/SleepScoreMaster/PickSWTHChannel_km.m index 8e70179..39a3115 100644 --- a/brainStates/SleepScoreMaster/PickSWTHChannel_km.m +++ b/brainStates/SleepScoreMaster/PickSWTHChannel_km.m @@ -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));