aboutsummaryrefslogtreecommitdiffstats
path: root/dpd
diff options
context:
space:
mode:
authorandreas128 <Andreas>2017-08-19 14:41:40 +0200
committerandreas128 <Andreas>2017-08-19 14:41:40 +0200
commita7cec585afe6d4805f61461091e516b25574945d (patch)
treeea92aace0941524f33ee6836f4c0ffc2c47767c2 /dpd
parent8696ebf0d58e0e2b9b362497e6c1b778de4a20b6 (diff)
downloaddabmod-a7cec585afe6d4805f61461091e516b25574945d.tar.gz
dabmod-a7cec585afe6d4805f61461091e516b25574945d.tar.bz2
dabmod-a7cec585afe6d4805f61461091e516b25574945d.zip
Fix target function for subsampling alignment
Diffstat (limited to 'dpd')
-rw-r--r--dpd/src/Measure.py13
-rwxr-xr-xdpd/src/subsample_align.py4
2 files changed, 15 insertions, 2 deletions
diff --git a/dpd/src/Measure.py b/dpd/src/Measure.py
index 0f90a44..ba71917 100644
--- a/dpd/src/Measure.py
+++ b/dpd/src/Measure.py
@@ -130,11 +130,24 @@ class Measure:
tx_rx_frame_path = ('/tmp/tx_rx_sync1_' +
datetime.datetime.now().isoformat() +
'.pdf')
+ plt.subplot(311)
plt.plot(np.abs(rxframe_aligned[:128]), label="rxframe")
plt.plot(np.abs(txframe_aligned[:128]), label="txframe")
plt.xlabel("Samples")
+ plt.ylabel("Absolute Value")
+ plt.legend()
+ plt.subplot(312)
+ plt.plot(np.real(rxframe_aligned[:128]), label="rxframe_real", alpha=0.5, linestyle=":")
+ plt.plot(np.real(txframe_aligned[:128]), label="txframe_real", alpha=0.5, linestyle=":")
+ plt.xlabel("Samples")
plt.ylabel("Real Part")
plt.legend()
+ plt.subplot(313)
+ plt.plot(np.imag(rxframe_aligned[:128]), label="rxframe_imag", alpha=0.5, linestyle="--")
+ plt.plot(np.imag(txframe_aligned[:128]), label="txframe_imag", alpha=0.5, linestyle="--")
+ plt.xlabel("Samples")
+ plt.ylabel("Imaginary Part")
+ plt.legend()
plt.savefig(tx_rx_frame_path)
plt.clf()
diff --git a/dpd/src/subsample_align.py b/dpd/src/subsample_align.py
index eda1dce..4dc854b 100755
--- a/dpd/src/subsample_align.py
+++ b/dpd/src/subsample_align.py
@@ -52,7 +52,7 @@ def subsample_align(sig, ref_sig):
corr_sig = np.fft.ifft(rotate_vec * fft_sig)
- return -np.abs(np.sum(corr_sig * ref_sig))
+ return -np.abs(np.sum(corr_sig.conjugate() * ref_sig))
optim_result = optimize.minimize_scalar(correlate_for_delay, bounds=(-1,1), method='bounded', options={'disp': True})
@@ -61,7 +61,7 @@ def subsample_align(sig, ref_sig):
#print("Found subsample delay = {}".format(best_tau))
- if 0:
+ if 1:
corr = np.vectorize(correlate_for_delay)
ixs = np.linspace(-1, 1, 100)
taus = corr(ixs)