-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnolitsa.patch
More file actions
23 lines (18 loc) · 795 Bytes
/
nolitsa.patch
File metadata and controls
23 lines (18 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
diff --git a/nolitsa/surrogates.py b/nolitsa/surrogates.py
index 584e5e6..1a7d7c6 100644
--- a/nolitsa/surrogates.py
+++ b/nolitsa/surrogates.py
@@ -142,6 +142,9 @@ def iaaft(x, maxiter=1000, atol=1e-8, rtol=1e-10):
t = np.fft.rfft(np.random.permutation(x))
for i in range(maxiter):
+ # Assure no zeroes.
+ t = np.where(t != 0, t, np.finfo(t.dtype).eps)
+
# Match power spectrum.
s = np.real(np.fft.irfft(ampl * t / np.abs(t), n=len(x)))
@@ -158,7 +161,7 @@ def iaaft(x, maxiter=1000, atol=1e-8, rtol=1e-10):
perr = cerr
# Normalize error w.r.t. mean of the "true" power spectrum.
- return y, i, cerr / np.mean(ampl ** 2)
+ return y # , i, cerr / np.mean(ampl ** 2)
def mismatch(x, length=None, weight=0.5, neigh=3):