aboutsummaryrefslogtreecommitdiffstats
path: root/src/dab_util.py
diff options
context:
space:
mode:
authorandreas128 <Andreas>2017-05-19 11:02:13 +0100
committerandreas128 <Andreas>2017-05-19 11:02:13 +0100
commit3dfe0a526a21093b864b99f113eb49ab84e3b377 (patch)
tree8232712672c448d123f7406c87150d40e1d88b51 /src/dab_util.py
parentea934695d10c165b37099c70255927d5165bddf0 (diff)
downloadODR-StaticPrecorrection-3dfe0a526a21093b864b99f113eb49ab84e3b377.tar.gz
ODR-StaticPrecorrection-3dfe0a526a21093b864b99f113eb49ab84e3b377.tar.bz2
ODR-StaticPrecorrection-3dfe0a526a21093b864b99f113eb49ab84e3b377.zip
Add dabconst, fix import fftconvolve
Diffstat (limited to 'src/dab_util.py')
-rw-r--r--src/dab_util.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/dab_util.py b/src/dab_util.py
index 843f8a5..617bd9a 100644
--- a/src/dab_util.py
+++ b/src/dab_util.py
@@ -1,7 +1,6 @@
import numpy as np
import scipy
import matplotlib.pyplot as plt
-import fftconvolve
import src.dabconst as dabconst
from scipy import signal
@@ -84,9 +83,15 @@ def fftlag(sig_orig, sig_rec, n_upsampling = 1):
sig_orig: The signal that has been sent
sig_rec: The signal that has been recored
"""
- c = np.flipud(fftconvolve.fftconvolve(sig_orig,np.flipud(sig_rec), n_upsampling))
- #plt.plot(c)
- return (np.argmax(c) - sig_orig.shape[0] + 1)
+ #off = sig_rec.shape[0]
+ #fft1 = np.fft.fft(sig_orig, n=sig_orig.shape[0])
+ #fft2 = np.fft.fft(np.flipud(sig_rec), n=sig_rec.shape[0])
+ #fftc = fft1 * fft2
+ #c = np.fft.ifft(fftc)
+ c = signal.convolve(sig_orig, np.flipud(sig_rec))
+ #c = signal.correlate(sig_orig, sig_rec)
+ return c
+ return np.argmax(c) - off + 1
def get_amp_ratio(ampl_1, ampl_2, a_out_abs, a_in_abs):
idxs = (a_in_abs > ampl_1) & (a_in_abs < ampl_2)