Skip to content

Commit

Permalink
scipy.fft
Browse files Browse the repository at this point in the history
  • Loading branch information
minaskar committed Feb 21, 2021
1 parent f7f8982 commit 7547fe8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions zeus/autocorr.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
import scipy as sp

from scipy.fft import fft, ifft

def _autocorr_func_1d(x, norm=True):
"""
Expand All @@ -25,8 +24,8 @@ def _autocorr_func_1d(x, norm=True):
# Compute the auto-correlation function using FFT
#f = np.fft.fft(x - np.mean(x), n=2 * n)
#acf = np.fft.ifft(f * np.conjugate(f))[: len(x)].real
f = sp.fft.fft(x - np.mean(x), n=2 * n)
acf = sp.fft.ifft(f * np.conjugate(f))[: len(x)].real
f = fft(x - np.mean(x), n=2 * n)
acf = ifft(f * np.conjugate(f))[: len(x)].real
acf /= 4 * n

# Normalize
Expand Down

0 comments on commit 7547fe8

Please sign in to comment.