diff options
author | Marcus Müller <marcus@hostalia.de> | 2014-11-22 18:11:33 +0100 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2014-11-22 18:11:33 +0100 |
commit | 0a3f0bf2fe30ff6eb276b0f7577a11772efc5910 (patch) | |
tree | 66238d6562e9eafa3f00a132d03a64c73ac3c071 | |
parent | 8a8bfef084ed7a6ddc506f81690041d3b15a9540 (diff) |
typos and deletion of never-evaluated code
fixed a few typos in explanatory comments.
Also deleted code in
if 1:
...
else:
...
clauses.
Also changed a few [1.0 for i in range(...)] to in-line
[1.0] * (fft_length // 2) for superior readability.
-rw-r--r-- | gr-digital/python/digital/ofdm_sync_pn.py | 26 | ||||
-rw-r--r-- | gr-digital/python/digital/ofdm_sync_pnac.py | 18 |
2 files changed, 15 insertions, 29 deletions
diff --git a/gr-digital/python/digital/ofdm_sync_pn.py b/gr-digital/python/digital/ofdm_sync_pn.py index 4c6a30f802..8bf7ed782a 100644 --- a/gr-digital/python/digital/ofdm_sync_pn.py +++ b/gr-digital/python/digital/ofdm_sync_pn.py @@ -42,9 +42,9 @@ class ofdm_sync_pn(gr.hier_block2): Synchonization for OFDM," IEEE Trans. Communications, vol. 45, no. 12, 1997. """ - - gr.hier_block2.__init__(self, "ofdm_sync_pn", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature + + gr.hier_block2.__init__(self, "ofdm_sync_pn", + gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature gr.io_signature2(2, 2, gr.sizeof_float, gr.sizeof_char)) # Output signature self.input = blocks.add_const_cc(0) @@ -59,25 +59,15 @@ class ofdm_sync_pn(gr.hier_block2): self.corr = blocks.multiply_cc(); # Create a moving sum filter for the corr output - if 1: - moving_sum_taps = [1.0 for i in range(fft_length//2)] - self.moving_sum_filter = filter.fir_filter_ccf(1,moving_sum_taps) - else: - moving_sum_taps = [complex(1.0,0.0) for i in range(fft_length//2)] - self.moving_sum_filter = filter.fft_filter_ccc(1,moving_sum_taps) + self.moving_sum_filter = filter.fir_filter_ccf(1, [1.0] * (fft_length//2)) # Create a moving sum filter for the input self.inputmag2 = blocks.complex_to_mag_squared() - movingsum2_taps = [1.0 for i in range(fft_length//2)] - - if 1: - self.inputmovingsum = filter.fir_filter_fff(1,movingsum2_taps) - else: - self.inputmovingsum = filter.fft_filter_fff(1,movingsum2_taps) + self.inputmovingsum = filter.fir_filter_fff(1, [1.0] * (fft_length//2)) self.square = blocks.multiply_ff() self.normalize = blocks.divide_ff() - + # Get magnitude (peaks) and angle (phase/freq error) self.c2mag = blocks.complex_to_mag_squared() self.angle = blocks.complex_to_arg() @@ -87,10 +77,9 @@ class ofdm_sync_pn(gr.hier_block2): #ML measurements input to sampler block and detect self.sub1 = blocks.add_const_ff(-1) self.pk_detect = blocks.peak_detector_fb(0.20, 0.20, 30, 0.001) - #self.pk_detect = blocks.peak_detector2_fb(9) self.connect(self, self.input) - + # Calculate the frequency offset from the correlation of the preamble self.connect(self.input, self.delay) self.connect(self.input, (self.corr,0)) @@ -130,4 +119,3 @@ class ofdm_sync_pn(gr.hier_block2): self.connect(self.pk_detect, blocks.file_sink(gr.sizeof_char, "ofdm_sync_pn-peaks_b.dat")) self.connect(self.sample_and_hold, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pn-sample_and_hold_f.dat")) self.connect(self.input, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_sync_pn-input_c.dat")) - diff --git a/gr-digital/python/digital/ofdm_sync_pnac.py b/gr-digital/python/digital/ofdm_sync_pnac.py index ee7c82927a..55a6c21f4c 100644 --- a/gr-digital/python/digital/ofdm_sync_pnac.py +++ b/gr-digital/python/digital/ofdm_sync_pnac.py @@ -43,23 +43,22 @@ class ofdm_sync_pnac(gr.hier_block2): This implementation is meant to be a more robust version of the Schmidl and Cox receiver design. By correlating against the preamble and using that as the input to the time-delayed correlation, - this circuit produces a very clean timing signal at the end of the preamble. The timing is + this circuit produces a very clean timing signal at the end of the preamble. The timing is more accurate and does not have the problem associated with determining the timing from the plateau structure in the Schmidl and Cox. This implementation appears to require that the signal is received with a normalized power or signal - scalling factor to reduce ambiguities intorduced from partial correlation of the cyclic prefix and + scaling factor to reduce ambiguities introduced from partial correlation of the cyclic prefix and the peak detection. A better peak detection block might fix this. Also, the cross-correlation falls apart as the frequency offset gets larger and completely fails when an integer offset is introduced. Another thing to look at. """ - gr.hier_block2.__init__(self, "ofdm_sync_pnac", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature + gr.hier_block2.__init__(self, "ofdm_sync_pnac", + gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature gr.io_signature2(2, 2, gr.sizeof_float, gr.sizeof_char)) # Output signature - self.input = blocks.add_const_cc(0) symbol_length = fft_length + cp_length @@ -80,19 +79,18 @@ class ofdm_sync_pnac(gr.hier_block2): # Create a moving sum filter for the input self.mag = blocks.complex_to_mag_squared() - movingsum_taps = (fft_length//1)*[1.0,] - self.power = filter.fir_filter_fff(1,movingsum_taps) - + self.power = filter.fir_filter_fff(1, [1.0] * int(fft_length)) + # Get magnitude (peaks) and angle (phase/freq error) self.c2mag = blocks.complex_to_mag_squared() self.angle = blocks.complex_to_arg() self.compare = blocks.sub_ff() - + self.sample_and_hold = blocks.sample_and_hold_ff() #ML measurements input to sampler block and detect self.threshold = blocks.threshold_ff(0,0,0) # threshold detection might need to be tweaked - self.peaks = blocksx.float_to_char() + self.peaks = blocks.float_to_char() self.connect(self, self.input) |