aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorandreas128 <Andreas>2017-06-08 23:17:58 +0100
committerandreas128 <Andreas>2017-06-08 23:17:58 +0100
commit984c14bf46ebd7dc66954a653c8f17212ed97efb (patch)
treeaaaccff5eccd12e7564d7caaad5b4b572c02bc3a /src
parent3a31cd8ea0225b7b08ddbed8360618e4d17cad6f (diff)
downloadODR-StaticPrecorrection-984c14bf46ebd7dc66954a653c8f17212ed97efb.tar.gz
ODR-StaticPrecorrection-984c14bf46ebd7dc66954a653c8f17212ed97efb.tar.bz2
ODR-StaticPrecorrection-984c14bf46ebd7dc66954a653c8f17212ed97efb.zip
Add analyze_aligned_rx_tx.pyHEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/dab_util.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/dab_util.py b/src/dab_util.py
index 3187036..e33ea05 100644
--- a/src/dab_util.py
+++ b/src/dab_util.py
@@ -77,6 +77,34 @@ def lag_upsampling(sig_orig, sig_rec, n_up):
l_orig = float(l) / n_up
return l_orig
+def subsample_align_upsampling(sig1, sig2, n_up=32):
+ """
+ Returns an aligned version of sig1 and sig2 by cropping and subsample alignment
+ Using upsampling
+ """
+ assert(sig1.shape[0] == sig2.shape[0])
+
+ if sig1.shape[0] % 2 == 1:
+ sig1 = sig1[:-1]
+ sig2 = sig2[:-1]
+
+ sig1_up = signal.resample(sig1, sig1.shape[0] * n_up)
+ sig2_up = signal.resample(sig2, sig2.shape[0] * n_up)
+
+ off_meas = lag_upsampling(sig2_up, sig1_up, n_up=1)
+ off = int(abs(off_meas))
+
+ if off_meas > 0:
+ sig1_up = sig1_up[:-off]
+ sig2_up = sig2_up[off:]
+ elif off_meas < 0:
+ sig1_up = sig1_up[off:]
+ sig2_up = sig2_up[:-off]
+
+ sig1 = signal.resample(sig1_up, sig1_up.shape[0] / n_up).astype(np.complex64)
+ sig2 = signal.resample(sig2_up, sig2_up.shape[0] / n_up).astype(np.complex64)
+ return sig1, sig2
+
def subsample_align(sig1, sig2):
"""
Returns an aligned version of sig1 and sig2 by cropping and subsample alignment