diff options
author | Tom Rondeau <trondeau@vt.edu> | 2012-07-16 22:51:06 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2012-07-16 22:51:06 -0400 |
commit | d7190928b79f15e036dced7fc9f4a5c8ed39c4d7 (patch) | |
tree | 63347fd862487158f43701dd7475c12106ed12c3 /gr-digital | |
parent | 25166c11ad7e438dd3673edca36b3a23ee8ec0dd (diff) |
digital: fixed narrowband voice example and OFDM code to use gr-filter.
Diffstat (limited to 'gr-digital')
-rwxr-xr-x | gr-digital/examples/narrowband/tx_voice.py | 3 | ||||
-rw-r--r-- | gr-digital/python/ofdm_receiver.py | 13 | ||||
-rw-r--r-- | gr-digital/python/ofdm_sync_ml.py | 11 | ||||
-rw-r--r-- | gr-digital/python/ofdm_sync_pn.py | 15 | ||||
-rw-r--r-- | gr-digital/python/ofdm_sync_pnac.py | 9 |
5 files changed, 36 insertions, 15 deletions
diff --git a/gr-digital/examples/narrowband/tx_voice.py b/gr-digital/examples/narrowband/tx_voice.py index 3d767a0770..400ab7a587 100755 --- a/gr-digital/examples/narrowband/tx_voice.py +++ b/gr-digital/examples/narrowband/tx_voice.py @@ -25,6 +25,7 @@ from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser +from gnuradio import filter from gnuradio import digital from gnuradio import vocoder @@ -84,7 +85,7 @@ class my_top_block(gr.top_block): self.sink = gr.null_sink(gr.sizeof_gr_complex) rrate = 1 - self.resampler = blks2.pfb_arb_resampler_ccf(rrate) + self.resampler = filter.pfb.arb_resampler_ccf(rrate) self.connect(self.audio_rx) self.connect(self.txpath, self.resampler, self.sink) diff --git a/gr-digital/python/ofdm_receiver.py b/gr-digital/python/ofdm_receiver.py index 9d4d6e559d..8290042e6f 100644 --- a/gr-digital/python/ofdm_receiver.py +++ b/gr-digital/python/ofdm_receiver.py @@ -24,12 +24,17 @@ import math from numpy import fft from gnuradio import gr -import digital_swig +import digital_swig as digital from ofdm_sync_pn import ofdm_sync_pn from ofdm_sync_fixed import ofdm_sync_fixed from ofdm_sync_pnac import ofdm_sync_pnac from ofdm_sync_ml import ofdm_sync_ml +try: + from gnuradio import filter +except ImportError: + import filter_swig as filter + class ofdm_receiver(gr.hier_block2): """ Performs receiver synchronization on OFDM symbols. @@ -72,7 +77,7 @@ class ofdm_receiver(gr.hier_block2): bw+tb, # midpoint of trans. band tb, # width of trans. band gr.firdes.WIN_HAMMING) # filter type - self.chan_filt = gr.fft_filter_ccc(1, chan_coeffs) + self.chan_filt = filter.fft_filter_ccc(1, chan_coeffs) win = [1 for i in range(fft_length)] @@ -121,9 +126,9 @@ class ofdm_receiver(gr.hier_block2): self.nco = gr.frequency_modulator_fc(nco_sensitivity) # generate a signal proportional to frequency error of sync block self.sigmix = gr.multiply_cc() - self.sampler = digital_swig.ofdm_sampler(fft_length, fft_length+cp_length) + self.sampler = digital.ofdm_sampler(fft_length, fft_length+cp_length) self.fft_demod = gr.fft_vcc(fft_length, True, win, True) - self.ofdm_frame_acq = digital_swig.ofdm_frame_acquisition(occupied_tones, + self.ofdm_frame_acq = digital.ofdm_frame_acquisition(occupied_tones, fft_length, cp_length, ks[0]) diff --git a/gr-digital/python/ofdm_sync_ml.py b/gr-digital/python/ofdm_sync_ml.py index 7c75d7f1d4..f732fdf29a 100644 --- a/gr-digital/python/ofdm_sync_ml.py +++ b/gr-digital/python/ofdm_sync_ml.py @@ -23,6 +23,11 @@ import math from gnuradio import gr +try: + from gnuradio import filter +except ImportError: + import filter_swig as filter + class ofdm_sync_ml(gr.hier_block2): def __init__(self, fft_length, cp_length, snr, kstime, logging): ''' Maximum Likelihood OFDM synchronizer: @@ -57,7 +62,7 @@ class ofdm_sync_ml(gr.hier_block2): self.adder = gr.add_ff() moving_sum_taps = [rho/2 for i in range(cp_length)] - self.moving_sum_filter = gr.fir_filter_fff(1,moving_sum_taps) + self.moving_sum_filter = filter.fir_filter_fff(1,moving_sum_taps) self.connect(self.input,self.magsqrd1) self.connect(self.delay,self.magsqrd2) @@ -71,7 +76,7 @@ class ofdm_sync_ml(gr.hier_block2): self.mixer = gr.multiply_cc(); movingsum2_taps = [1.0 for i in range(cp_length)] - self.movingsum2 = gr.fir_filter_ccf(1,movingsum2_taps) + self.movingsum2 = filter.fir_filter_ccf(1,movingsum2_taps) # Correlator data handler self.c2mag = gr.complex_to_mag() @@ -115,7 +120,7 @@ class ofdm_sync_ml(gr.hier_block2): # to readjust the timing in the middle of the packet or we ruin the equalizer settings. kstime = [k.conjugate() for k in kstime] kstime.reverse() - self.kscorr = gr.fir_filter_ccc(1, kstime) + self.kscorr = filter.fir_filter_ccc(1, kstime) self.corrmag = gr.complex_to_mag_squared() self.div = gr.divide_ff() diff --git a/gr-digital/python/ofdm_sync_pn.py b/gr-digital/python/ofdm_sync_pn.py index 05b1de2e19..8307a8ee14 100644 --- a/gr-digital/python/ofdm_sync_pn.py +++ b/gr-digital/python/ofdm_sync_pn.py @@ -24,6 +24,11 @@ import math from numpy import fft from gnuradio import gr +try: + from gnuradio import filter +except ImportError: + import filter_swig as filter + class ofdm_sync_pn(gr.hier_block2): def __init__(self, fft_length, cp_length, logging=False): """ @@ -51,19 +56,19 @@ class ofdm_sync_pn(gr.hier_block2): # 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 = gr.fir_filter_ccf(1,moving_sum_taps) + 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 = gr.fft_filter_ccc(1,moving_sum_taps) + self.moving_sum_filter = filter.fft_filter_ccc(1,moving_sum_taps) # Create a moving sum filter for the input self.inputmag2 = gr.complex_to_mag_squared() movingsum2_taps = [1.0 for i in range(fft_length//2)] if 1: - self.inputmovingsum = gr.fir_filter_fff(1,movingsum2_taps) + self.inputmovingsum = filter.fir_filter_fff(1,movingsum2_taps) else: - self.inputmovingsum = gr.fft_filter_fff(1,movingsum2_taps) + self.inputmovingsum = filter.fft_filter_fff(1,movingsum2_taps) self.square = gr.multiply_ff() self.normalize = gr.divide_ff() @@ -100,7 +105,7 @@ class ofdm_sync_pn(gr.hier_block2): # Create a moving sum filter for the corr output matched_filter_taps = [1.0/cp_length for i in range(cp_length)] - self.matched_filter = gr.fir_filter_fff(1,matched_filter_taps) + self.matched_filter = filter.fir_filter_fff(1,matched_filter_taps) self.connect(self.normalize, self.matched_filter) self.connect(self.matched_filter, self.sub1, self.pk_detect) diff --git a/gr-digital/python/ofdm_sync_pnac.py b/gr-digital/python/ofdm_sync_pnac.py index 10a1259641..a5edc272a8 100644 --- a/gr-digital/python/ofdm_sync_pnac.py +++ b/gr-digital/python/ofdm_sync_pnac.py @@ -24,6 +24,11 @@ import math from numpy import fft from gnuradio import gr +try: + from gnuradio import filter +except ImportError: + import filter_swig as filter + class ofdm_sync_pnac(gr.hier_block2): def __init__(self, fft_length, cp_length, kstime, logging=False): """ @@ -59,7 +64,7 @@ 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) @@ -71,7 +76,7 @@ class ofdm_sync_pnac(gr.hier_block2): # 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() |