diff options
Diffstat (limited to 'gr-uhd/examples/python')
-rwxr-xr-x | gr-uhd/examples/python/fm_tx4.py | 32 | ||||
-rwxr-xr-x | gr-uhd/examples/python/fm_tx_2_daughterboards.py | 52 | ||||
-rwxr-xr-x | gr-uhd/examples/python/max_power.py | 12 | ||||
-rwxr-xr-x | gr-uhd/examples/python/usrp_am_mw_rcv.py | 53 | ||||
-rwxr-xr-x | gr-uhd/examples/python/usrp_nbfm_ptt.py | 69 | ||||
-rwxr-xr-x | gr-uhd/examples/python/usrp_nbfm_rcv.py | 30 | ||||
-rwxr-xr-x | gr-uhd/examples/python/usrp_spectrum_sense.py | 32 | ||||
-rwxr-xr-x | gr-uhd/examples/python/usrp_tv_rcv.py | 33 | ||||
-rwxr-xr-x | gr-uhd/examples/python/usrp_tv_rcv_nogui.py | 29 | ||||
-rwxr-xr-x | gr-uhd/examples/python/usrp_wfm_rcv.py | 38 | ||||
-rwxr-xr-x | gr-uhd/examples/python/usrp_wfm_rcv2_nogui.py | 25 | ||||
-rwxr-xr-x | gr-uhd/examples/python/usrp_wfm_rcv_fmdet.py | 40 | ||||
-rwxr-xr-x | gr-uhd/examples/python/usrp_wfm_rcv_nogui.py | 32 | ||||
-rwxr-xr-x | gr-uhd/examples/python/usrp_wfm_rcv_pll.py | 32 | ||||
-rwxr-xr-x | gr-uhd/examples/python/usrp_wfm_rcv_sca.py | 80 | ||||
-rwxr-xr-x | gr-uhd/examples/python/usrp_wxapt_rcv.py | 32 |
16 files changed, 338 insertions, 283 deletions
diff --git a/gr-uhd/examples/python/fm_tx4.py b/gr-uhd/examples/python/fm_tx4.py index f412ffb5dc..fefa67861b 100755 --- a/gr-uhd/examples/python/fm_tx4.py +++ b/gr-uhd/examples/python/fm_tx4.py @@ -34,7 +34,8 @@ audio_to_file.py from gnuradio import gr, eng_notation from gnuradio import uhd -from gnuradio import blks2 +from gnuradio import analog +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser import math @@ -55,26 +56,26 @@ class pipeline(gr.hier_block2): gr.io_signature(1, 1, gr.sizeof_gr_complex)) try: - src = gr.file_source (gr.sizeof_float, filename, True) + src = blocks.file_source (gr.sizeof_float, filename, True) except RuntimeError: sys.stderr.write(("\nError: Could not open file '%s'\n\n" % \ filename)) sys.exit(1) print audio_rate, if_rate - fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5e3, tau=75e-6) + fmtx = analog.nbfm_tx(audio_rate, if_rate, max_dev=5e3, tau=75e-6) # Local oscillator - lo = gr.sig_source_c (if_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - lo_freq, #frequency - 1.0, # amplitude - 0) # DC Offset - mixer = gr.multiply_cc () + lo = analog.sig_source_c(if_rate, # sample rate + analog.GR_SIN_WAVE, # waveform type + lo_freq, # frequency + 1.0, # amplitude + 0) # DC Offset + mixer = blocks.multiply_cc() - self.connect (src, fmtx, (mixer, 0)) - self.connect (lo, (mixer, 1)) - self.connect (mixer, self) + self.connect(src, fmtx, (mixer, 0)) + self.connect(lo, (mixer, 1)) + self.connect(mixer, self) class fm_tx_block(stdgui2.std_top_block): def __init__(self, frame, panel, vbox, argv): @@ -141,7 +142,7 @@ class fm_tx_block(stdgui2.std_top_block): self.set_gain(options.gain) self.set_freq(options.freq) - self.sum = gr.add_cc () + self.sum = blocks.add_cc () # Instantiate N NBFM channels step = 25e3 @@ -153,7 +154,7 @@ class fm_tx_block(stdgui2.std_top_block): self.audio_rate, self.usrp_rate) self.connect(t, (self.sum, i)) - self.gain = gr.multiply_const_cc (1.0 / options.nchannels) + self.gain = blocks.multiply_const_cc (1.0 / options.nchannels) # connect it all self.connect (self.sum, self.gain) @@ -179,7 +180,8 @@ class fm_tx_block(stdgui2.std_top_block): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool Tuning is a two step process. First we ask the front-end to diff --git a/gr-uhd/examples/python/fm_tx_2_daughterboards.py b/gr-uhd/examples/python/fm_tx_2_daughterboards.py index b5763e8e19..b4958b8596 100755 --- a/gr-uhd/examples/python/fm_tx_2_daughterboards.py +++ b/gr-uhd/examples/python/fm_tx_2_daughterboards.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -30,7 +30,10 @@ Side A is 600 Hz tone. Side B is 350 + 440 Hz tones. """ -from gnuradio import gr, uhd, blks2 +from gnuradio import gr, uhd +from gnuradio import filter +from gnuradio import analog +from gnuradio import blocks from gnuradio.eng_notation import num_to_str, str_to_num from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -47,11 +50,11 @@ class example_signal_0(gr.hier_block2): gr.io_signature(0, 0, 0), # Input signature gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - src = gr.sig_source_c (sample_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - 600, # frequency - 1.0, # amplitude - 0) # DC Offset + src = analog.sig_source_c(sample_rate, # sample rate + analog.GR_SIN_WAVE, # waveform type + 600, # frequency + 1.0, # amplitude + 0) # DC Offset self.connect(src, self) @@ -65,18 +68,18 @@ class example_signal_1(gr.hier_block2): gr.io_signature(0, 0, 0), # Input signature gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - src0 = gr.sig_source_c (sample_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - 350, # frequency - 1.0, # amplitude - 0) # DC Offset - - src1 = gr.sig_source_c (sample_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - 440, # frequency - 1.0, # amplitude - 0) # DC Offset - sum = gr.add_cc() + src0 = analog.sig_source_c(sample_rate, # sample rate + analog.GR_SIN_WAVE, # waveform type + 350, # frequency + 1.0, # amplitude + 0) # DC Offset + + src1 = analog.sig_source_c(sample_rate, # sample rate + analog.GR_SIN_WAVE, # waveform type + 440, # frequency + 1.0, # amplitude + 0) # DC Offset + sum = blocks.add_cc() self.connect(src0, (sum, 0)) self.connect(src1, (sum, 1)) self.connect(sum, self) @@ -86,7 +89,7 @@ class my_top_block(gr.top_block): def __init__(self): gr.top_block.__init__(self) - usage="%prog: [options] tx-freq0 tx-freq1" + usage = "%prog: [options] tx-freq0 tx-freq1" parser = OptionParser (option_class=eng_option, usage=usage) parser.add_option("-a", "--args", type="string", default="", help="UHD device address args [default=%default]") @@ -152,13 +155,13 @@ class my_top_block(gr.top_block): sig0 = example_signal_0(self.usrp_rate) sig1 = example_signal_1(self.usrp_rate) - intl = gr.interleave(gr.sizeof_gr_complex) + intl = blocks.interleave(gr.sizeof_gr_complex) self.connect(sig0, (intl, 0)) self.connect(sig1, (intl, 1)) # Correct for any difference in requested and actual rates rrate = self.usrp_rate / dev_rate - resamp = blks2.pfb_arb_resampler_ccf(rrate) + resamp = filter.pfb.arb_resampler_ccf(rrate) # and wire them up self.connect(intl, resamp, self.u) @@ -184,8 +187,9 @@ class my_top_block(gr.top_block): """ Set the center frequency we're interested in. - @param side: 0 = side A, 1 = side B - @param target_freq: frequency in Hz + Args: + side: 0 = side A, 1 = side B + target_freq: frequency in Hz @rtype: bool """ diff --git a/gr-uhd/examples/python/max_power.py b/gr-uhd/examples/python/max_power.py index 5d23f16afc..e1504e5ea2 100755 --- a/gr-uhd/examples/python/max_power.py +++ b/gr-uhd/examples/python/max_power.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2011 Free Software Foundation, Inc. +# Copyright 2004,2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,6 +26,8 @@ Setup USRP for maximum power consumption. from gnuradio import gr +from gnuradio import analog +from gnuradio import blocks from gnuradio import uhd from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -63,9 +65,9 @@ class build_block(gr.top_block): self.u_tx = uhd.usrp_sink(device_addr=args, stream_args=stream_args) self.u_tx.set_samp_rate(MAX_RATE) - self.tx_src0 = gr.sig_source_c(self.u_tx.get_samp_rate(), - gr.GR_CONST_WAVE, - 0, 1.0, 0) + self.tx_src0 = analog.sig_source_c(self.u_tx.get_samp_rate(), + analog.GR_CONST_WAVE, + 0, 1.0, 0) # Get dboard gain range and select maximum tx_gain_range = self.u_tx.get_gain_range() @@ -94,7 +96,7 @@ class build_block(gr.top_block): self.u_rx = uhd.usrp_source(device_addr=args, io_type=uhd.io_type.COMPLEX_FLOAT32, num_channels=rx_nchan) - self.rx_dst0 = gr.null_sink (gr.sizeof_gr_complex) + self.rx_dst0 = blocks.null_sink(gr.sizeof_gr_complex) self.u_rx.set_samp_rate(MAX_RATE) diff --git a/gr-uhd/examples/python/usrp_am_mw_rcv.py b/gr-uhd/examples/python/usrp_am_mw_rcv.py index 02863b32fd..eebbd7c041 100755 --- a/gr-uhd/examples/python/usrp_am_mw_rcv.py +++ b/gr-uhd/examples/python/usrp_am_mw_rcv.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,10 +20,12 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, eng_notation, optfir +from gnuradio import gr, eng_notation +from gnuradio import blocks +from gnuradio import filter +from gnuradio import analog from gnuradio import audio from gnuradio import uhd -from gnuradio import blks2 from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form @@ -96,36 +98,36 @@ class wfm_rx_block (stdgui2.std_top_block): # Resample signal to exactly self.usrp_rate # FIXME: make one of the follow-on filters an arb resampler rrate = usrp_rate / dev_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate) + self.resamp = filter.pfb.arb_resampler_ccf(rrate) - chan_filt_coeffs = gr.firdes.low_pass_2 (1, # gain - usrp_rate, # sampling rate - 8e3, # passband cutoff - 4e3, # transition bw - 60) # stopband attenuation + chan_filt_coeffs = filter.firdes.low_pass_2(1, # gain + usrp_rate, # sampling rate + 8e3, # passband cutoff + 4e3, # transition bw + 60) # stopband attenuation if self.use_IF: # Turn If to baseband and filter. - self.chan_filt = gr.freq_xlating_fir_filter_ccf (chanfilt_decim, - chan_filt_coeffs, - self.IF_freq, - usrp_rate) + self.chan_filt = filter.freq_xlating_fir_filter_ccf(chanfilt_decim, + chan_filt_coeffs, + self.IF_freq, + usrp_rate) else: - self.chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs) + self.chan_filt = filter.fir_filter_ccf(chanfilt_decim, chan_filt_coeffs) - self.agc = gr.agc_cc(0.1, 1, 1, 100000) - self.am_demod = gr.complex_to_mag() - self.volume_control = gr.multiply_const_ff(self.vol) + self.agc = analog.agc_cc(0.1, 1, 1, 100000) + self.am_demod = blocks.complex_to_mag() + self.volume_control = blocks.multiply_const_ff(self.vol) - audio_filt_coeffs = gr.firdes.low_pass_2 (1, # gain - demod_rate, # sampling rate - 8e3, # passband cutoff - 2e3, # transition bw - 60) # stopband attenuation - self.audio_filt=gr.fir_filter_fff(audio_decim, audio_filt_coeffs) + audio_filt_coeffs = filter.firdes.low_pass_2(1, # gain + demod_rate, # sampling rate + 8e3, # passband cutoff + 2e3, # transition bw + 60) # stopband attenuation + self.audio_filt = filter.fir_filter_fff(audio_decim, audio_filt_coeffs) # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), + self.audio_sink = audio.sink(int (audio_rate), options.audio_output, False) # ok_to_block @@ -276,7 +278,8 @@ class wfm_rx_block (stdgui2.std_top_block): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool """ r = self.u.set_center_freq(target_freq + self.IF_freq, 0) diff --git a/gr-uhd/examples/python/usrp_nbfm_ptt.py b/gr-uhd/examples/python/usrp_nbfm_ptt.py index 791b8cb990..76e1f47c3c 100755 --- a/gr-uhd/examples/python/usrp_nbfm_ptt.py +++ b/gr-uhd/examples/python/usrp_nbfm_ptt.py @@ -25,7 +25,10 @@ import sys import wx from optparse import OptionParser -from gnuradio import gr, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import analog +from gnuradio import blocks +from gnuradio import filter from gnuradio.eng_option import eng_option from gnuradio.wxgui import stdgui2, fftsink2, scopesink2, slider, form @@ -300,32 +303,32 @@ class transmit_path(gr.hier_block2): self.normal_gain = 32000 self.audio = audio.source(int(self.audio_rate), audio_input) - self.audio_amp = gr.multiply_const_ff(self.audio_gain) + self.audio_amp = blocks.multiply_const_ff(self.audio_gain) - lpf = gr.firdes.low_pass (1, # gain - self.audio_rate, # sampling rate - 3800, # low pass cutoff freq - 300, # width of trans. band - gr.firdes.WIN_HANN) # filter type + lpf = filter.firdes.low_pass(1, # gain + self.audio_rate, # sampling rate + 3800, # low pass cutoff freq + 300, # width of trans. band + filter.firdes.WIN_HANN) # filter type - hpf = gr.firdes.high_pass (1, # gain - self.audio_rate, # sampling rate - 325, # low pass cutoff freq - 50, # width of trans. band - gr.firdes.WIN_HANN) # filter type + hpf = filter.firdes.high_pass(1, # gain + self.audio_rate, # sampling rate + 325, # low pass cutoff freq + 50, # width of trans. band + filter.firdes.WIN_HANN) # filter type audio_taps = convolve(array(lpf),array(hpf)) - self.audio_filt = gr.fir_filter_fff(1,audio_taps) + self.audio_filt = filter.fir_filter_fff(1,audio_taps) - self.pl = blks2.ctcss_gen_f(self.audio_rate,123.0) - self.add_pl = gr.add_ff() + self.pl = analog.ctcss_gen_f(self.audio_rate,123.0) + self.add_pl = blocks.add_ff() self.connect(self.pl,(self.add_pl,1)) - self.fmtx = blks2.nbfm_tx(self.audio_rate, self.if_rate) - self.amp = gr.multiply_const_cc (self.normal_gain) + self.fmtx = analog.nbfm_tx(self.audio_rate, self.if_rate) + self.amp = blocks.multiply_const_cc (self.normal_gain) rrate = dev_rate / self.if_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate) + self.resamp = filter.pfb.arb_resampler_ccf(rrate) self.connect(self.audio, self.audio_amp, self.audio_filt, (self.add_pl,0), self.fmtx, self.amp, @@ -344,7 +347,8 @@ class transmit_path(gr.hier_block2): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool """ r = self.u.set_center_freq(target_freq) @@ -387,30 +391,30 @@ class receive_path(gr.hier_block2): # Create filter to get actual channel we want nfilts = 32 - chan_coeffs = gr.firdes.low_pass (nfilts, # gain - nfilts*dev_rate, # sampling rate - 13e3, # low pass cutoff freq - 4e3, # width of trans. band - gr.firdes.WIN_HANN) # filter type + chan_coeffs = filter.firdes.low_pass(nfilts, # gain + nfilts*dev_rate, # sampling rate + 13e3, # low pass cutoff freq + 4e3, # width of trans. band + filter.firdes.WIN_HANN) # filter type rrate = self.quad_rate / dev_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.resamp = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) # instantiate the guts of the single channel receiver - self.fmrx = blks2.nbfm_rx(self.audio_rate, self.quad_rate) + self.fmrx = analog.nbfm_rx(self.audio_rate, self.quad_rate) # standard squelch block - self.squelch = blks2.standard_squelch(self.audio_rate) + self.squelch = analog.standard_squelch(self.audio_rate) # audio gain / mute block - self._audio_gain = gr.multiply_const_ff(1.0) + self._audio_gain = blocks.multiply_const_ff(1.0) # sound card as final sink - audio_sink = audio.sink (int(self.audio_rate), audio_output) + audio_sink = audio.sink(int(self.audio_rate), audio_output) # now wire it all together - self.connect (self.u, self.resamp, self.fmrx, self.squelch, - self._audio_gain, audio_sink) + self.connect(self.u, self.resamp, self.fmrx, self.squelch, + self._audio_gain, audio_sink) if gain is None: # if no gain was specified, use the mid-point in dB @@ -464,7 +468,8 @@ class receive_path(gr.hier_block2): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool """ r = self.u.set_center_freq(target_freq) diff --git a/gr-uhd/examples/python/usrp_nbfm_rcv.py b/gr-uhd/examples/python/usrp_nbfm_rcv.py index be890f02d8..e3dc7eac6b 100755 --- a/gr-uhd/examples/python/usrp_nbfm_rcv.py +++ b/gr-uhd/examples/python/usrp_nbfm_rcv.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2007,2011 Free Software Foundation, Inc. +# Copyright 2005,2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,10 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import blocks +from gnuradio import filter +from gnuradio import analog from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form @@ -285,24 +288,24 @@ class receive_path(gr.hier_block2): # Create filter to get actual channel we want nfilts = 32 - chan_coeffs = gr.firdes.low_pass (nfilts, # gain - nfilts*dev_rate, # sampling rate - 8e3, # low pass cutoff freq - 2e3, # width of trans. band - gr.firdes.WIN_HANN) # filter type + chan_coeffs = filter.firdes.low_pass(nfilts, # gain + nfilts*dev_rate, # sampling rate + 8e3, # low pass cutoff freq + 2e3, # width of trans. band + filter.firdes.WIN_HANN) # filter type rrate = self.quad_rate / dev_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.resamp = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) if USE_SIMPLE_SQUELCH: - self.squelch = gr.simple_squelch_cc(20) + self.squelch = analog.simple_squelch_cc(20) else: - self.squelch = blks2.standard_squelch(self.audio_rate) + self.squelch = analog.standard_squelch(self.audio_rate) # instantiate the guts of the single channel receiver - self.fmrx = blks2.nbfm_rx(self.audio_rate, self.quad_rate) + self.fmrx = analog.nbfm_rx(self.audio_rate, self.quad_rate) # audio gain / mute block - self._audio_gain = gr.multiply_const_ff(1.0) + self._audio_gain = blocks.multiply_const_ff(1.0) # sound card as final sink audio_sink = audio.sink (int(self.audio_rate), audio_output) @@ -357,7 +360,8 @@ class receive_path(gr.hier_block2): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool """ diff --git a/gr-uhd/examples/python/usrp_spectrum_sense.py b/gr-uhd/examples/python/usrp_spectrum_sense.py index a7830204e6..3ad0f332a5 100755 --- a/gr-uhd/examples/python/usrp_spectrum_sense.py +++ b/gr-uhd/examples/python/usrp_spectrum_sense.py @@ -20,8 +20,11 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, eng_notation, window +from gnuradio import gr, eng_notation +from gnuradio import blocks from gnuradio import audio +from gnuradio import filter +from gnuradio import fft from gnuradio import uhd from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -47,7 +50,7 @@ class tune(gr.feval_dd): def eval(self, ignore): """ - This method is called from gr.bin_statistics_f when it wants + This method is called from blocks.bin_statistics_f when it wants to change the center frequency. This method tunes the front end to the new center frequency, and returns the new frequency as its result. @@ -175,19 +178,19 @@ class my_top_block(gr.top_block): self.squelch_threshold = options.squelch_threshold - s2v = gr.stream_to_vector(gr.sizeof_gr_complex, self.fft_size) + s2v = blocks.stream_to_vector(gr.sizeof_gr_complex, self.fft_size) - mywindow = window.blackmanharris(self.fft_size) - fft = gr.fft_vcc(self.fft_size, True, mywindow, True) + mywindow = filter.window.blackmanharris(self.fft_size) + ffter = fft.fft_vcc(self.fft_size, True, mywindow, True) power = 0 for tap in mywindow: power += tap*tap - c2mag = gr.complex_to_mag_squared(self.fft_size) + c2mag = blocks.complex_to_mag_squared(self.fft_size) # FIXME the log10 primitive is dog slow - #log = gr.nlog10_ff(10, self.fft_size, - # -20*math.log10(self.fft_size)-10*math.log10(power/self.fft_size)) + #log = blocks.nlog10_ff(10, self.fft_size, + # -20*math.log10(self.fft_size)-10*math.log10(power/self.fft_size)) # Set the freq_step to 75% of the actual data throughput. # This allows us to discard the bins on both ends of the spectrum. @@ -204,13 +207,13 @@ class my_top_block(gr.top_block): self.msgq = gr.msg_queue(1) self._tune_callback = tune(self) # hang on to this to keep it from being GC'd - stats = gr.bin_statistics_f(self.fft_size, self.msgq, - self._tune_callback, tune_delay, - dwell_delay) + stats = blocks.bin_statistics_f(self.fft_size, self.msgq, + self._tune_callback, tune_delay, + dwell_delay) # FIXME leave out the log10 until we speed it up - #self.connect(self.u, s2v, fft, c2mag, log, stats) - self.connect(self.u, s2v, fft, c2mag, stats) + #self.connect(self.u, s2v, ffter, c2mag, log, stats) + self.connect(self.u, s2v, ffter, c2mag, stats) if options.gain is None: # if no gain was specified, use the mid-point in dB @@ -237,7 +240,8 @@ class my_top_block(gr.top_block): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool """ diff --git a/gr-uhd/examples/python/usrp_tv_rcv.py b/gr-uhd/examples/python/usrp_tv_rcv.py index b49a5ea71a..301840f41d 100755 --- a/gr-uhd/examples/python/usrp_tv_rcv.py +++ b/gr-uhd/examples/python/usrp_tv_rcv.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011-2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -47,6 +47,8 @@ except: print "FYI: gr-video-sdl is not installed" print "realtime SDL video output window will not be available" from gnuradio import uhd +from gnuradio import analog +from gnuradio import blocks from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form @@ -122,8 +124,8 @@ class tv_rx_block (stdgui2.std_top_block): if not ((filename is None) or (filename=="usrp")): # file is data source - self.filesource = gr.file_source(gr.sizeof_short,filename,options.repeat) - self.istoc = gr.interleaved_short_to_complex() + self.filesource = blocks.file_source(gr.sizeof_short,filename,options.repeat) + self.istoc = blocks.interleaved_short_to_complex() self.connect(self.filesource,self.istoc) self.src=self.istoc @@ -153,7 +155,7 @@ class tv_rx_block (stdgui2.std_top_block): self.gain = options.gain - f2uc=gr.float_to_uchar() + f2uc = blocks.float_to_uchar() # sdl window as final sink if not (options.pal or options.ntsc): @@ -191,13 +193,13 @@ class tv_rx_block (stdgui2.std_top_block): + " gray:" + options.out_filename print "(Use the spacebar to advance to next frames)" options.repeat=False - file_sink=gr.file_sink(gr.sizeof_char, options.out_filename) + file_sink = blocks.file_sink(gr.sizeof_char, options.out_filename) self.dst =file_sink - self.agc=gr.agc_cc(1e-7,1.0,1.0) #1e-7 - self.am_demod = gr.complex_to_mag () - self.set_blacklevel=gr.add_const_ff(0.0) - self.invert_and_scale = gr.multiply_const_ff (0.0) #-self.contrast *128.0*255.0/(200.0) + self.agc = analog.agc_cc(1e-7,1.0,1.0) #1e-7 + self.am_demod = blocks.complex_to_mag () + self.set_blacklevel = blocks.add_const_ff(0.0) + self.invert_and_scale = blocks.multiply_const_ff (0.0) #-self.contrast *128.0*255.0/(200.0) # now wire it all together #sample_rate=options.width*options.height*options.framerate @@ -223,8 +225,8 @@ class tv_rx_block (stdgui2.std_top_block): elif process_type=='do_nullsink': #self.connect (self.src, self.am_demod,self.invert_and_scale,f2uc,video_sink) - c2r=gr.complex_to_real() - nullsink=gr.null_sink(gr.sizeof_float) + c2r=blocks.complex_to_real() + nullsink=blocks.null_sink(gr.sizeof_float) self.connect (self.src, c2r,nullsink) #video_sink) elif process_type=='do_tv_sync_corr': frame_size=width*height #int(usrp_rate/25.0) @@ -237,14 +239,14 @@ class tv_rx_block (stdgui2.std_top_block): #Note: this block is not yet in cvs tv_corr=gr.tv_correlator_ff(frame_size,nframes, search_window, video_alpha, corr_alpha,debug) - shift=gr.add_const_ff(-0.7) + shift = blocks.add_const_ff(-0.7) self.connect (self.src, self.agc, self.am_demod, tv_corr, self.invert_and_scale, self.set_blacklevel, f2uc, self.dst) else: # process_type=='do_test_image': - src_vertical_bars = gr.sig_source_f (usrp_rate, gr.GR_SIN_WAVE, - 10.0 *usrp_rate/320, 255,128) + src_vertical_bars = analog.sig_source_f(usrp_rate, analog.GR_SIN_WAVE, + 10.0 *usrp_rate/320, 255,128) self.connect(src_vertical_bars, f2uc, self.dst) self._build_gui(vbox, usrp_rate, usrp_rate, usrp_rate) @@ -403,7 +405,8 @@ class tv_rx_block (stdgui2.std_top_block): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool Tuning is a two step process. First we ask the front-end to diff --git a/gr-uhd/examples/python/usrp_tv_rcv_nogui.py b/gr-uhd/examples/python/usrp_tv_rcv_nogui.py index cfb36222cb..80e2e1c17a 100755 --- a/gr-uhd/examples/python/usrp_tv_rcv_nogui.py +++ b/gr-uhd/examples/python/usrp_tv_rcv_nogui.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -35,6 +35,8 @@ development but not yet in cvs. """ from gnuradio import gr, eng_notation +from gnuradio import analog +from gnuradio import blocks from gnuradio import audio from gnuradio import uhd from gnuradio.eng_option import eng_option @@ -118,10 +120,10 @@ class my_top_block(gr.top_block): if not (options.in_filename=="usrp"): # file is data source, capture with usr_rx_csfile.py - self.filesource = gr.file_source(gr.sizeof_short, - options.in_filename, - options.repeat) - self.istoc = gr.interleaved_short_to_complex() + self.filesource = blocks.file_source(gr.sizeof_short, + options.in_filename, + options.repeat) + self.istoc = blocks.interleaved_short_to_complex() self.connect(self.filesource,self.istoc) self.src=self.istoc else: @@ -158,11 +160,11 @@ class my_top_block(gr.top_block): raise SystemExit, 1 - self.agc = gr.agc_cc(1e-7,1.0,1.0) #1e-7 - self.am_demod = gr.complex_to_mag () - self.set_blacklevel = gr.add_const_ff(options.brightness +255.0) - self.invert_and_scale = gr.multiply_const_ff (-options.contrast *128.0*255.0/(200.0)) - self.f2uc = gr.float_to_uchar() + self.agc = analog.agc_cc(1e-7,1.0,1.0) #1e-7 + self.am_demod = blocks.complex_to_mag () + self.set_blacklevel = blocks.add_const_ff(options.brightness +255.0) + self.invert_and_scale = blocks.multiply_const_ff(-options.contrast *128.0*255.0/(200.0)) + self.f2uc = blocks.float_to_uchar() # sdl window as final sink if not (options.pal or options.ntsc): @@ -180,8 +182,7 @@ class my_top_block(gr.top_block): if filename=="sdl": #Here comes the tv screen, you have to build and install - #gr-video-sdl for this (subproject of gnuradio, only in cvs - #for now) + #gr-video-sdl for this (subproject of gnuradio) try: video_sink = video_sdl.sink_uc(frames_per_sec, width, height, 0, show_width,height) @@ -195,13 +196,13 @@ class my_top_block(gr.top_block): print "use the following line to show the demodulated TV-signal:" print "display -depth 8 -size " +str(width)+ "x" + str(height) + " gray:" +filename print "(Use the spacebar to advance to next frames)" - file_sink=gr.file_sink(gr.sizeof_char, filename) + file_sink = blocks.file_sink(gr.sizeof_char, filename) self.dst =file_sink if options.nframes is None: self.connect(self.src, self.agc) else: - self.head = gr.head(gr.sizeof_gr_complex, int(options.nframes*width*height)) + self.head = blocks.head(gr.sizeof_gr_complex, int(options.nframes*width*height)) self.connect(self.src, self.head, self.agc) self.connect (self.agc, self.am_demod, self.invert_and_scale, diff --git a/gr-uhd/examples/python/usrp_wfm_rcv.py b/gr-uhd/examples/python/usrp_wfm_rcv.py index 8ec08260ad..c11c18980c 100755 --- a/gr-uhd/examples/python/usrp_wfm_rcv.py +++ b/gr-uhd/examples/python/usrp_wfm_rcv.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2009,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2009,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,10 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import blocks +from gnuradio import filter +from gnuradio import analog from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form @@ -88,27 +91,27 @@ class wfm_rx_block (stdgui2.std_top_block): dev_rate = self.u.get_samp_rate() nfilts = 32 - chan_coeffs = optfir.low_pass (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 80e3, # passband cutoff - 115e3, # stopband cutoff - 0.1, # passband ripple - 60) # stopband attenuation + chan_coeffs = filter.optfir.low_pass(nfilts, # gain + nfilts*usrp_rate, # sampling rate + 80e3, # passband cutoff + 115e3, # stopband cutoff + 0.1, # passband ripple + 60) # stopband attenuation rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) - self.guts = blks2.wfm_rcv (demod_rate, audio_decim) + self.guts = analog.wfm_rcv(demod_rate, audio_decim) - self.volume_control = gr.multiply_const_ff(self.vol) + self.volume_control = blocks.multiply_const_ff(self.vol) # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), - options.audio_output, - False) # ok_to_block + self.audio_sink = audio.sink(int (audio_rate), + options.audio_output, + False) # ok_to_block # now wire it all together - self.connect (self.u, self.chan_filt, self.guts, - self.volume_control, self.audio_sink) + self.connect(self.u, self.chan_filt, self.guts, + self.volume_control, self.audio_sink) self._build_gui(vbox, usrp_rate, demod_rate, audio_rate) @@ -252,7 +255,8 @@ class wfm_rx_block (stdgui2.std_top_block): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool """ diff --git a/gr-uhd/examples/python/usrp_wfm_rcv2_nogui.py b/gr-uhd/examples/python/usrp_wfm_rcv2_nogui.py index 83f1726c42..c5b42cbf08 100755 --- a/gr-uhd/examples/python/usrp_wfm_rcv2_nogui.py +++ b/gr-uhd/examples/python/usrp_wfm_rcv2_nogui.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,10 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import blocks +from gnuradio import filter +from gnuradio import analog from gnuradio.eng_option import eng_option from optparse import OptionParser import sys @@ -94,12 +97,12 @@ class wfm_rx_block (gr.top_block): # taps for channel filter nfilts = 32 - chan_coeffs = optfir.low_pass (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 80e3, # passband cutoff - 115e3, # stopband cutoff - 0.1, # passband ripple - 60) # stopband attenuation + chan_coeffs = filter.optfir.low_pass(nfilts, # gain + nfilts*usrp_rate, # sampling rate + 80e3, # passband cutoff + 115e3, # stopband cutoff + 0.1, # passband ripple + 60) # stopband attenuation rrate = usrp_rate / dev_rate # set front end PLL to middle frequency @@ -111,9 +114,9 @@ class wfm_rx_block (gr.top_block): options.gain = float(g.start()+g.stop())/2.0 for n in range(2): - chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) - guts = blks2.wfm_rcv (demod_rate, audio_decim) - volume_control = gr.multiply_const_ff(self.vol) + chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) + guts = analog.wfm_rcv(demod_rate, audio_decim) + volume_control = blocks.multiply_const_ff(self.vol) #self.connect((self.di, n), chan_filt) self.connect((self.u, n), chan_filt) diff --git a/gr-uhd/examples/python/usrp_wfm_rcv_fmdet.py b/gr-uhd/examples/python/usrp_wfm_rcv_fmdet.py index 967a3bd8fc..599f0bc460 100755 --- a/gr-uhd/examples/python/usrp_wfm_rcv_fmdet.py +++ b/gr-uhd/examples/python/usrp_wfm_rcv_fmdet.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,10 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import blocks +from gnuradio import filter +from gnuradio import analog from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form, scopesink2 @@ -90,31 +93,31 @@ class wfm_rx_block (stdgui2.std_top_block): dev_rate = self.u.get_samp_rate() nfilts = 32 - chan_coeffs = gr.firdes.low_pass_2(10*nfilts, # gain - nfilts*usrp_rate, # sampling rate - 90e3, # passband cutoff - 30e3, # transition bw - 70) # stopband attenuation + chan_coeffs = filter.firdes.low_pass_2(10*nfilts, # gain + nfilts*usrp_rate, # sampling rate + 90e3, # passband cutoff + 30e3, # transition bw + 70) # stopband attenuation rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) - self.guts = blks2.wfm_rcv_fmdet (demod_rate, audio_decim) + self.guts = analog.wfm_rcv_fmdet (demod_rate, audio_decim) chan_rate = audio_rate / (demod_rate/audio_decim) - self.rchan_filt = blks2.pfb_arb_resampler_fff(chan_rate) - self.lchan_filt = blks2.pfb_arb_resampler_fff(chan_rate) + self.rchan_filt = filter.pfb.arb_resampler_fff(chan_rate) + self.lchan_filt = filter.pfb.arb_resampler_fff(chan_rate) # FIXME rework {add,multiply}_const_* to handle multiple streams - self.volume_control_l = gr.multiply_const_ff(self.vol) - self.volume_control_r = gr.multiply_const_ff(self.vol) + self.volume_control_l = blocks.multiply_const_ff(self.vol) + self.volume_control_r = blocks.multiply_const_ff(self.vol) # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), - options.audio_output, - False) # ok_to_block + self.audio_sink = audio.sink(int (audio_rate), + options.audio_output, + False) # ok_to_block # now wire it all together - self.connect (self.u, self.chan_filt, self.guts) + self.connect(self.u, self.chan_filt, self.guts) self.connect((self.guts, 0), self.lchan_filt, self.volume_control_l, (self.audio_sink,0)) self.connect((self.guts, 1), self.rchan_filt, @@ -314,7 +317,8 @@ class wfm_rx_block (stdgui2.std_top_block): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool """ diff --git a/gr-uhd/examples/python/usrp_wfm_rcv_nogui.py b/gr-uhd/examples/python/usrp_wfm_rcv_nogui.py index 9a7558dc77..134df3b39e 100755 --- a/gr-uhd/examples/python/usrp_wfm_rcv_nogui.py +++ b/gr-uhd/examples/python/usrp_wfm_rcv_nogui.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,10 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import blocks +from gnuradio import filter +from gnuradio import analog from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -82,18 +85,18 @@ class wfm_rx_block (gr.top_block): dev_rate = self.u.get_samp_rate() nfilts = 32 - chan_coeffs = optfir.low_pass (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 80e3, # passband cutoff - 115e3, # stopband cutoff - 0.1, # passband ripple - 60) # stopband attenuation + chan_coeffs = filter.optfir.low_pass(nfilts, # gain + nfilts*usrp_rate, # sampling rate + 80e3, # passband cutoff + 115e3, # stopband cutoff + 0.1, # passband ripple + 60) # stopband attenuation rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) - self.guts = blks2.wfm_rcv (demod_rate, audio_decim) + self.guts = analog.wfm_rcv(demod_rate, audio_decim) - self.volume_control = gr.multiply_const_ff(1) + self.volume_control = blocks.multiply_const_ff(1) # sound card as final sink self.audio_sink = audio.sink(int(audio_rate), @@ -101,8 +104,8 @@ class wfm_rx_block (gr.top_block): False) # ok_to_block # now wire it all together - self.connect (self.u, self.chan_filt, self.guts, - self.volume_control, self.audio_sink) + self.connect(self.u, self.chan_filt, self.guts, + self.volume_control, self.audio_sink) if options.gain is None: # if no gain was specified, use the mid-point in dB @@ -137,7 +140,8 @@ class wfm_rx_block (gr.top_block): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool """ diff --git a/gr-uhd/examples/python/usrp_wfm_rcv_pll.py b/gr-uhd/examples/python/usrp_wfm_rcv_pll.py index 874cab4a8e..4b33cdcbb3 100755 --- a/gr-uhd/examples/python/usrp_wfm_rcv_pll.py +++ b/gr-uhd/examples/python/usrp_wfm_rcv_pll.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,10 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import blocks +from gnuradio import filter +from gnuradio import analog from gnuradio import eng_notation from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate @@ -90,24 +93,24 @@ class wfm_rx_block (stdgui2.std_top_block): dev_rate = self.u.get_samp_rate() nfilts = 32 - chan_coeffs = gr.firdes.low_pass_2 (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 90e3, # passband cutoff - 30e3, # stopband cutoff - 70) # stopband attenuation + chan_coeffs = filter.firdes.low_pass_2(nfilts, # gain + nfilts*usrp_rate, # sampling rate + 90e3, # passband cutoff + 30e3, # stopband cutoff + 70) # stopband attenuation rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) - self.guts = blks2.wfm_rcv_pll (demod_rate, audio_decim) + self.guts = analog.wfm_rcv_pll(demod_rate, audio_decim) chan_rate = audio_rate / (demod_rate/audio_decim) - self.rchan_filt = blks2.pfb_arb_resampler_fff(chan_rate) - self.lchan_filt = blks2.pfb_arb_resampler_fff(chan_rate) + self.rchan_filt = filter.pfb.arb_resampler_fff(chan_rate) + self.lchan_filt = filter.pfb.arb_resampler_fff(chan_rate) # FIXME rework {add,multiply}_const_* to handle multiple streams - self.volume_control_l = gr.multiply_const_ff(self.vol) - self.volume_control_r = gr.multiply_const_ff(self.vol) + self.volume_control_l = blocks.multiply_const_ff(self.vol) + self.volume_control_r = blocks.multiply_const_ff(self.vol) # sound card as final sink self.audio_sink = audio.sink (int (audio_rate), @@ -311,7 +314,8 @@ class wfm_rx_block (stdgui2.std_top_block): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool """ diff --git a/gr-uhd/examples/python/usrp_wfm_rcv_sca.py b/gr-uhd/examples/python/usrp_wfm_rcv_sca.py index 4c6aec23f6..5cbbcd1d8a 100755 --- a/gr-uhd/examples/python/usrp_wfm_rcv_sca.py +++ b/gr-uhd/examples/python/usrp_wfm_rcv_sca.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007,2011 Free Software Foundation, Inc. +# Copyright 2006,2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -50,7 +50,10 @@ OFDM. """ -from gnuradio import gr, optfir, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import blocks +from gnuradio import filter +from gnuradio import analog from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form @@ -121,19 +124,19 @@ class wfm_rx_sca_block (stdgui2.std_top_block): dev_rate = self.u.get_samp_rate() nfilts = 32 - chan_coeffs = optfir.low_pass (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 100e3, # passband cutoff - 140e3, # stopband cutoff - 0.1, # passband ripple - 60) # stopband attenuation + chan_coeffs = filter.optfir.low_pass(nfilts, # gain + nfilts*usrp_rate, # sampling rate + 100e3, # passband cutoff + 140e3, # stopband cutoff + 0.1, # passband ripple + 60) # stopband attenuation rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) - + self.chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) + #Create demodulator block for Main FM Channel max_dev = 75e3 fm_demod_gain = demod_rate/(2*math.pi*max_dev) - self.fm_demod = gr.quadrature_demod_cf (fm_demod_gain) + self.fm_demod = analog.quadrature_demod_cf(fm_demod_gain) # Note - deemphasis is not applied to the Main FM Channel as # main audio is not decoded @@ -143,20 +146,20 @@ class wfm_rx_sca_block (stdgui2.std_top_block): max_sca_dev = 6e3 # Create filter to get SCA channel we want - sca_chan_coeffs = gr.firdes.low_pass (1.0, # gain - demod_rate, # sampling rate - max_sca_dev, # cutoff freq - max_sca_dev/3, # trans. band - gr.firdes.WIN_HANN) # filter type + sca_chan_coeffs = filter.firdes.low_pass(1.0, # gain + demod_rate, # sampling rate + max_sca_dev, # cutoff freq + max_sca_dev/3, # trans. band + filter.firdes.WIN_HANN) # filter type - self.ddc = gr.freq_xlating_fir_filter_fcf(sca_chanfilt_decim, # decim rate - sca_chan_coeffs, # taps - 0, # freq translation amount (Gets set by the UI) - demod_rate) # input sample rate + self.ddc = filter.freq_xlating_fir_filter_fcf(sca_chanfilt_decim, # decim rate + sca_chan_coeffs, # taps + 0, # freq translation amount (Gets set by the UI) + demod_rate) # input sample rate #Create demodulator block for SCA Channel sca_demod_gain = sca_demod_rate/(2*math.pi*max_sca_dev) - self.fm_demod_sca = gr.quadrature_demod_cf (sca_demod_gain) + self.fm_demod_sca = analog.quadrature_demod_cf(sca_demod_gain) # SCA analog audio is bandwidth limited to 5 KHz @@ -166,31 +169,31 @@ class wfm_rx_sca_block (stdgui2.std_top_block): sca_tau = 150e-6 # compute FIR filter taps for SCA audio filter - audio_coeffs = gr.firdes.low_pass (1.0, # gain - sca_demod_rate, # sampling rate - max_sca_audio_freq, # cutoff freq - max_sca_audio_freq/2.5, # trans. band - gr.firdes.WIN_HAMMING) + audio_coeffs = filter.firdes.low_pass(1.0, # gain + sca_demod_rate, # sampling rate + max_sca_audio_freq, # cutoff freq + max_sca_audio_freq/2.5, # trans. band + filter.firdes.WIN_HAMMING) # input: float; output: float - self.audio_filter = gr.fir_filter_fff (audio_decim, audio_coeffs) + self.audio_filter = filter.fir_filter_fff(audio_decim, audio_coeffs) # Create deemphasis block that is applied after SCA demodulation - self.deemph = blks2.fm_deemph (audio_rate, sca_tau) + self.deemph = analog.fm_deemph(audio_rate, sca_tau) - self.volume_control = gr.multiply_const_ff(self.vol) + self.volume_control = blocks.multiply_const_ff(self.vol) # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), - options.audio_output, - False) # ok_to_block + self.audio_sink = audio.sink(int (audio_rate), + options.audio_output, + False) # ok_to_block # now wire it all together - self.connect (self.u, self.chan_filt, self.fm_demod, - self.ddc, self.fm_demod_sca) - self.connect (self.fm_demod_sca, self.audio_filter, - self.deemph, self.volume_control, - self.audio_sink) + self.connect(self.u, self.chan_filt, self.fm_demod, + self.ddc, self.fm_demod_sca) + self.connect(self.fm_demod_sca, self.audio_filter, + self.deemph, self.volume_control, + self.audio_sink) self._build_gui(vbox, usrp_rate, demod_rate, sca_demod_rate, audio_rate) @@ -357,7 +360,8 @@ class wfm_rx_sca_block (stdgui2.std_top_block): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool Tuning is a two step process. First we ask the front-end to diff --git a/gr-uhd/examples/python/usrp_wxapt_rcv.py b/gr-uhd/examples/python/usrp_wxapt_rcv.py index aaf297089e..305149b682 100755 --- a/gr-uhd/examples/python/usrp_wxapt_rcv.py +++ b/gr-uhd/examples/python/usrp_wxapt_rcv.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,10 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import blocks +from gnuradio import filter +from gnuradio import analog from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form @@ -88,24 +91,24 @@ class wxapt_rx_block (stdgui2.std_top_block): dev_rate = self.u.get_samp_rate() nfilts = 32 - chan_coeffs = gr.firdes.low_pass_2 (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 40e3, # passband cutoff - 20e3, # transition bw - 60) # stopband attenuation + chan_coeffs = filter.firdes.low_pass_2(nfilts, # gain + nfilts*usrp_rate, # sampling rate + 40e3, # passband cutoff + 20e3, # transition bw + 60) # stopband attenuation rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) - self.guts = blks2.wfm_rcv (demod_rate, audio_decim) + self.guts = analog.wfm_rcv(demod_rate, audio_decim) - self.volume_control = gr.multiply_const_ff(self.vol) + self.volume_control = blocks.multiply_const_ff(self.vol) # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), options.audio_output) + self.audio_sink = audio.sink(int (audio_rate), options.audio_output) # now wire it all together - self.connect (self.u, self.chan_filt, self.guts, - self.volume_control, self.audio_sink) + self.connect(self.u, self.chan_filt, self.guts, + self.volume_control, self.audio_sink) self._build_gui(vbox, usrp_rate, demod_rate, audio_rate) @@ -247,7 +250,8 @@ class wxapt_rx_block (stdgui2.std_top_block): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool """ |