hamnet70-gnuradio-legacy/utils/filter_preamble.py

26 lines
875 B
Python
Raw Normal View History

2019-06-20 16:57:12 +02:00
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as pp
import rrc
pre = np.array([ -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1]) * (1+1j)
2019-06-20 16:57:12 +02:00
pre_up = np.zeros(2 * len(pre) + 1, dtype=complex)
2019-06-20 16:57:12 +02:00
pre_up[1::2] = pre
rrc_coef = rrc.rrc_design(150, 2)
pre_flt = np.convolve(pre_up, rrc_coef, mode='same')
print("===== Preamble =====")
print(list(pre))
print("===== Filtered Preamble =====")
2019-06-20 16:57:12 +02:00
print(list(pre_flt))
pp.plot(pre_up)
pp.plot(pre_flt)
pp.show()