summaryrefslogtreecommitdiff
path: root/gr-digital/python/ofdm_sync_pnac.py
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital/python/ofdm_sync_pnac.py')
-rw-r--r--gr-digital/python/ofdm_sync_pnac.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/gr-digital/python/ofdm_sync_pnac.py b/gr-digital/python/ofdm_sync_pnac.py
index 10a1259641..9b0302ffbb 100644
--- a/gr-digital/python/ofdm_sync_pnac.py
+++ b/gr-digital/python/ofdm_sync_pnac.py
@@ -24,6 +24,16 @@ import math
from numpy import fft
from gnuradio import gr
+try:
+ from gnuradio import filter
+except ImportError:
+ import filter_swig as filter
+
+try:
+ from gnuradio import blocks
+except ImportError:
+ import blocks_swig as blocks
+
class ofdm_sync_pnac(gr.hier_block2):
def __init__(self, fft_length, cp_length, kstime, logging=False):
"""
@@ -50,7 +60,7 @@ class ofdm_sync_pnac(gr.hier_block2):
gr.io_signature2(2, 2, gr.sizeof_float, gr.sizeof_char)) # Output signature
- self.input = gr.add_const_cc(0)
+ self.input = blocks.add_const_cc(0)
symbol_length = fft_length + cp_length
@@ -59,30 +69,30 @@ class ofdm_sync_pnac(gr.hier_block2):
# cross-correlate with the known symbol
kstime = [k.conjugate() for k in kstime[0:fft_length//2]]
kstime.reverse()
- self.crosscorr_filter = gr.fir_filter_ccc(1, kstime)
+ self.crosscorr_filter = filter.fir_filter_ccc(1, kstime)
# Create a delay line
self.delay = gr.delay(gr.sizeof_gr_complex, fft_length/2)
# Correlation from ML Sync
- self.conjg = gr.conjugate_cc();
- self.corr = gr.multiply_cc();
+ self.conjg = blocks.conjugate_cc();
+ self.corr = blocks.multiply_cc();
# Create a moving sum filter for the input
self.mag = gr.complex_to_mag_squared()
movingsum_taps = (fft_length//1)*[1.0,]
- self.power = gr.fir_filter_fff(1,movingsum_taps)
+ self.power = filter.fir_filter_fff(1,movingsum_taps)
# Get magnitude (peaks) and angle (phase/freq error)
self.c2mag = gr.complex_to_mag_squared()
self.angle = gr.complex_to_arg()
- self.compare = gr.sub_ff()
+ self.compare = blocks.sub_ff()
self.sample_and_hold = gr.sample_and_hold_ff()
#ML measurements input to sampler block and detect
self.threshold = gr.threshold_ff(0,0,0) # threshold detection might need to be tweaked
- self.peaks = gr.float_to_char()
+ self.peaks = blocksx.float_to_char()
self.connect(self, self.input)