From 09ef3402aa78c1dc870a1ac76178ebb68ef79207 Mon Sep 17 00:00:00 2001 From: Christoph Mayer Date: Mon, 9 Sep 2019 16:05:09 +0200 Subject: [PATCH] improved doppler estimation for shortened 110C preambles --- python/physical_layer/MIL_STD_188_110C.py | 24 ++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/python/physical_layer/MIL_STD_188_110C.py b/python/physical_layer/MIL_STD_188_110C.py index c5384ef..1502c2e 100644 --- a/python/physical_layer/MIL_STD_188_110C.py +++ b/python/physical_layer/MIL_STD_188_110C.py @@ -320,15 +320,21 @@ class PhysicalLayer(object): cc = np.correlate(iq_samples, zp) imax = np.argmax(np.abs(cc[0:23*sps])) print('imax=', imax, len(iq_samples)) - pks = [np.correlate(iq_samples[imax+i*m+idx], - zp[i*m+idx])[0] - for i in range(n//m)] - val = [np.mean(np.abs(np.correlate(iq_samples[imax+i*m+idx2], - zp[i*m+idx])[11*sps+np.arange(-2*sps,2*sps)])) - for i in range((n//m)-1)] - tests = np.abs(pks[0:-1])/val - r['success'] = bool(np.median(tests) > 2.0) - print('test:', np.abs(pks), tests) + pks = np.array([np.correlate(iq_samples[imax+i*m+idx], + zp[i*m+idx])[0] + for i in range(n//m)]) + val = np.array([np.mean(np.abs(np.correlate(iq_samples[imax+i*m+idx2], + zp[i*m+idx])[11*sps+np.arange(-2*sps,2*sps)])) + for i in range((n//m)-1)]) + ## filter out + (i,) = (np.abs(pks) > 0.5*np.mean(np.abs(pks[-3:]))).nonzero() + i = i[0] if i.size > 0 else 0 + pks = pks[i:] + val = val[i:] + if pks.size > 1: + tests = np.abs(pks[:-1])/val + r['success'] = bool(np.median(tests) > 2.0) + print('test:', np.abs(pks), tests) if r['success']: print('doppler apks', np.abs(pks)) print('doppler ppks', np.angle(pks),