コード例 #1
0
ファイル: phase_bal.py プロジェクト: danbar/gnuradio
    def __init__(self, alpha=0):
        gr.hier_block2.__init__(
            self, "IQ Phase Balancer",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.alpha = alpha

        ##################################################
        # Blocks
        ##################################################
        self.filter_single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(alpha, 1)
        self.blocks_sub_xx_1 = blocks.sub_ff(1)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_xx_2 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_divide_xx_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.filter_single_pole_iir_filter_xx_0, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_sub_xx_1, 1))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_sub_xx_1, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_divide_xx_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_sub_xx_1, 0))
        self.connect((self.blocks_divide_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.filter_single_pole_iir_filter_xx_0, 0))
        self.connect((self, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self, 0), (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self, 0))
        self.connect((self.filter_single_pole_iir_filter_xx_0, 0), (self.blocks_multiply_xx_2, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_2, 1))
コード例 #2
0
ファイル: amp_bal.py プロジェクト: 0x7678/gnuradio-wg-grc
    def __init__(self, alpha=0):
        gr.hier_block2.__init__(
            self, "Amplitude Balance",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.alpha = alpha

        ##################################################
        # Blocks
        ##################################################
        self.blocks_rms_xx0 = blocks.rms_ff(alpha)
        self.blocks_rms_xx = blocks.rms_ff(alpha)
        self.blocks_multiply_vxx1 = blocks.multiply_vff(1)
        self.blocks_float_to_complex = blocks.float_to_complex(1)
        self.blocks_divide_xx = blocks.divide_ff(1)
        self.blocks_complex_to_float = blocks.complex_to_float(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_float_to_complex, 0), (self, 0))
        self.connect((self, 0), (self.blocks_complex_to_float, 0))
        self.connect((self.blocks_complex_to_float, 0), (self.blocks_rms_xx, 0))
        self.connect((self.blocks_complex_to_float, 1), (self.blocks_rms_xx0, 0))
        self.connect((self.blocks_rms_xx, 0), (self.blocks_divide_xx, 0))
        self.connect((self.blocks_rms_xx0, 0), (self.blocks_divide_xx, 1))
        self.connect((self.blocks_complex_to_float, 0), (self.blocks_float_to_complex, 0))
        self.connect((self.blocks_complex_to_float, 1), (self.blocks_multiply_vxx1, 1))
        self.connect((self.blocks_divide_xx, 0), (self.blocks_multiply_vxx1, 0))
        self.connect((self.blocks_multiply_vxx1, 0), (self.blocks_float_to_complex, 1))
コード例 #3
0
    def __init__(self, abs_cfo_threshold=1e6, alpha=0.001, fft_len=512, fft_peak_threshold=0.5, rf_center_freq=1e9, samp_rate=32e3):
        gr.hier_block2.__init__(
            self, "Coarse Frequency Recovery",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signaturev(2, 2, [gr.sizeof_float*fft_len, gr.sizeof_float*1]),
        )

        ##################################################
        # Parameters
        ##################################################
        self.abs_cfo_threshold = abs_cfo_threshold
        self.alpha = alpha
        self.fft_len = fft_len
        self.fft_peak_threshold = fft_peak_threshold
        self.rf_center_freq = rf_center_freq
        self.samp_rate = samp_rate

        ##################################################
        # Blocks
        ##################################################
        self.logpwrfft_x_0 = logpwrfft.logpwrfft_c(
        	sample_rate=samp_rate,
        	fft_size=fft_len,
        	ref_scale=2,
        	frame_rate=samp_rate/fft_len,
        	avg_alpha=alpha,
        	average=True,
        )
        self.blocksat_wrap_fft_index_0 = blocksat.wrap_fft_index(fft_len)
        self.blocksat_runtime_cfo_ctrl_0 = blocksat.runtime_cfo_ctrl(7*int(1/alpha), abs_cfo_threshold, int(rf_center_freq))
        self.blocksat_exponentiate_const_cci_0 = blocksat.exponentiate_const_cci(4, 1)
        self.blocksat_argpeak_0 = blocksat.argpeak(fft_len, fft_peak_threshold)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vff((samp_rate/(fft_len*4), ))
        self.blocks_moving_average_xx_0_0 = blocks.moving_average_ff(int(1/alpha), 1.0/int(1/alpha), int(4/alpha))
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(int(1/alpha), 1.0/int(1/alpha), int(4/alpha))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.blocks_moving_average_xx_0, 0), (self.blocksat_runtime_cfo_ctrl_0, 1))
        self.connect((self.blocks_moving_average_xx_0_0, 0), (self.blocksat_runtime_cfo_ctrl_0, 2))
        self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blocks_moving_average_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blocksat_runtime_cfo_ctrl_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_moving_average_xx_0_0, 0))
        self.connect((self.blocks_short_to_float_0, 0), (self.blocks_multiply_const_vxx_2, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocksat_argpeak_0, 0), (self.blocksat_wrap_fft_index_0, 0))
        self.connect((self.blocksat_exponentiate_const_cci_0, 0), (self.logpwrfft_x_0, 0))
        self.connect((self.blocksat_runtime_cfo_ctrl_0, 0), (self, 1))
        self.connect((self.blocksat_wrap_fft_index_0, 0), (self.blocks_short_to_float_0, 0))
        self.connect((self.logpwrfft_x_0, 0), (self.blocksat_argpeak_0, 0))
        self.connect((self.logpwrfft_x_0, 0), (self, 0))
        self.connect((self, 0), (self.blocksat_exponentiate_const_cci_0, 0))
コード例 #4
0
ファイル: top_block.py プロジェクト: tshrjn/EE304P
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 50000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, samp_rate, 1000, 1, firdes.WIN_HAMMING, 6.76))
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_float*1, "/home/students/btech/b13236/EE304P/Lab_2/sample_signal", True)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_scopesink2_0, 0))    
コード例 #5
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit='Units',
        	minval=-100,
        	maxval=100,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label='Number Plot',
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_float_to_char_1 = blocks.float_to_char(1, 1)
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blks2_error_rate_0 = grc_blks2.error_rate(
        	type='BER',
        	win_size=1000,
        	bits_per_symbol=8,
        )
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)
        self.analog_noise_source_x_0 = analog.noise_source_f(analog.GR_GAUSSIAN, 0.125, 0)



        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_float_to_char_1, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blks2_error_rate_0, 0), (self.wxgui_numbersink2_0, 0))
        self.connect((self.blocks_float_to_char_0, 0), (self.blks2_error_rate_0, 0))
        self.connect((self.blocks_float_to_char_1, 0), (self.blks2_error_rate_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_float_to_char_0, 0))
コード例 #6
0
    def __init__(self,
                 fgain=128,
                 fir_interp=512,
                 carrier_freq=530e3,
                 rf_sample_rate=8192000,
                 af_sample_rate=16000,
                 filename="pgm1.wav"):
        gr.hier_block2.__init__(
            self,
            "Am Modulator",
            gr.io_signature(0, 0, 0),
            gr.io_signature(1, 1, gr.sizeof_float * 1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.fgain = fgain
        self.fir_interp = fir_interp
        self.carrier_freq = carrier_freq
        self.rf_sample_rate = rf_sample_rate
        self.af_sample_rate = af_sample_rate
        self.filename = filename

        ##################################################
        # Blocks
        ##################################################
        self.low_pass_filter_0 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_0 = blocks.wavfile_source(filename, True)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_0 = analog.sig_source_f(
            rf_sample_rate, analog.GR_COS_WAVE, carrier_freq, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
コード例 #7
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1920000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title='Scope Plot',
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((0, ))
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_scopesink2_0, 0))
コード例 #8
0
    def __init__(self):
        gr.top_block.__init__(self, "Gr Chirp F")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 250000
        self.pi_val = pi_val = 3.14159265359
        self.freq = freq = 115000
        self.sig_on_samples = sig_on_samples = samp_rate
        self.sig_off_samples = sig_off_samples = samp_rate
        self.sens = sens = 2 * pi_val * freq
        self.pre_padding = pre_padding = samp_rate
        self.post_padding = post_padding = 0
        self.npulses = npulses = 2

        ##################################################
        # Blocks
        ##################################################
        self.blocks_vector_source_x_0 = blocks.vector_source_f(
            [0] * pre_padding +
            ([1] * sig_on_samples + [0] * sig_off_samples) * npulses +
            [0] * post_padding, False, 1, [])
        self.blocks_vco_f_0 = blocks.vco_f(samp_rate, sens, 1)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_float * 1,
            '/home/siplab/proj/dsp_ws/cpn_faro/tekever/signals/chirp/chirp.dat',
            False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, samp_rate / 2)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_SAW_WAVE, 1, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_delay_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_vco_f_0, 0))
        self.connect((self.blocks_vco_f_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
コード例 #9
0
    def __init__(self, alpha=0):
        gr.hier_block2.__init__(
            self,
            "Amplitude Balance",
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.alpha = alpha

        ##################################################
        # Blocks
        ##################################################
        self.blocks_rms_xx0 = blocks.rms_ff(alpha)
        self.blocks_rms_xx = blocks.rms_ff(alpha)
        self.blocks_multiply_vxx1 = blocks.multiply_vff(1)
        self.blocks_float_to_complex = blocks.float_to_complex(1)
        self.blocks_divide_xx = blocks.divide_ff(1)
        self.blocks_complex_to_float = blocks.complex_to_float(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_float_to_complex, 0), (self, 0))
        self.connect((self, 0), (self.blocks_complex_to_float, 0))
        self.connect((self.blocks_complex_to_float, 0),
                     (self.blocks_rms_xx, 0))
        self.connect((self.blocks_complex_to_float, 1),
                     (self.blocks_rms_xx0, 0))
        self.connect((self.blocks_rms_xx, 0), (self.blocks_divide_xx, 0))
        self.connect((self.blocks_rms_xx0, 0), (self.blocks_divide_xx, 1))
        self.connect((self.blocks_complex_to_float, 0),
                     (self.blocks_float_to_complex, 0))
        self.connect((self.blocks_complex_to_float, 1),
                     (self.blocks_multiply_vxx1, 1))
        self.connect((self.blocks_divide_xx, 0),
                     (self.blocks_multiply_vxx1, 0))
        self.connect((self.blocks_multiply_vxx1, 0),
                     (self.blocks_float_to_complex, 1))
コード例 #10
0
    def __init__(self):
        gr.top_block.__init__(self, "Signed Multiply Gr")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.file_source_0_0 = blocks.file_source(gr.sizeof_float * 1,
                                                  'data_b.bin', False, 0, 0)
        self.file_source_0_0.set_begin_tag(pmt.PMT_NIL)
        self.file_source_0 = blocks.file_source(gr.sizeof_float * 1,
                                                'data_a.bin', False, 0, 0)
        self.file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_float * 1,
                                                   samp_rate, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float * 1,
                                                   'data_prod.bin', False)
        self.blocks_file_sink_0.set_unbuffered(True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_throttle_0_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.file_source_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.file_source_0_0, 0), (self.blocks_throttle_0_0, 0))
コード例 #11
0
    def __init__(self):
        gr.top_block.__init__(self, "tutorial04")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("tutorial04")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "tutorial04")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 256000

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=3,
            decimation=16,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_freq_sink_x_0_0_0 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0_0_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                      0.0, 0, "")
        self.qtgui_freq_sink_x_0_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0_0.disable_legend()

        if "float" == "float" or "float" == "msg_float":
            self.qtgui_freq_sink_x_0_0_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_0_0_win)
        self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0,
                                                    0, "")
        self.qtgui_freq_sink_x_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_0_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            1, (firdes.low_pass(1, samp_rate, 2000, 100)), 51500, samp_rate)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (0.00001, ))
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            '/home/wuhao/Documents/GRC_examples/ssb_lsb_256k_complex2.dat',
            True)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, 1500, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 1500, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.qtgui_freq_sink_x_0_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.qtgui_freq_sink_x_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.audio_sink_0, 0))
コード例 #12
0
    def __init__(self):
        gr.top_block.__init__(self, "vor_record_sigmf")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("vor_record_sigmf")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "vor_playback_sigmf")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.throttle_rate = throttle_rate = 1
        self.samp_rate = samp_rate = 250e3
        self.fine = fine = 0
        self.decim = decim = 5
        self.audio_gain_30hz = audio_gain_30hz = 1
        self.alpha = alpha = .02

        ##################################################
        # Blocks
        ##################################################
        self._throttle_rate_tool_bar = Qt.QToolBar(self)
        self._throttle_rate_tool_bar.addWidget(
            Qt.QLabel("throttle_rate" + ": "))
        self._throttle_rate_line_edit = Qt.QLineEdit(str(self.throttle_rate))
        self._throttle_rate_tool_bar.addWidget(self._throttle_rate_line_edit)
        self._throttle_rate_line_edit.returnPressed.connect(
            lambda: self.set_throttle_rate(
                eng_notation.str_to_num(
                    str(self._throttle_rate_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._throttle_rate_tool_bar, 0, 6, 1,
                                       2)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(6, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._samp_rate_tool_bar = Qt.QToolBar(self)
        self._samp_rate_tool_bar.addWidget(Qt.QLabel("samp_rate" + ": "))
        self._samp_rate_line_edit = Qt.QLineEdit(str(self.samp_rate))
        self._samp_rate_tool_bar.addWidget(self._samp_rate_line_edit)
        self._samp_rate_line_edit.returnPressed.connect(
            lambda: self.set_samp_rate(
                eng_notation.str_to_num(
                    str(self._samp_rate_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._samp_rate_tool_bar, 0, 4, 1, 2)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 6):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._fine_tool_bar = Qt.QToolBar(self)
        self._fine_tool_bar.addWidget(Qt.QLabel('Fine [Hz]' + ": "))
        self._fine_line_edit = Qt.QLineEdit(str(self.fine))
        self._fine_tool_bar.addWidget(self._fine_line_edit)
        self._fine_line_edit.returnPressed.connect(lambda: self.set_fine(
            eng_notation.str_to_num(str(self._fine_line_edit.text().toAscii()))
        ))
        self.top_grid_layout.addWidget(self._fine_tool_bar, 1, 4, 1, 2)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 6):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.sigmf_source_0 = gr_sigmf.source(
            '/captures/20191216/VOR_2019-12-16T18:51:17Z.sigmf-data',
            "cf32" + ("_le" if sys.byteorder == "little" else "_be"), False)
        self.rational_resampler_xxx_2 = filter.rational_resampler_fff(
            interpolation=66,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
            interpolation=66,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc(
            interpolation=24,
            decimation=25,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=1,
            decimation=decim,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate / decim,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.010)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not True:
            self.qtgui_waterfall_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10)

        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(
            self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 4,
                                       0, 4, 4)
        for r in range(4, 8):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate / decim / 25 * 24,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.0010)
        self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_NORM,
                                                    qtgui.TRIG_SLOPE_POS, 0, 0,
                                                    0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0.enable_grid(True)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 6, 4,
                                       2, 4)
        for r in range(6, 8):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            8192,  #size
            samp_rate / decim / 25 * 24,  #samp_rate
            "30 Hz Variable",  #name
            2  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.0010)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_NORM,
                                                  qtgui.TRIG_SLOPE_POS, 0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(True)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 4, 4, 2,
                                       4)
        for r in range(4, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_f(
            4096,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate / decim / 25 * 24,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_1.enable_grid(False)
        self.qtgui_freq_sink_x_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_1.enable_axis_labels(True)
        self.qtgui_freq_sink_x_1.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_1.disable_legend()

        if "float" == "float" or "float" == "msg_float":
            self.qtgui_freq_sink_x_1.set_plot_pos_half(not False)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_1_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_win, 0, 0, 4,
                                       4)
        for r in range(0, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.low_pass_filter_0_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(10, samp_rate / decim / 25 * 24, 1e3, 500,
                            firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1, firdes.low_pass(1, 48e3, 1, 1, firdes.WIN_HAMMING, 6.76))
        self.dc_blocker_xx_0_0 = filter.dc_blocker_ff(1024, True)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate * throttle_rate,
                                                 True)
        self.blocks_multiply_xx_3 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_2 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_integrate_xx_2 = blocks.integrate_ff(66, 1)
        self.blocks_integrate_xx_0 = blocks.integrate_ff(66, 1)
        self.blocks_float_to_complex_2 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_1 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_divide_xx_0_0 = blocks.divide_ff(1)
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.blocks_delay_1 = blocks.delay(gr.sizeof_float * 1, 0)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, 0)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.band_pass_filter_0_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, samp_rate / decim / 25 * 24, 25, 35, 5,
                             firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, samp_rate / decim / 25 * 24, 25, 35, 5,
                             firdes.WIN_HAMMING, 6.76))
        self._audio_gain_30hz_tool_bar = Qt.QToolBar(self)
        self._audio_gain_30hz_tool_bar.addWidget(Qt.QLabel('vol30' + ": "))
        self._audio_gain_30hz_line_edit = Qt.QLineEdit(
            str(self.audio_gain_30hz))
        self._audio_gain_30hz_tool_bar.addWidget(
            self._audio_gain_30hz_line_edit)
        self._audio_gain_30hz_line_edit.returnPressed.connect(
            lambda: self.set_audio_gain_30hz(
                eng_notation.str_to_num(
                    str(self._audio_gain_30hz_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._audio_gain_30hz_tool_bar, 1, 7, 1,
                                       1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(7, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.analog_sig_source_x_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 9960, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -1 * fine, 1, 0)
        self.analog_pll_carriertracking_cc_0 = analog.pll_carriertracking_cc(
            math.pi / 200, math.pi / 10, -math.pi / 10)
        self.analog_fm_demod_cf_0 = analog.fm_demod_cf(
            channel_rate=samp_rate / decim / 25 * 24,
            audio_decim=1,
            deviation=1e3,
            audio_pass=100,
            audio_stop=200,
            gain=1.0,
            tau=75e-6,
        )
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
            channel_rate=48e3,
            audio_decim=1,
            audio_pass=12000,
            audio_stop=13000,
        )
        self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0.set_max_gain(65536)
        self._alpha_tool_bar = Qt.QToolBar(self)
        self._alpha_tool_bar.addWidget(Qt.QLabel('alpha' + ": "))
        self._alpha_line_edit = Qt.QLineEdit(str(self.alpha))
        self._alpha_tool_bar.addWidget(self._alpha_line_edit)
        self._alpha_line_edit.returnPressed.connect(lambda: self.set_alpha(
            eng_notation.str_to_num(str(self._alpha_line_edit.text().toAscii())
                                    )))
        self.top_grid_layout.addWidget(self._alpha_tool_bar, 1, 6, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(6, 7):
            self.top_grid_layout.setColumnStretch(c, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.qtgui_freq_sink_x_1, 0))
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.analog_fm_demod_cf_0, 0),
                     (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_pll_carriertracking_cc_0, 0),
                     (self.rational_resampler_xxx_0_0_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.band_pass_filter_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.band_pass_filter_0_0, 0),
                     (self.dc_blocker_xx_0_0, 0))
        self.connect((self.blocks_complex_to_arg_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_divide_xx_0, 1))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_divide_xx_0_0, 1))
        self.connect((self.blocks_delay_0, 0), (self.blocks_multiply_xx_3, 0))
        self.connect((self.blocks_delay_1, 0), (self.blocks_multiply_xx_2, 1))
        self.connect((self.blocks_divide_xx_0, 0),
                     (self.blocks_float_to_complex_2, 0))
        self.connect((self.blocks_divide_xx_0_0, 0),
                     (self.blocks_float_to_complex_2, 1))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_float_to_complex_1, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_float_to_complex_2, 0),
                     (self.blocks_complex_to_arg_0, 0))
        self.connect((self.blocks_integrate_xx_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.blocks_integrate_xx_2, 0),
                     (self.rational_resampler_xxx_2, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.analog_agc2_xx_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0),
                     (self.analog_fm_demod_cf_0, 0))
        self.connect((self.blocks_multiply_xx_2, 0),
                     (self.blocks_integrate_xx_0, 0))
        self.connect((self.blocks_multiply_xx_3, 0),
                     (self.blocks_integrate_xx_2, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.blocks_delay_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.blocks_multiply_xx_2, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.dc_blocker_xx_0_0, 0), (self.blocks_delay_1, 0))
        self.connect((self.dc_blocker_xx_0_0, 0),
                     (self.blocks_multiply_xx_3, 1))
        self.connect((self.dc_blocker_xx_0_0, 0),
                     (self.qtgui_time_sink_x_0, 1))
        self.connect((self.low_pass_filter_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.analog_pll_carriertracking_cc_0, 0))
        self.connect((self.rational_resampler_xxx_0_0_0, 0),
                     (self.analog_am_demod_cf_0, 0))
        self.connect((self.rational_resampler_xxx_0_0_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.blocks_divide_xx_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.blocks_float_to_complex_1, 0))
        self.connect((self.rational_resampler_xxx_2, 0),
                     (self.blocks_divide_xx_0_0, 0))
        self.connect((self.rational_resampler_xxx_2, 0),
                     (self.blocks_float_to_complex_1, 1))
        self.connect((self.sigmf_source_0, 0), (self.blocks_throttle_0, 0))
コード例 #13
0
    def __init__(self):
        gr.top_block.__init__(self, "My CW TEst")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("My CW TEst")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "my_cw")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.zeromq_sub_source_0 = zeromq.sub_source(gr.sizeof_float, 1,
                                                     'tcp://127.0.0.1:50001',
                                                     100, False, -1)
        self.qtgui_time_sink_x_2 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            3  #number of inputs
        )
        self.qtgui_time_sink_x_2.set_update_time(0.10)
        self.qtgui_time_sink_x_2.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_2.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_2.enable_tags(True)
        self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_2.enable_autoscale(True)
        self.qtgui_time_sink_x_2.enable_grid(False)
        self.qtgui_time_sink_x_2.enable_axis_labels(True)
        self.qtgui_time_sink_x_2.enable_control_panel(True)
        self.qtgui_time_sink_x_2.enable_stem_plot(False)

        labels = [
            'Audio Bcast', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
            'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(3):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_2.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_2.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_2.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_2.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_2.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_2.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_2_win = sip.wrapinstance(
            self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_2_win)
        self.msz_cw_0 = msz.cw(24, 0.1, 0.5)
        self.epy_block_0 = epy_block_0.blk(learning_vector=1000,
                                           initial_dit_length_samples=4800)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_float * 1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(2)
        self.blocks_int_to_float_0 = blocks.int_to_float(1, 1)
        self.analog_sig_source_x_1_0 = analog.sig_source_f(
            samp_rate, analog.GR_SQR_WAVE, 50, 1, 0, 0)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_rate, analog.GR_SQR_WAVE, 40, 1, 0, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 1000, 1, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.msz_cw_0, 'cwevent'),
                         (self.epy_block_0, 'cwevent'))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.analog_sig_source_x_1_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_int_to_float_0, 0), (self.epy_block_0, 0))
        self.connect((self.blocks_int_to_float_0, 0),
                     (self.qtgui_time_sink_x_2, 2))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.msz_cw_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.qtgui_time_sink_x_2, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_null_sink_1, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.epy_block_0, 0), (self.blocks_null_sink_0, 0))
        self.connect((self.msz_cw_0, 1), (self.blocks_int_to_float_0, 0))
        self.connect((self.msz_cw_0, 0), (self.qtgui_time_sink_x_2, 1))
        self.connect((self.zeromq_sub_source_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
コード例 #14
0
ファイル: top_block.py プロジェクト: saurav2658/IITB-EE-Sem05
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")

        if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            self.restoreGeometry(self.settings.value("geometry").toByteArray())
        else:
            self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 960000

        ##################################################
        # Blocks
        ##################################################
        self.tab = Qt.QTabWidget()
        self.tab_widget_0 = Qt.QWidget()
        self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_0)
        self.tab_grid_layout_0 = Qt.QGridLayout()
        self.tab_layout_0.addLayout(self.tab_grid_layout_0)
        self.tab.addTab(self.tab_widget_0, 'Orig')
        self.tab_widget_1 = Qt.QWidget()
        self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_1)
        self.tab_grid_layout_1 = Qt.QGridLayout()
        self.tab_layout_1.addLayout(self.tab_grid_layout_1)
        self.tab.addTab(self.tab_widget_1, 'Mod')
        self.top_layout.addWidget(self.tab)
        self.qtgui_sink_x_1 = qtgui.sink_f(
        	1024, #fftsize
        	firdes.WIN_HAMMING, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	True, #plotfreq
        	False, #plotwaterfall
        	True, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_1.set_update_time(1.0/10)
        self._qtgui_sink_x_1_win = sip.wrapinstance(self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)
        self.tab_layout_1.addWidget(self._qtgui_sink_x_1_win)

        self.qtgui_sink_x_1.enable_rf_freq(False)



        self.m = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0.8)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_sig_source_x_1 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)
        self.analog_const_source_x_1 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.qtgui_sink_x_1, 0))
        self.connect((self.m, 0), (self.blocks_multiply_xx_0, 0))
コード例 #15
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Intensity Interferometer")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 250e3
		self.magnitude = magnitude = 0.05
		self.integ = integ = 1
		self.beat = beat = 1

		##################################################
		# Blocks
		##################################################
		_magnitude_sizer = wx.BoxSizer(wx.VERTICAL)
		self._magnitude_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_magnitude_sizer,
			value=self.magnitude,
			callback=self.set_magnitude,
			label="Magnitude",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._magnitude_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_magnitude_sizer,
			value=self.magnitude,
			callback=self.set_magnitude,
			minimum=0.05,
			maximum=0.5,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_magnitude_sizer)
		_integ_sizer = wx.BoxSizer(wx.VERTICAL)
		self._integ_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_integ_sizer,
			value=self.integ,
			callback=self.set_integ,
			label="Integration Time (Sec)",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._integ_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_integ_sizer,
			value=self.integ,
			callback=self.set_integ,
			minimum=1,
			maximum=30,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_integ_sizer)
		_beat_sizer = wx.BoxSizer(wx.VERTICAL)
		self._beat_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_beat_sizer,
			value=self.beat,
			callback=self.set_beat,
			label="Beat Frequency (kHz)",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._beat_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_beat_sizer,
			value=self.beat,
			callback=self.set_beat,
			minimum=1,
			maximum=10,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_beat_sizer)
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="2nd detector power level",
			sample_rate=2,
			v_scale=0,
			v_offset=0,
			t_scale=450,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_STRIPCHART,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=samp_rate/10,
			fft_size=1024,
			fft_rate=8,
			average=True,
			avg_alpha=0.1,
			title="First Detector Spectrum",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(1.0/((samp_rate/10)*integ), 1)
		self.low_pass_filter_0 = gr.fir_filter_fff(int(samp_rate/25e3), firdes.low_pass(
			1, samp_rate, 11e3, 2.5e3, firdes.WIN_HAMMING, 6.76))
		self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate)
		self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
		self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_float*1, int(samp_rate/20))
		self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
		self.blocks_add_xx_0 = blocks.add_vcc(1)
		self.band_pass_filter_0 = gr.fir_filter_fff(1, firdes.band_pass(
			1, samp_rate/10, (beat*1000)-100, (beat*1000)+100, 50, firdes.WIN_HAMMING, 6.76))
		self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 122e3, magnitude, 0)
		self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 122e3-(beat*1000), magnitude, 0)
		self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, 0.2, 0)

		##################################################
		# Connections
		##################################################
		self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 2))
		self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_add_xx_0, 1))
		self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_0, 0))
		self.connect((self.blocks_add_xx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
		self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_throttle_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.blocks_throttle_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 1))
		self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.blocks_multiply_xx_0, 0), (self.single_pole_iir_filter_xx_0, 0))
		self.connect((self.blocks_keep_one_in_n_0, 0), (self.wxgui_scopesink2_0, 0))
		self.connect((self.single_pole_iir_filter_xx_0, 0), (self.blocks_keep_one_in_n_0, 0))
コード例 #16
0
ファイル: top_block.py プロジェクト: jmalsbury/oa
    def __init__(self, antenna="TX/RX", vor_freq_1=111e6, com_freq_1=135.275e6, vor_freq_2=111e6, rx_gain=30, gain=20):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.vor_freq_1 = vor_freq_1
        self.com_freq_1 = com_freq_1
        self.vor_freq_2 = vor_freq_2
        self.rx_gain = rx_gain
        self.gain = gain

        ##################################################
        # Variables
        ##################################################
        self.obs_decimation = obs_decimation = 25
        self.ils_decimation = ils_decimation = 50
        self.am_sample_rate = am_sample_rate = 12.5e3
        self.vor_samp_rate = vor_samp_rate = 250e3
        self.vor_freq_entry_2 = vor_freq_entry_2 = vor_freq_2
        self.vor_freq_entry_1 = vor_freq_entry_1 = vor_freq_1
        self.vor_center_freq_0 = vor_center_freq_0 = (117.95e6-108.00e6)/2+117.95e6
        self.vor_center_freq = vor_center_freq = (117.95e6-108.00e6)/2+117.95e6
        self.squelch_slider = squelch_slider = -110
        self.rxgain = rxgain = 15
        self.phase_correction = phase_correction = 5
        self.obs_sample_rate = obs_sample_rate = am_sample_rate/obs_decimation
        self.ils_sample_rate = ils_sample_rate = am_sample_rate/ils_decimation
        self.gain_slider = gain_slider = gain
        self.com_freq_entry_1 = com_freq_entry_1 = com_freq_1
        self.band_center_freq = band_center_freq = (136.975e6-108.0e6)/2+108.0e6
        self.audio_select = audio_select = 0
        self.audio_sample_rate = audio_sample_rate = 48e3
        self.am_decimation = am_decimation = 1

        ##################################################
        # Blocks
        ##################################################
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "RF Analyzer")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Channel FFT")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Demod Audio FFT")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Ref and Phase Scope")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Manipulated Ref and Phase")
        self.Add(self.notebook_0)
        self._vor_freq_entry_1_text_box = forms.text_box(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	value=self.vor_freq_entry_1,
        	callback=self.set_vor_freq_entry_1,
        	label='vor_freq_entry_1',
        	converter=forms.float_converter(),
        )
        self.notebook_0.GetPage(0).Add(self._vor_freq_entry_1_text_box)
        _gain_slider_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_slider_text_box = forms.text_box(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	sizer=_gain_slider_sizer,
        	value=self.gain_slider,
        	callback=self.set_gain_slider,
        	label='gain_slider',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider_slider = forms.slider(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	sizer=_gain_slider_sizer,
        	value=self.gain_slider,
        	callback=self.set_gain_slider,
        	minimum=0,
        	maximum=30,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.notebook_0.GetPage(0).Add(_gain_slider_sizer)
        self._com_freq_entry_1_text_box = forms.text_box(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	value=self.com_freq_entry_1,
        	callback=self.set_com_freq_entry_1,
        	label='com_freq_entry_1',
        	converter=forms.float_converter(),
        )
        self.notebook_0.GetPage(0).Add(self._com_freq_entry_1_text_box)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.notebook_0.GetPage(1).GetWin(),
        	title="Scope Plot",
        	sample_rate=10e3,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=2,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Units",
        	minval=-100,
        	maxval=100,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=10,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Number Plot",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=12.5e3,
        	fft_size=1024,
        	fft_rate=5,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self._vor_freq_entry_2_text_box = forms.text_box(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	value=self.vor_freq_entry_2,
        	callback=self.set_vor_freq_entry_2,
        	label='vor_freq_entry_2',
        	converter=forms.float_converter(),
        )
        self.notebook_0.GetPage(0).Add(self._vor_freq_entry_2_text_box)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	device_addr="",
        	stream_args=uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(2),
        	),
        )
        self.uhd_usrp_source_0.set_subdev_spec("A:0 A:0", 0)
        self.uhd_usrp_source_0.set_samp_rate(vor_samp_rate)
        self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(com_freq_entry_1,rf_freq=band_center_freq, rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0)
        self.uhd_usrp_source_0.set_gain(gain_slider, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_source_0.set_center_freq(uhd.tune_request(vor_freq_entry_1, rf_freq=band_center_freq, rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 1)
        self.uhd_usrp_source_0.set_gain(gain_slider, 1)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 1)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	device_addr="",
        	stream_args=uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_samp_rate(250e3)
        self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(com_freq_entry_1,20e6), 0)
        self.uhd_usrp_sink_0.set_gain(15, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        _squelch_slider_sizer = wx.BoxSizer(wx.VERTICAL)
        self._squelch_slider_text_box = forms.text_box(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	sizer=_squelch_slider_sizer,
        	value=self.squelch_slider,
        	callback=self.set_squelch_slider,
        	label='squelch_slider',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._squelch_slider_slider = forms.slider(
        	parent=self.notebook_0.GetPage(0).GetWin(),
        	sizer=_squelch_slider_sizer,
        	value=self.squelch_slider,
        	callback=self.set_squelch_slider,
        	minimum=-110,
        	maximum=0,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.notebook_0.GetPage(0).Add(_squelch_slider_sizer)
        self.squelch = analog.pwr_squelch_cc(squelch_slider, 0.01, 20, True)
        self.rational_resampler_xxx_2 = filter.rational_resampler_fff(
                interpolation=250,
                decimation=48,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
                interpolation=480,
                decimation=125,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=4,
                decimation=5,
                taps=None,
                fractional_bw=None,
        )
        self.openavionics_joystick_interface_0 = openavionics.joystick_interface()
        self.openavionics_audio_ptt_0 = openavionics.audio_ptt()
        self.null_sink_0_0_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.null_sink_0_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.multiply_xx_0_0_0 = blocks.multiply_vcc(1)
        self.multiply_xx_0_0 = blocks.multiply_vff(1)
        self.low_pass_filter_3 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, 10e3, 1, 2, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2_0_0 = filter.fir_filter_ccf(5, firdes.low_pass(
        	1, 40e3, 2e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2_0 = filter.fir_filter_ccf(5, firdes.low_pass(
        	1, 40e3, 2e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2 = filter.fir_filter_ccf(5, firdes.low_pass(
        	1, vor_samp_rate, 15e3, 5e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_1 = filter.interp_fir_filter_fff(1, firdes.low_pass(
        	1, 12.5e3, 3e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(int(250e3/12.5e3), firdes.low_pass(
        	1, vor_samp_rate, 10e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.goertzel_fc_0_0 = fft.goertzel_fc(10000, 1000, 30)
        self.goertzel_fc_0 = fft.goertzel_fc(40000, 4000, 30)
        self.float_to_complex_0_0 = blocks.float_to_complex(1)
        self.const_source_x_0_0_0 = analog.sig_source_c(0, analog.GR_CONST_WAVE, 0, 0, 0.450)
        self.const_source_x_0_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0.550)
        self.const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0.450)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-87.2665e-3, ))
        self.band_pass_filter_0_0 = filter.fir_filter_fff(4, firdes.band_pass(
        	1, 40e3, 20, 40, 20, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	1, 10e3, 20, 40, 20, firdes.WIN_HAMMING, 6.76))
        self.audio_source_0 = audio.source(48000, "", True)
        self.audio_sink_0 = audio.sink(int(audio_sample_rate), "", True)
        self._audio_select_chooser = forms.drop_down(
        	parent=self.GetWin(),
        	value=self.audio_select,
        	callback=self.set_audio_select,
        	label='audio_select',
        	choices=[0, 1],
        	labels=['AM Voice','VOR Subcarrier'],
        )
        self.Add(self._audio_select_chooser)
        self.analog_sig_source_x_0 = analog.sig_source_c(40e3, analog.GR_COS_WAVE, -9.96e3, 1, 0)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
        	channel_rate=40e3,
        	audio_decim=4,
        	audio_pass=5000,
        	audio_stop=5500,
        )
        self.analog_agc2_xx_0_1_0 = analog.agc2_ff(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_1_0.set_max_gain(100)
        self.analog_agc2_xx_0_1 = analog.agc2_ff(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_1.set_max_gain(100)
        self.analog_agc2_xx_0_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_0.set_max_gain(100)
        self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0.set_max_gain(100)
        self.am_demod_cf_0 = analog.am_demod_cf(
        	channel_rate=am_sample_rate,
        	audio_decim=am_decimation,
        	audio_pass=3e3,
        	audio_stop=4e3,
        )
        self.agc2_xx_0 = analog.agc2_cc(1, 1, 0.75, 1.0)
        self.agc2_xx_0.set_max_gain(0.0)
        self.add_xx_0_0 = blocks.add_vff(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.agc2_xx_0, 0), (self.am_demod_cf_0, 0))
        self.connect((self.am_demod_cf_0, 0), (self.low_pass_filter_1, 0))
        self.connect((self.agc2_xx_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.multiply_xx_0_0, 0), (self.add_xx_0_0, 0))
        self.connect((self.const_source_x_0, 0), (self.multiply_xx_0_0, 1))
        self.connect((self.const_source_x_0_0, 0), (self.add_xx_0_0, 1))
        self.connect((self.multiply_xx_0_0_0, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.add_xx_0_0, 0), (self.float_to_complex_0_0, 0))
        self.connect((self.add_xx_0_0, 0), (self.float_to_complex_0_0, 1))
        self.connect((self.float_to_complex_0_0, 0), (self.multiply_xx_0_0_0, 0))
        self.connect((self.const_source_x_0_0_0, 0), (self.multiply_xx_0_0_0, 1))
        self.connect((self.uhd_usrp_source_0, 0), (self.null_sink_0_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_1, 0), (self.rational_resampler_xxx_1, 0))
        self.connect((self.rational_resampler_xxx_1, 0), (self.audio_sink_0, 0))
        self.connect((self.analog_agc2_xx_0_1_0, 0), (self.wxgui_scopesink2_0, 1))
        self.connect((self.analog_agc2_xx_0_1, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.analog_agc2_xx_0_1, 0))
        self.connect((self.band_pass_filter_0_0, 0), (self.analog_agc2_xx_0_1_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.goertzel_fc_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.wxgui_numbersink2_0, 0))
        self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.low_pass_filter_3, 0), (self.blocks_complex_to_arg_0, 0))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.low_pass_filter_3, 0))
        self.connect((self.analog_agc2_xx_0, 0), (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.analog_agc2_xx_0_0, 0), (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.goertzel_fc_0_0, 0), (self.analog_agc2_xx_0_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.goertzel_fc_0_0, 0))
        self.connect((self.goertzel_fc_0, 0), (self.analog_agc2_xx_0, 0))
        self.connect((self.low_pass_filter_2_0_0, 0), (self.analog_am_demod_cf_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_2_0_0, 0))
        self.connect((self.low_pass_filter_2_0, 0), (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_2_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.uhd_usrp_source_0, 1), (self.null_sink_0_0, 0))
        self.connect((self.low_pass_filter_2, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.audio_source_0, 0), (self.openavionics_audio_ptt_0, 0))
        self.connect((self.openavionics_audio_ptt_0, 0), (self.rational_resampler_xxx_2, 0))
        self.connect((self.rational_resampler_xxx_2, 0), (self.multiply_xx_0_0, 0))
        self.connect((self.squelch, 0), (self.agc2_xx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.squelch, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_2, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.openavionics_joystick_interface_0, "out", self.openavionics_audio_ptt_0, "in2")
コード例 #17
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.MiconstellationObject = MiconstellationObject = digital.constellation_calcdist(
            digital.constellation_qpsk().points(), (0, 1, 2, 3), 4, 1).base()
        self.Constelacion = Constelacion = MiconstellationObject.points()
        self.M = M = len(Constelacion)
        self.samp_rate_usrp_rx = samp_rate_usrp_rx = 100e6
        self.Rb = Rb = 100
        self.Bps = Bps = int(math.log(M, 2))
        self.samp_rate_to_usrp = samp_rate_to_usrp = int(samp_rate_usrp_rx /
                                                         512)
        self.samp_rate_audio = samp_rate_audio = 11000
        self.ntaps = ntaps = 128
        self.Sps = Sps = 160
        self.Rs = Rs = Rb / Bps
        self.Rolloff = Rolloff = 0.5
        self.NbpS = NbpS = 8
        self.samp_rate_0 = samp_rate_0 = int(Rs * Sps)
        self.samp_rate = samp_rate = Rb * Sps
        self.run_stop = run_stop = True
        self.mapinverse = mapinverse = coding.inverse_map(Constelacion)
        self.mapdirect = mapdirect = coding.direct_map(Constelacion)
        self.h_rrc = h_rrc = wform.rrcos(Sps, ntaps, Rolloff)
        self.Vp = Vp = 1.
        self.Tupdate = Tupdate = 1. / Rb
        self.Sps_0 = Sps_0 = int(math.floor(samp_rate_to_usrp / Rs))
        self.Rb_0 = Rb_0 = NbpS * samp_rate_audio
        self.P = P = 0.
        self.NnivelesQ = NnivelesQ = int(math.pow(2, NbpS))
        self.Kf = Kf = 200
        self.F = F = 0.
        self.BW = BW = (Rs / 2) * (1 + Rolloff)
        self.Ar = Ar = 0.
        self.A = A = 1.

        ##################################################
        # Blocks
        ##################################################
        self._P_range = Range(-2. * math.pi, 2. * math.pi,
                              (4. * math.pi) / 360., 0., 200)
        self._P_win = RangeWidget(self._P_range, self.set_P, 'Fase',
                                  "counter_slider", float)
        self.top_grid_layout.addWidget(self._P_win, 1, 1, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._Ar_range = Range(0, 4., (4.) / 50., 0., 200)
        self._Ar_win = RangeWidget(self._Ar_range, self.set_Ar, 'Ruido',
                                   "counter_slider", float)
        self.top_grid_layout.addWidget(self._Ar_win, 2, 0, 1, 1)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._A_range = Range(-1.5, 1.5, (1.5) / 100., 1., 200)
        self._A_win = RangeWidget(self._A_range, self.set_A, 'A',
                                  "counter_slider", float)
        self.top_grid_layout.addWidget(self._A_win, 1, 0, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        _run_stop_check_box = Qt.QCheckBox('Inicial/Parar')
        self._run_stop_choices = {True: True, False: False}
        self._run_stop_choices_inv = dict(
            (v, k) for k, v in self._run_stop_choices.items())
        self._run_stop_callback = lambda i: Qt.QMetaObject.invokeMethod(
            _run_stop_check_box, "setChecked",
            Qt.Q_ARG("bool", self._run_stop_choices_inv[i]))
        self._run_stop_callback(self.run_stop)
        _run_stop_check_box.stateChanged.connect(
            lambda i: self.set_run_stop(self._run_stop_choices[bool(i)]))
        self.top_grid_layout.addWidget(_run_stop_check_box, 0, 0, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_1 = qtgui.time_sink_f(
            1024,  #size
            samp_rate_audio,  #samp_rate
            'Nuevo',  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_1.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_1.set_y_axis(-128, 128)

        self.qtgui_time_sink_x_0_0_1.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0_1.enable_tags(True)
        self.qtgui_time_sink_x_0_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                      qtgui.TRIG_SLOPE_POS,
                                                      0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0_1.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_1.enable_grid(False)
        self.qtgui_time_sink_x_0_0_1.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_1.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0_1.enable_stem_plot(False)

        labels = [
            'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
            'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_1_win)
        self.qtgui_time_sink_x_0_0_0_0_0 = qtgui.time_sink_f(
            1024,  #size
            (samp_rate),  #samp_rate
            "compararacion entre mensaje y EC",  #name
            3  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_0.set_update_time(Tupdate)
        self.qtgui_time_sink_x_0_0_0_0_0.set_y_axis(-1.5, 1.5)

        self.qtgui_time_sink_x_0_0_0_0_0.set_y_label('Amplitud', 'volts')

        self.qtgui_time_sink_x_0_0_0_0_0.enable_tags(True)
        self.qtgui_time_sink_x_0_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0_0_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_stem_plot(False)

        labels = [
            'Mensaje', 'FSK parte real', 'FSK parte Imaginaria', '', '', '',
            '', '', '', ''
        ]
        widths = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(3):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_0_0_win,
                                       4, 1, 1, 2)
        for r in range(4, 5):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 3):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_0_0 = qtgui.time_sink_f(
            1024,  #size
            (samp_rate),  #samp_rate
            "Nivel de Amplitud",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0.set_update_time(Tupdate)
        self.qtgui_time_sink_x_0_0_0_0.set_y_axis(-1.5, 1.5)

        self.qtgui_time_sink_x_0_0_0_0.set_y_label('Amplitud', 'volts')

        self.qtgui_time_sink_x_0_0_0_0.enable_tags(True)
        self.qtgui_time_sink_x_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0_0_0.enable_stem_plot(False)

        labels = ['.', '', '', '', '', '', '', '', '', '']
        widths = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_0_win, 3,
                                       0, 1, 1)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f(
            1024,  #size
            (samp_rate),  #samp_rate
            "Nivel de Fase",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0.set_update_time(Tupdate)
        self.qtgui_time_sink_x_0_0_0.set_y_axis(-2 * math.pi, 2 * math.pi)

        self.qtgui_time_sink_x_0_0_0.set_y_label('Fase', 'radianes')

        self.qtgui_time_sink_x_0_0_0.enable_tags(True)
        self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                      qtgui.TRIG_SLOPE_POS,
                                                      0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0_0.enable_stem_plot(False)

        labels = ['.', '', '', '', '', '', '', '', '', '']
        widths = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_win, 3, 1,
                                       1, 1)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            1024,  #size
            (samp_rate),  #samp_rate
            "Nivel de frecuencia",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(Tupdate)
        self.qtgui_time_sink_x_0_0.set_y_axis(-2.5, 2.5)

        self.qtgui_time_sink_x_0_0.set_y_label('Frecuencia', 'Hz')

        self.qtgui_time_sink_x_0_0.enable_tags(True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                    qtgui.TRIG_SLOPE_POS, 0.0,
                                                    0, 0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0.enable_stem_plot(False)

        labels = ['.', '', '', '', '', '', '', '', '', '']
        widths = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 3, 2,
                                       1, 1)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 3):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_const_sink_x_0_0 = qtgui.const_sink_c(
            8,  #size
            '',  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0_0.set_update_time(Tupdate)
        self.qtgui_const_sink_x_0_0.set_y_axis(-1.5, 1.5)
        self.qtgui_const_sink_x_0_0.set_x_axis(-1.5, 1.5)
        self.qtgui_const_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                     qtgui.TRIG_SLOPE_POS, 0.0,
                                                     0, "")
        self.qtgui_const_sink_x_0_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0_0.enable_grid(False)
        self.qtgui_const_sink_x_0_0.enable_axis_labels(True)

        labels = ['.', '', '', '', '', '', '', '', '', '']
        widths = [4, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "red", "red", "red", "red", "red", "red", "red",
            "red"
        ]
        styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_const_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_0_win, 4, 0,
                                       1, 1)
        for r in range(4, 5):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.epy_block_0 = epy_block_0.blk()
        self.e_VCO_fase_fc_0 = e_VCO_fase_fc_0.blk()
        self.digital_map_bb_0 = digital.map_bb(mapdirect)
        self.digital_diff_encoder_bb_0 = digital.diff_encoder_bb(M)
        self.digital_chunks_to_symbols_xx = digital.chunks_to_symbols_bc(
            MiconstellationObject.points(), 1)
        self.d_freq_cf_assign_freq_cf_0 = d_freq_cf.assign_freq_cf()
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(
            Bps, gr.GR_LSB_FIRST)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0_0_0_1_0_0 = blocks.multiply_const_ff(
            Kf * 2 * math.pi / samp_rate)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_1 = blocks.add_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.b_quantizer_fb_0 = b_quantizer_fb(
            NivelesQ=NnivelesQ,
            Vmax=Vp,
        )
        self.b_bipolar_to_unipolar_ff_0 = b_bipolar_to_unipolar_ff()
        self.b_binary_bipolar_source_f_0 = b_binary_bipolar_source_f(
            Am=1.,
            Spb=Sps,
        )
        self.b_PSD_c_0 = b_PSD_c(
            Ensayos=1000000,
            Fc=0,
            N=1024,
            Ymax=1e-5,
            samp_rate_audio=samp_rate,
        )

        self.top_grid_layout.addWidget(self.b_PSD_c_0, 5, 1, 1, 2)
        for r in range(5, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 3):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.analog_noise_source_x_1 = analog.noise_source_c(
            analog.GR_GAUSSIAN, Ar, 0)
        self.analog_const_source_x_0_0_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, P)
        self.analog_const_source_x_0_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, A)
        self._F_range = Range(-2.4, 2.4, (2 * 2.4) / 1000., 0., 200)
        self._F_win = RangeWidget(self._F_range, self.set_F, 'Frecuencia',
                                  "counter_slider", float)
        self.top_grid_layout.addWidget(self._F_win, 1, 2, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 3):
            self.top_grid_layout.setColumnStretch(c, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0_0, 0),
                     (self.e_VCO_fase_fc_0, 1))
        self.connect((self.analog_const_source_x_0_0, 0),
                     (self.qtgui_time_sink_x_0_0_0_0, 0))
        self.connect((self.analog_const_source_x_0_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.analog_const_source_x_0_0_0, 0),
                     (self.qtgui_time_sink_x_0_0_0, 0))
        self.connect((self.analog_noise_source_x_1, 0),
                     (self.blocks_add_xx_1, 1))
        self.connect((self.b_binary_bipolar_source_f_0, 0),
                     (self.b_bipolar_to_unipolar_ff_0, 0))
        self.connect((self.b_bipolar_to_unipolar_ff_0, 0),
                     (self.b_quantizer_fb_0, 0))
        self.connect((self.b_bipolar_to_unipolar_ff_0, 0),
                     (self.epy_block_0, 0))
        self.connect((self.b_bipolar_to_unipolar_ff_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.b_bipolar_to_unipolar_ff_0, 0),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 0))
        self.connect((self.b_quantizer_fb_0, 0),
                     (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.e_VCO_fase_fc_0, 0))
        self.connect((self.blocks_add_xx_1, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 1))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 2))
        self.connect((self.blocks_multiply_const_vxx_0_0_0_1_0_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.digital_diff_encoder_bb_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.d_freq_cf_assign_freq_cf_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.d_freq_cf_assign_freq_cf_0, 0),
                     (self.qtgui_time_sink_x_0_0_1, 0))
        self.connect((self.digital_chunks_to_symbols_xx, 0),
                     (self.b_PSD_c_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx, 0),
                     (self.d_freq_cf_assign_freq_cf_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx, 0),
                     (self.qtgui_const_sink_x_0_0, 0))
        self.connect((self.digital_diff_encoder_bb_0, 0),
                     (self.digital_map_bb_0, 0))
        self.connect((self.digital_map_bb_0, 0),
                     (self.digital_chunks_to_symbols_xx, 0))
        self.connect((self.e_VCO_fase_fc_0, 0), (self.blocks_add_xx_1, 0))
        self.connect((self.epy_block_0, 0),
                     (self.blocks_multiply_const_vxx_0_0_0_1_0_0, 0))
コード例 #18
0
ファイル: sensor457.py プロジェクト: benblass/ArPi
    def __init__(self, storageval):
        gr.top_block.__init__(self, "Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 192000
        self.pulse_width = pulse_width = 0.07
        self.pseudo_frequency = pseudo_frequency = 1
        self.fft_size = fft_size = 1024
        self.blocksize = blocksize = int(samp_rate / fft_size * pseudo_frequency *1.0 / (1.0 / pulse_width))  / 2
        self.timeout_blocks = timeout_blocks = int(samp_rate/fft_size * 1.0/blocksize)
        self.target_freq = target_freq = 457000
        self.measure = measure = 0
        self.firdes_tap = firdes_tap = firdes.low_pass(1, samp_rate, 500, 1000, firdes.WIN_HAMMING, 6.76)
        self.base_freq = base_freq = 450000
        self.burst_trigger = burst_trigger = 0.75
        self.storageval = storageval

        ##################################################
        # Blocks
        ##################################################
        self.probe = blocks.probe_signal_f()
        self.stbpilot_signal_level_0 = stbpilot.signal_level(6, timeout_blocks)
        def _measure_probe():
            while True:
                val = self.probe.level()
                try:
                    self.set_measure(val)
                    self.storageval.value = val
                except AttributeError:
                    pass
                time.sleep(1.0 / (1))
        _measure_thread = threading.Thread(target=_measure_probe)
        _measure_thread.daemon = True
        _measure_thread.start()
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (firdes_tap), -(base_freq - target_freq), samp_rate)
        self.fft_vxx_0 = fft.fft_vcc(fft_size, True, (), True, 1)
        self.fcdproplus_fcdproplus_0 = fcdproplus.fcdproplus("",1)
        self.fcdproplus_fcdproplus_0.set_lna(1)
        self.fcdproplus_fcdproplus_0.set_mixer_gain(1)
        self.fcdproplus_fcdproplus_0.set_if_gain(0)
        self.fcdproplus_fcdproplus_0.set_freq_corr(0)
        self.fcdproplus_fcdproplus_0.set_freq(base_freq)
          
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, fft_size)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(burst_trigger, burst_trigger, 0)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_size)
        self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_float*1, (int(target_freq*1.0*fft_size/samp_rate)+1)*0+513)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_keep_one_in_n_1 = blocks.keep_one_in_n(gr.sizeof_float*1, fft_size)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.fcdproplus_fcdproplus_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_keep_one_in_n_1, 0), (self.blocks_threshold_ff_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_keep_one_in_n_1, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_skiphead_0, 0))
        self.connect((self.blocks_skiphead_0, 0), (self.blocks_keep_one_in_n_1, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.stbpilot_signal_level_0, 0))
        self.connect((self.stbpilot_signal_level_0, 0), (self.probe, 0))
コード例 #19
0
ファイル: top_block.py プロジェクト: devnulling/ctf
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        try:
             self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
             pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6
        self.carrier_freq = carrier_freq = 25e3

        ##################################################
        # Blocks
        ##################################################
        self._carrier_freq_layout = Qt.QVBoxLayout()
        self._carrier_freq_tool_bar = Qt.QToolBar(self)
        self._carrier_freq_layout.addWidget(self._carrier_freq_tool_bar)
        self._carrier_freq_tool_bar.addWidget(Qt.QLabel("Carrier Freq"+": "))
        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)
            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)
        self._carrier_freq_counter = qwt_counter_pyslot()
        self._carrier_freq_counter.setRange(0, samp_rate/2, 1)
        self._carrier_freq_counter.setNumButtons(2)
        self._carrier_freq_counter.setValue(self.carrier_freq)
        self._carrier_freq_tool_bar.addWidget(self._carrier_freq_counter)
        self._carrier_freq_counter.valueChanged.connect(self.set_carrier_freq)
        self._carrier_freq_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._carrier_freq_slider.setRange(0, samp_rate/2, 1)
        self._carrier_freq_slider.setValue(self.carrier_freq)
        self._carrier_freq_slider.setMinimumWidth(200)
        self._carrier_freq_slider.valueChanged.connect(self.set_carrier_freq)
        self._carrier_freq_layout.addWidget(self._carrier_freq_slider)
        self.top_layout.addLayout(self._carrier_freq_layout)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=1000000,
                decimation=44100,
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(1.0/20)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        colors = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])
        
        self.qtgui_waterfall_sink_x_0.set_intensity_range(-160, -40)
        
        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	40960, #size
        	samp_rate, #samp_rate
        	"", #name
        	2 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["red", "blue", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 0.25, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.blocks_wavfile_source_0 = blocks.wavfile_source("/home/student/Desktop/SuzVega-TomsDinerRemix-44100Hz-mono.wav", True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, 44100,True)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, carrier_freq, 1, 0)
        self.analog_fastnoise_source_x_0 = analog.fastnoise_source_f(analog.GR_GAUSSIAN, 0.0005, 0, 8192)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_add_xx_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.qtgui_time_sink_x_0, 1))
コード例 #20
0
ファイル: top_block.py プロジェクト: CRL-Purdue/vip-sdr
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        try:
             self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
             pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 16000

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	1024, #size
        	samp_rate, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)
        
        self.qtgui_time_sink_x_0.set_y_label("Amplitude", "")
        
        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_number_sink_1 = qtgui.number_sink(
                gr.sizeof_float,
                0,
                qtgui.NUM_GRAPH_HORIZ,
        	1
        )
        self.qtgui_number_sink_1.set_update_time(0.10)
        self.qtgui_number_sink_1.set_title("after float")
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        units = ["", "", "", "", "",
                  "", "", "", "", ""]
        colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")]
        factor = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        for i in xrange(1):
            self.qtgui_number_sink_1.set_min(i, -1)
            self.qtgui_number_sink_1.set_max(i, 1)
            self.qtgui_number_sink_1.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_1.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_1.set_label(i, labels[i])
            self.qtgui_number_sink_1.set_unit(i, units[i])
            self.qtgui_number_sink_1.set_factor(i, factor[i])
        
        self.qtgui_number_sink_1.enable_autoscale(False)
        self._qtgui_number_sink_1_win = sip.wrapinstance(self.qtgui_number_sink_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_number_sink_1_win)
        self.qtgui_number_sink_0 = qtgui.number_sink(
                gr.sizeof_char,
                0,
                qtgui.NUM_GRAPH_HORIZ,
        	1
        )
        self.qtgui_number_sink_0.set_update_time(0.10)
        self.qtgui_number_sink_0.set_title("")
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        units = ["", "", "", "", "",
                  "", "", "", "", ""]
        colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")]
        factor = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        for i in xrange(1):
            self.qtgui_number_sink_0.set_min(i, -1)
            self.qtgui_number_sink_0.set_max(i, 1)
            self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0.set_label(i, labels[i])
            self.qtgui_number_sink_0.set_unit(i, units[i])
            self.qtgui_number_sink_0.set_factor(i, factor[i])
        
        self.qtgui_number_sink_0.enable_autoscale(False)
        self._qtgui_number_sink_0_win = sip.wrapinstance(self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_number_sink_0_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_freq_sink_x_0.disable_legend()
        
        if float == type(float()):
          self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.blocks_unpacked_to_packed_xx_1 = blocks.unpacked_to_packed_bb(8, gr.GR_MSB_FIRST)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
        self.blocks_rms_xx_0_0 = blocks.rms_ff(1)
        self.blocks_rms_xx_0 = blocks.rms_ff(1)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_short*1)
        self.blocks_multiply_xx_0_2 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_integrate_xx_1 = blocks.integrate_ff(samp_rate/80, 1)
        self.blocks_integrate_xx_0_1 = blocks.integrate_ff(samp_rate/80, 1)
        self.blocks_integrate_xx_0_0 = blocks.integrate_ff(samp_rate/80, 1)
        self.blocks_integrate_xx_0 = blocks.integrate_ff(samp_rate/80, 1)
        self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
        self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char*1, "/home/sidekiq/SDR_output", False)
        self.blocks_file_sink_0_0.set_unbuffered(True)
        self.blocks_argmax_xx_0 = blocks.argmax_fs(1)
        self.blocks_add_xx_0_0 = blocks.add_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_abs_xx_0_2 = blocks.abs_ff(1)
        self.blocks_abs_xx_0_1 = blocks.abs_ff(1)
        self.blocks_abs_xx_0_0 = blocks.abs_ff(1)
        self.blocks_abs_xx_0 = blocks.abs_ff(1)
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code="11111111",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
        	),
        )
        self.audio_source_0 = audio.source(16000, "", True)
        self.analog_sig_source_x_1 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1330, 1, 0)
        self.analog_sig_source_x_0_1 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 1330, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 2720, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 2720, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0_0, 0))    
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_2, 0))    
        self.connect((self.analog_sig_source_x_0_1, 0), (self.blocks_multiply_xx_0_1, 0))    
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.audio_source_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.audio_source_0, 0), (self.blocks_multiply_xx_0_0, 1))    
        self.connect((self.audio_source_0, 0), (self.blocks_multiply_xx_0_1, 1))    
        self.connect((self.audio_source_0, 0), (self.blocks_multiply_xx_0_2, 1))    
        self.connect((self.audio_source_0, 0), (self.qtgui_freq_sink_x_0, 0))    
        self.connect((self.audio_source_0, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_unpacked_to_packed_xx_1, 0))    
        self.connect((self.blocks_abs_xx_0, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.blocks_abs_xx_0_0, 0), (self.blocks_add_xx_0_0, 0))    
        self.connect((self.blocks_abs_xx_0_1, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.blocks_abs_xx_0_2, 0), (self.blocks_add_xx_0_0, 1))    
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_rms_xx_0, 0))    
        self.connect((self.blocks_add_xx_0_0, 0), (self.blocks_rms_xx_0_0, 0))    
        self.connect((self.blocks_argmax_xx_0, 0), (self.blocks_null_sink_1, 0))    
        self.connect((self.blocks_argmax_xx_0, 1), (self.blocks_short_to_float_0, 0))    
        self.connect((self.blocks_float_to_uchar_0, 0), (self.blks2_packet_decoder_0, 0))    
        self.connect((self.blocks_float_to_uchar_0, 0), (self.qtgui_number_sink_0, 0))    
        self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_abs_xx_0_2, 0))    
        self.connect((self.blocks_integrate_xx_0_0, 0), (self.blocks_abs_xx_0, 0))    
        self.connect((self.blocks_integrate_xx_0_1, 0), (self.blocks_abs_xx_0_0, 0))    
        self.connect((self.blocks_integrate_xx_1, 0), (self.blocks_abs_xx_0_1, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_integrate_xx_0, 0))    
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_integrate_xx_1, 0))    
        self.connect((self.blocks_multiply_xx_0_1, 0), (self.blocks_integrate_xx_0_1, 0))    
        self.connect((self.blocks_multiply_xx_0_2, 0), (self.blocks_integrate_xx_0_0, 0))    
        self.connect((self.blocks_rms_xx_0, 0), (self.blocks_argmax_xx_0, 1))    
        self.connect((self.blocks_rms_xx_0_0, 0), (self.blocks_argmax_xx_0, 0))    
        self.connect((self.blocks_short_to_float_0, 0), (self.blocks_float_to_uchar_0, 0))    
        self.connect((self.blocks_short_to_float_0, 0), (self.qtgui_number_sink_1, 0))    
        self.connect((self.blocks_unpacked_to_packed_xx_1, 0), (self.blocks_file_sink_0_0, 0))    
コード例 #21
0
ファイル: fm_radio.py プロジェクト: SpinStabilized/fm_radio
    def __init__(self):
        gr.top_block.__init__(self, "FM Radio")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("FM Radio")
        try:
             self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
             pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "fm_radio")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.valid_gains = valid_gains = [0.0, 0.9, 1.4, 2.7, 3.7, 7.7, 8.7, 12.5, 14.4, 15.7, 16.6, 19.7, 20.7, 22.9, 25.4, 28.0, 29.7, 32.8, 33.8, 36.4, 37.2, 38.6, 40.2, 42.1, 43.4, 43.9, 44.5, 48.0, 49.6]
        self.samp_rate = samp_rate = 2.048e6
        self.baseband_decimation = baseband_decimation = 10
        self.rf_gain = rf_gain = len(valid_gains)-1
        self.rds_dec = rds_dec = 10
        self.pilot_tone = pilot_tone = 19e3
        self.baseband_rate = baseband_rate = samp_rate // baseband_decimation
        self.stereo_subcarrier = stereo_subcarrier = pilot_tone * 2
        self.stereo_button = stereo_button = 0
        self.slider_volume = slider_volume = 0
        self.sdr_gain = sdr_gain = valid_gains[rf_gain]
        self.rds_symbols_per_bit = rds_symbols_per_bit = 2
        self.rds_subcarrier = rds_subcarrier = pilot_tone * 3
        self.rds_samp_rate = rds_samp_rate = baseband_rate / rds_dec
        self.rds_bitrate = rds_bitrate = 1.1875e3
        self.rds_bandwidth = rds_bandwidth = 2.83e3
        self.fm_station = fm_station = 102.7
        self.fm_broadcast_seperation = fm_broadcast_seperation = 0.2
        self.fm_broadcast_low = fm_broadcast_low = 87.1
        self.fm_broadcast_high = fm_broadcast_high = 107.9
        self.audio_rate = audio_rate = 48e3

        ##################################################
        # Blocks
        ##################################################
        self.notebook_top = Qt.QTabWidget()
        self.notebook_top_widget_0 = Qt.QWidget()
        self.notebook_top_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_top_widget_0)
        self.notebook_top_grid_layout_0 = Qt.QGridLayout()
        self.notebook_top_layout_0.addLayout(self.notebook_top_grid_layout_0)
        self.notebook_top.addTab(self.notebook_top_widget_0, "RF Receive")
        self.notebook_top_widget_1 = Qt.QWidget()
        self.notebook_top_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_top_widget_1)
        self.notebook_top_grid_layout_1 = Qt.QGridLayout()
        self.notebook_top_layout_1.addLayout(self.notebook_top_grid_layout_1)
        self.notebook_top.addTab(self.notebook_top_widget_1, "Baseband")
        self.notebook_top_widget_2 = Qt.QWidget()
        self.notebook_top_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_top_widget_2)
        self.notebook_top_grid_layout_2 = Qt.QGridLayout()
        self.notebook_top_layout_2.addLayout(self.notebook_top_grid_layout_2)
        self.notebook_top.addTab(self.notebook_top_widget_2, "Mono Audio")
        self.notebook_top_widget_3 = Qt.QWidget()
        self.notebook_top_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_top_widget_3)
        self.notebook_top_grid_layout_3 = Qt.QGridLayout()
        self.notebook_top_layout_3.addLayout(self.notebook_top_grid_layout_3)
        self.notebook_top.addTab(self.notebook_top_widget_3, "Sub-Carrier Generation")
        self.notebook_top_widget_4 = Qt.QWidget()
        self.notebook_top_layout_4 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_top_widget_4)
        self.notebook_top_grid_layout_4 = Qt.QGridLayout()
        self.notebook_top_layout_4.addLayout(self.notebook_top_grid_layout_4)
        self.notebook_top.addTab(self.notebook_top_widget_4, "Stereo")
        self.notebook_top_widget_5 = Qt.QWidget()
        self.notebook_top_layout_5 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_top_widget_5)
        self.notebook_top_grid_layout_5 = Qt.QGridLayout()
        self.notebook_top_layout_5.addLayout(self.notebook_top_grid_layout_5)
        self.notebook_top.addTab(self.notebook_top_widget_5, "RDS")
        self.top_grid_layout.addWidget(self.notebook_top, 3, 0, 1, 8)
        self._slider_volume_range = Range(0, 11.1, 0.1, 0, 100)
        self._slider_volume_win = RangeWidget(self._slider_volume_range, self.set_slider_volume, 'Volume', "counter_slider", float)
        self.top_grid_layout.addWidget(self._slider_volume_win, 1, 1, 1, 1)
        self.notebook_subcarriers = Qt.QTabWidget()
        self.notebook_subcarriers_widget_0 = Qt.QWidget()
        self.notebook_subcarriers_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_subcarriers_widget_0)
        self.notebook_subcarriers_grid_layout_0 = Qt.QGridLayout()
        self.notebook_subcarriers_layout_0.addLayout(self.notebook_subcarriers_grid_layout_0)
        self.notebook_subcarriers.addTab(self.notebook_subcarriers_widget_0, "Pilot Signal")
        self.notebook_subcarriers_widget_1 = Qt.QWidget()
        self.notebook_subcarriers_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_subcarriers_widget_1)
        self.notebook_subcarriers_grid_layout_1 = Qt.QGridLayout()
        self.notebook_subcarriers_layout_1.addLayout(self.notebook_subcarriers_grid_layout_1)
        self.notebook_subcarriers.addTab(self.notebook_subcarriers_widget_1, "Spectrum")
        self.notebook_top_grid_layout_3.addWidget(self.notebook_subcarriers, 0, 0, 1, 1)
        self.notebook_rds = Qt.QTabWidget()
        self.notebook_rds_widget_0 = Qt.QWidget()
        self.notebook_rds_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_rds_widget_0)
        self.notebook_rds_grid_layout_0 = Qt.QGridLayout()
        self.notebook_rds_layout_0.addLayout(self.notebook_rds_grid_layout_0)
        self.notebook_rds.addTab(self.notebook_rds_widget_0, "RDS Signal")
        self.notebook_rds_widget_1 = Qt.QWidget()
        self.notebook_rds_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_rds_widget_1)
        self.notebook_rds_grid_layout_1 = Qt.QGridLayout()
        self.notebook_rds_layout_1.addLayout(self.notebook_rds_grid_layout_1)
        self.notebook_rds.addTab(self.notebook_rds_widget_1, "RDS Bitstream")
        self.notebook_top_grid_layout_5.addWidget(self.notebook_rds, 0, 0, 1, 1)
        self._fm_station_range = Range(fm_broadcast_low, fm_broadcast_high, fm_broadcast_seperation, 102.7, 200)
        self._fm_station_win = RangeWidget(self._fm_station_range, self.set_fm_station, "FM Station", "counter_slider", float)
        self.top_grid_layout.addWidget(self._fm_station_win, 0, 0, 1, 8)
        self._stereo_button_options = (0, 1, )
        self._stereo_button_labels = ("Mono", "Stereo", )
        self._stereo_button_tool_bar = Qt.QToolBar(self)
        self._stereo_button_tool_bar.addWidget(Qt.QLabel("Audio Output"+": "))
        self._stereo_button_combo_box = Qt.QComboBox()
        self._stereo_button_tool_bar.addWidget(self._stereo_button_combo_box)
        for label in self._stereo_button_labels: self._stereo_button_combo_box.addItem(label)
        self._stereo_button_callback = lambda i: Qt.QMetaObject.invokeMethod(self._stereo_button_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._stereo_button_options.index(i)))
        self._stereo_button_callback(self.stereo_button)
        self._stereo_button_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_stereo_button(self._stereo_button_options[i]))
        self.top_grid_layout.addWidget(self._stereo_button_tool_bar, 1, 2, 1, 1)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(fm_station * 1e6, 0)
        self.rtlsdr_source_0.set_freq_corr(14, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(2, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(sdr_gain, 0)
        self.rtlsdr_source_0.set_if_gain(0, 0)
        self.rtlsdr_source_0.set_bb_gain(0, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.root_raised_cosine_filter_0 = filter.fir_filter_ccf(1, firdes.root_raised_cosine(
        	2, rds_samp_rate, rds_bitrate * rds_symbols_per_bit, 0.275, 16))
        self._rf_gain_range = Range(0, len(valid_gains)-1, 1, len(valid_gains)-1, 200)
        self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF Gain", "counter_slider", int)
        self.top_grid_layout.addWidget(self._rf_gain_win, 1, 0, 1, 1)
        self.rds_qt_panel_0 = self.rds_qt_panel_0 = rds.qt_panel()
        self.notebook_top_layout_5.addWidget(self.rds_qt_panel_0)
          
        self.rational_resampler_xxx_0_0_0_1 = filter.rational_resampler_fff(
                interpolation=int(audio_rate),
                decimation=int(baseband_rate),
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0_0_0 = filter.rational_resampler_fff(
                interpolation=int(audio_rate),
                decimation=int(baseband_rate),
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_fff(
                interpolation=int(audio_rate),
                decimation=int(baseband_rate),
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_time_sink_x_1 = qtgui.time_sink_f(
        	1024, #size
        	samp_rate, #samp_rate
        	"RBDS Bit Stream", #name
        	2 #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1.set_y_axis(-1.7, 1.7)
        
        self.qtgui_time_sink_x_1.set_y_label("Amplitude", "")
        
        self.qtgui_time_sink_x_1.enable_tags(-1, False)
        self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_1.enable_autoscale(False)
        self.qtgui_time_sink_x_1.enable_grid(True)
        self.qtgui_time_sink_x_1.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_1.disable_legend()
        
        labels = ["Raw Bit Stream", "Differential Decoded", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_1_win = sip.wrapinstance(self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.notebook_rds_layout_1.addWidget(self._qtgui_time_sink_x_1_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	1024, #size
        	baseband_rate, #samp_rate
        	"19 KHz Pilot Signal", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1.5, 1.5)
        
        self.qtgui_time_sink_x_0.set_y_label("Amplitude", "counts")
        
        self.qtgui_time_sink_x_0.enable_tags(-1, False)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        
        if not False:
          self.qtgui_time_sink_x_0.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.notebook_subcarriers_grid_layout_0.addWidget(self._qtgui_time_sink_x_0_win, 0, 1, 1, 1)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	rds_samp_rate, #bw
        	"RDS Subcarrier Signal (DSB-SSC)", #name
        	2 #number of inputs
        )
        self.qtgui_freq_sink_x_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-100, 0)
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_1.enable_grid(False)
        self.qtgui_freq_sink_x_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_1.enable_control_panel(False)
        
        if not False:
          self.qtgui_freq_sink_x_1.disable_legend()
        
        if complex == type(float()):
          self.qtgui_freq_sink_x_1.set_plot_pos_half(not True)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget)
        self.notebook_rds_grid_layout_0 .addWidget(self._qtgui_freq_sink_x_1_win,  0, 0, 1, 1)
        self.qtgui_freq_sink_x_0_1_0_1_0 = qtgui.freq_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	audio_rate, #bw
        	"Stereo Audio Left", #name
        	2 #number of inputs
        )
        self.qtgui_freq_sink_x_0_1_0_1_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_1_0_1_0.set_y_axis(-100, -30)
        self.qtgui_freq_sink_x_0_1_0_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_1_0_1_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_1_0_1_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_1_0_1_0.set_fft_average(0.1)
        self.qtgui_freq_sink_x_0_1_0_1_0.enable_control_panel(False)
        
        if not False:
          self.qtgui_freq_sink_x_0_1_0_1_0.disable_legend()
        
        if float == type(float()):
          self.qtgui_freq_sink_x_0_1_0_1_0.set_plot_pos_half(not False)
        
        labels = ["Stereo Left", "Stereo Right", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_1_0_1_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_1_0_1_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_1_0_1_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_1_0_1_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_1_0_1_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_1_0_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_1_0_1_0.pyqwidget(), Qt.QWidget)
        self.notebook_top_grid_layout_4.addWidget(self._qtgui_freq_sink_x_0_1_0_1_0_win, 0, 0, 1, 1)
        self.qtgui_freq_sink_x_0_1_0_1 = qtgui.freq_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	audio_rate, #bw
        	"Stereo Audio Right", #name
        	2 #number of inputs
        )
        self.qtgui_freq_sink_x_0_1_0_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_1_0_1.set_y_axis(-100, -30)
        self.qtgui_freq_sink_x_0_1_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_1_0_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_1_0_1.enable_grid(False)
        self.qtgui_freq_sink_x_0_1_0_1.set_fft_average(0.1)
        self.qtgui_freq_sink_x_0_1_0_1.enable_control_panel(False)
        
        if not False:
          self.qtgui_freq_sink_x_0_1_0_1.disable_legend()
        
        if float == type(float()):
          self.qtgui_freq_sink_x_0_1_0_1.set_plot_pos_half(not False)
        
        labels = ["Stereo Right", "Stereo Right", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_1_0_1.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_1_0_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_1_0_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_1_0_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_1_0_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_1_0_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_1_0_1.pyqwidget(), Qt.QWidget)
        self.notebook_top_grid_layout_4.addWidget(self._qtgui_freq_sink_x_0_1_0_1_win, 0, 1, 1, 1)
        self.qtgui_freq_sink_x_0_1_0_0 = qtgui.freq_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	baseband_rate, #bw
        	"Pilot & Stereo Carrier", #name
        	2 #number of inputs
        )
        self.qtgui_freq_sink_x_0_1_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_1_0_0.set_y_axis(-80, 0)
        self.qtgui_freq_sink_x_0_1_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_1_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_1_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_1_0_0.set_fft_average(0.1)
        self.qtgui_freq_sink_x_0_1_0_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_freq_sink_x_0_1_0_0.disable_legend()
        
        if float == type(float()):
          self.qtgui_freq_sink_x_0_1_0_0.set_plot_pos_half(not False)
        
        labels = ["Pilot Tone", "Stereo Carrier", "RDS Carrier", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_1_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_1_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_1_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_1_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_1_0_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_1_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_1_0_0.pyqwidget(), Qt.QWidget)
        self.notebook_subcarriers_grid_layout_1.addWidget(self._qtgui_freq_sink_x_0_1_0_0_win, 0, 0, 1, 1)
        self.qtgui_freq_sink_x_0_0_0 = qtgui.freq_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	audio_rate, #bw
        	"Mono Audio (L+R)", #name
        	2 #number of inputs
        )
        self.qtgui_freq_sink_x_0_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0_0.set_y_axis(-100, -30)
        self.qtgui_freq_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0_0.set_fft_average(0.2)
        self.qtgui_freq_sink_x_0_0_0.enable_control_panel(False)
        
        if not False:
          self.qtgui_freq_sink_x_0_0_0.disable_legend()
        
        if float == type(float()):
          self.qtgui_freq_sink_x_0_0_0.set_plot_pos_half(not False)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.notebook_top_grid_layout_2.addWidget(self._qtgui_freq_sink_x_0_0_0_win, 1, 0, 1, 5)
        self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	baseband_rate, #bw
        	"FM Baseband", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0.set_y_axis(-100, -30)
        self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0.set_fft_average(0.1)
        self.qtgui_freq_sink_x_0_0.enable_control_panel(False)
        
        if not False:
          self.qtgui_freq_sink_x_0_0.disable_legend()
        
        if float == type(float()):
          self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not False)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.notebook_top_grid_layout_1.addWidget(self._qtgui_freq_sink_x_0_0_win, 0, 1, 1, 1)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	fm_station * 1e6, #fc
        	samp_rate, #bw
        	"RF Frequency", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-90, 0)
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(0.1)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)
        
        if not False:
          self.qtgui_freq_sink_x_0.disable_legend()
        
        if complex == type(float()):
          self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.notebook_top_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_win, 0, 1, 1, 1)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
        	1024, #size
        	"RDS BPSK Constellation", #name
        	1 #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-1.6, 1.6)
        self.qtgui_const_sink_x_0.set_x_axis(-1.6, 1.6)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0.enable_grid(True)
        
        if not False:
          self.qtgui_const_sink_x_0.disable_legend()
        
        labels = ["RBDS BPSK", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "red", "red", "red",
                  "red", "red", "red", "red", "red"]
        styles = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0,
                   0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.notebook_rds_grid_layout_0.addWidget(self._qtgui_const_sink_x_0_win, 0, 1, 1, 1)
        self.low_pass_filter_4 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, baseband_rate, 60e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, baseband_rate, 16e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_1 = filter.fir_filter_fff(1, firdes.low_pass(
        	10, baseband_rate, 15e3, 3e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(baseband_decimation, firdes.low_pass(
        	1, samp_rate, 75e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.gr_rds_parser_0 = rds.parser(False, False, 1)
        self.gr_rds_decoder_0 = rds.decoder(False, False)
        self.freq_xlating_fir_filter_xxx_1 = filter.freq_xlating_fir_filter_fcc(rds_dec, (firdes.low_pass(2500,baseband_rate,rds_bandwidth,1e3,firdes.WIN_HAMMING)), rds_subcarrier, baseband_rate)
        self.digital_mpsk_receiver_cc_0 = digital.mpsk_receiver_cc(2, 0, (2 * cmath.pi) / 100, -0.00006, 0.00006, 0.5, 0.05, rds_samp_rate / (rds_bitrate * 2), ((rds_samp_rate / (rds_bitrate * 2)) ** 2)/ 4, 0.005)
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_uchar_to_float_0_0 = blocks.uchar_to_float()
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_1_0_1_0_1 = blocks.multiply_const_vff((11, ))
        self.blocks_multiply_const_vxx_1_0_1_0_0 = blocks.multiply_const_vff((11, ))
        self.blocks_multiply_const_vxx_1_0_1_0 = blocks.multiply_const_vff((11, ))
        self.blocks_multiply_const_vxx_1_0_1 = blocks.multiply_const_vff((slider_volume, ))
        self.blocks_multiply_const_vxx_1_0_0 = blocks.multiply_const_vff((slider_volume, ))
        self.blocks_multiply_const_vxx_1_0 = blocks.multiply_const_vff((slider_volume, ))
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_char*1, 2)
        self.blocks_complex_to_real_1 = blocks.complex_to_real(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0_0 = blocks.add_const_vff((0.5, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1.5, ))
        self.blks2_selector_0_0 = grc_blks2.selector(
        	item_size=gr.sizeof_float*1,
        	num_inputs=2,
        	num_outputs=1,
        	input_index=0,
        	output_index=0,
        )
        self.blks2_selector_0 = grc_blks2.selector(
        	item_size=gr.sizeof_float*1,
        	num_inputs=2,
        	num_outputs=1,
        	input_index=0,
        	output_index=0,
        )
        self.band_pass_filter_1 = filter.fir_filter_fff(1, firdes.band_pass(
        	1, baseband_rate, stereo_subcarrier - 0.5e3, stereo_subcarrier + 0.5e3, 0.5e3, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	1, baseband_rate, 23e3, 53e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.fir_filter_fcc(1, firdes.complex_band_pass(
        	1, baseband_rate, pilot_tone - 0.5e3, pilot_tone+0.5e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(48000, "", True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=baseband_rate,
        	audio_decimation=1,
        )
        self.analog_pll_refout_cc_0 = analog.pll_refout_cc(1e-3, 2 * cmath.pi * (19000+200) / baseband_rate, 2 * cmath.pi * (19000-200) / baseband_rate)
        self.analog_fm_deemph_0_0_0_1 = analog.fm_deemph(fs=baseband_rate, tau=75e-6)
        self.analog_fm_deemph_0_0_0_0 = analog.fm_deemph(fs=baseband_rate, tau=75e-6)
        self.analog_fm_deemph_0_0_0 = analog.fm_deemph(fs=baseband_rate, tau=75e-6)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.gr_rds_decoder_0, 'out'), (self.gr_rds_parser_0, 'in'))    
        self.msg_connect((self.gr_rds_parser_0, 'out'), (self.rds_qt_panel_0, 'in'))    
        self.connect((self.analog_fm_deemph_0_0_0, 0), (self.rational_resampler_xxx_0_0_0, 0))    
        self.connect((self.analog_fm_deemph_0_0_0_0, 0), (self.rational_resampler_xxx_0_0_0_0, 0))    
        self.connect((self.analog_fm_deemph_0_0_0_1, 0), (self.rational_resampler_xxx_0_0_0_1, 0))    
        self.connect((self.analog_pll_refout_cc_0, 0), (self.blocks_complex_to_real_1, 0))    
        self.connect((self.analog_wfm_rcv_0, 0), (self.low_pass_filter_4, 0))    
        self.connect((self.band_pass_filter_0, 0), (self.analog_pll_refout_cc_0, 0))    
        self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_1, 1))    
        self.connect((self.band_pass_filter_1, 0), (self.blocks_multiply_xx_1, 0))    
        self.connect((self.band_pass_filter_1, 0), (self.qtgui_freq_sink_x_0_1_0_0, 1))    
        self.connect((self.blks2_selector_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.blks2_selector_0_0, 0), (self.audio_sink_0, 1))    
        self.connect((self.blocks_add_const_vxx_0, 0), (self.qtgui_time_sink_x_1, 1))    
        self.connect((self.blocks_add_const_vxx_0_0, 0), (self.qtgui_time_sink_x_1, 0))    
        self.connect((self.blocks_add_xx_0, 0), (self.analog_fm_deemph_0_0_0_0, 0))    
        self.connect((self.blocks_complex_to_real_0, 0), (self.digital_binary_slicer_fb_0, 0))    
        self.connect((self.blocks_complex_to_real_1, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.blocks_complex_to_real_1, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_complex_to_real_1, 0), (self.qtgui_freq_sink_x_0_1_0_0, 0))    
        self.connect((self.blocks_complex_to_real_1, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_uchar_to_float_0, 0))    
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.digital_diff_decoder_bb_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_1_0, 0), (self.blks2_selector_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_1_0, 0), (self.qtgui_freq_sink_x_0_1_0_1, 1))    
        self.connect((self.blocks_multiply_const_vxx_1_0_0, 0), (self.blks2_selector_0_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_1_0_0, 0), (self.qtgui_freq_sink_x_0_1_0_1_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_1_0_1, 0), (self.blks2_selector_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_1_0_1, 0), (self.blks2_selector_0_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_1_0_1, 0), (self.qtgui_freq_sink_x_0_0_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_1_0_1_0, 0), (self.qtgui_freq_sink_x_0_0_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_1_0_1_0_0, 0), (self.qtgui_freq_sink_x_0_1_0_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_1_0_1_0_1, 0), (self.qtgui_freq_sink_x_0_1_0_1_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.band_pass_filter_1, 0))    
        self.connect((self.blocks_multiply_xx_1, 0), (self.low_pass_filter_2, 0))    
        self.connect((self.blocks_sub_xx_0, 0), (self.analog_fm_deemph_0_0_0, 0))    
        self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_add_const_vxx_0_0, 0))    
        self.connect((self.blocks_uchar_to_float_0_0, 0), (self.blocks_add_const_vxx_0, 0))    
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_keep_one_in_n_0, 0))    
        self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_uchar_to_float_0_0, 0))    
        self.connect((self.digital_diff_decoder_bb_0, 0), (self.gr_rds_decoder_0, 0))    
        self.connect((self.digital_mpsk_receiver_cc_0, 0), (self.blocks_complex_to_real_0, 0))    
        self.connect((self.digital_mpsk_receiver_cc_0, 0), (self.qtgui_const_sink_x_0, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.qtgui_freq_sink_x_1, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.root_raised_cosine_filter_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))    
        self.connect((self.low_pass_filter_1, 0), (self.analog_fm_deemph_0_0_0_1, 0))    
        self.connect((self.low_pass_filter_1, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.low_pass_filter_1, 0), (self.blocks_sub_xx_0, 0))    
        self.connect((self.low_pass_filter_2, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.low_pass_filter_2, 0), (self.blocks_sub_xx_0, 1))    
        self.connect((self.low_pass_filter_4, 0), (self.band_pass_filter_0, 0))    
        self.connect((self.low_pass_filter_4, 0), (self.band_pass_filter_0_0, 0))    
        self.connect((self.low_pass_filter_4, 0), (self.freq_xlating_fir_filter_xxx_1, 0))    
        self.connect((self.low_pass_filter_4, 0), (self.low_pass_filter_1, 0))    
        self.connect((self.low_pass_filter_4, 0), (self.qtgui_freq_sink_x_0_0, 0))    
        self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.blocks_multiply_const_vxx_1_0, 0))    
        self.connect((self.rational_resampler_xxx_0_0_0, 0), (self.blocks_multiply_const_vxx_1_0_1_0_0, 0))    
        self.connect((self.rational_resampler_xxx_0_0_0_0, 0), (self.blocks_multiply_const_vxx_1_0_0, 0))    
        self.connect((self.rational_resampler_xxx_0_0_0_0, 0), (self.blocks_multiply_const_vxx_1_0_1_0_1, 0))    
        self.connect((self.rational_resampler_xxx_0_0_0_1, 0), (self.blocks_multiply_const_vxx_1_0_1, 0))    
        self.connect((self.rational_resampler_xxx_0_0_0_1, 0), (self.blocks_multiply_const_vxx_1_0_1_0, 0))    
        self.connect((self.root_raised_cosine_filter_0, 0), (self.digital_mpsk_receiver_cc_0, 0))    
        self.connect((self.root_raised_cosine_filter_0, 0), (self.qtgui_freq_sink_x_1, 1))    
        self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0))    
コード例 #22
0
ファイル: rds_rx.py プロジェクト: bkerler/gr-rds
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Stereo FM receiver and RDS Decoder")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.xlate_decim = xlate_decim = 4
        self.samp_rate = samp_rate = 1000000
        self.freq_offset = freq_offset = 250e3
        self.freq = freq = 88.5e6
        self.baseband_rate = baseband_rate = samp_rate/xlate_decim
        self.audio_decim = audio_decim = 4
        self.xlate_bandwidth = xlate_bandwidth = 250e3
        self.volume = volume = 0
        self.loop_bw = loop_bw = 16e3*0 + 18e3*1
        self.gain = gain = 10
        self.freq_tune = freq_tune = freq - freq_offset
        self.audio_rate = audio_rate = 48000
        self.audio_decim_rate = audio_decim_rate = baseband_rate/audio_decim
        self.antenna = antenna = 'TX/RX'

        ##################################################
        # Message Queues
        ##################################################
        gr_rds_data_decoder_0_msgq_out = gr_rds_panel_0_msgq_in = gr.msg_queue(2)

        ##################################################
        # Blocks
        ##################################################
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_volume_sizer,
        	value=self.volume,
        	callback=self.set_volume,
        	label="Volume",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._volume_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_volume_sizer,
        	value=self.volume,
        	callback=self.set_volume,
        	minimum=-20,
        	maximum=10,
        	num_steps=300,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_volume_sizer)
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "BB")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Demod")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "L+R")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Pilot")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "DSBSC")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "RDS Raw")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "L-R")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "RDS")
        self.Add(self.nb)
        _loop_bw_sizer = wx.BoxSizer(wx.VERTICAL)
        self._loop_bw_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_loop_bw_sizer,
        	value=self.loop_bw,
        	callback=self.set_loop_bw,
        	label="Loop BW",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._loop_bw_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_loop_bw_sizer,
        	value=self.loop_bw,
        	callback=self.set_loop_bw,
        	minimum=0,
        	maximum=baseband_rate,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_loop_bw_sizer)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label="Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0,
        	maximum=50,
        	num_steps=50,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_gain_sizer)
        self._freq_offset_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.freq_offset,
        	callback=self.set_freq_offset,
        	label="Freq Offset",
        	converter=forms.float_converter(),
        )
        self.Add(self._freq_offset_text_box)
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	label="Freq",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freq_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	minimum=87.5e6,
        	maximum=108e6,
        	num_steps=205,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freq_sizer)
        self._antenna_chooser = forms.drop_down(
        	parent=self.GetWin(),
        	value=self.antenna,
        	callback=self.set_antenna,
        	label="Antenna",
        	choices=['TX/RX', 'RX2'],
        	labels=[],
        )
        self.Add(self._antenna_chooser)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.nb.GetPage(3).GetWin(),
        	title="Pilot",
        	sample_rate=baseband_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.nb.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_0_0_1_0_1 = fftsink2.fft_sink_f(
        	self.nb.GetPage(7).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=-50,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="RDS",
        	peak_hold=False,
        )
        self.nb.GetPage(7).Add(self.wxgui_fftsink2_0_0_0_1_0_1.win)
        self.wxgui_fftsink2_0_0_0_1_0_0 = fftsink2.fft_sink_f(
        	self.nb.GetPage(6).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=-50,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="L-R",
        	peak_hold=False,
        )
        self.nb.GetPage(6).Add(self.wxgui_fftsink2_0_0_0_1_0_0.win)
        self.wxgui_fftsink2_0_0_0_1_0 = fftsink2.fft_sink_f(
        	self.nb.GetPage(5).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="RDS",
        	peak_hold=False,
        )
        self.nb.GetPage(5).Add(self.wxgui_fftsink2_0_0_0_1_0.win)
        self.wxgui_fftsink2_0_0_0_1 = fftsink2.fft_sink_f(
        	self.nb.GetPage(4).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="DSBSC Sub-carrier",
        	peak_hold=False,
        )
        self.nb.GetPage(4).Add(self.wxgui_fftsink2_0_0_0_1.win)
        self.wxgui_fftsink2_0_0_0 = fftsink2.fft_sink_f(
        	self.nb.GetPage(2).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=audio_decim_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="L+R",
        	peak_hold=False,
        )
        self.nb.GetPage(2).Add(self.wxgui_fftsink2_0_0_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_f(
        	self.nb.GetPage(1).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=True,
        	avg_alpha=0.8,
        	title="FM Demod",
        	peak_hold=False,
        )
        self.nb.GetPage(1).Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.nb.GetPage(0).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=-30,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=True,
        	avg_alpha=0.8,
        	title="Baseband",
        	peak_hold=False,
        )
        self.nb.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(freq_tune, 0)
        self.uhd_usrp_source_0.set_gain(gain, 0)
        self.uhd_usrp_source_0.set_antenna(antenna, 0)
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
                interpolation=audio_rate,
                decimation=audio_decim_rate,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=audio_rate,
                decimation=audio_decim_rate,
                taps=None,
                fractional_bw=None,
        )
        self.gr_rds_panel_0 = rds.rdsPanel(gr_rds_panel_0_msgq_in, freq, self.GetWin())
        self.Add(self.gr_rds_panel_0)
        self.gr_rds_freq_divider_0 = rds.freq_divider(16)
        self.gr_rds_data_decoder_0 = rds.data_decoder(gr_rds_data_decoder_0_msgq_out)
        self.gr_rds_bpsk_demod_0 = rds.bpsk_demod(audio_decim_rate)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(xlate_decim, (firdes.low_pass(1, samp_rate, xlate_bandwidth/2, 1000)), freq_offset, samp_rate)
        self.fir_filter_xxx_7 = filter.fir_filter_fff(audio_decim, (firdes.low_pass(1,baseband_rate,1.2e3,1.5e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_7.declare_sample_delay(0)
        self.fir_filter_xxx_6 = filter.fir_filter_fff(audio_decim, (firdes.low_pass(1,baseband_rate,1.5e3,2e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_6.declare_sample_delay(0)
        self.fir_filter_xxx_5 = filter.fir_filter_fff(audio_decim, (firdes.low_pass(1.0,baseband_rate,15e3,1e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_5.declare_sample_delay(0)
        self.fir_filter_xxx_4 = filter.fir_filter_fff(1, (firdes.band_pass(1.0,baseband_rate,57e3-3e3,57e3+3e3,3e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_4.declare_sample_delay(0)
        self.fir_filter_xxx_3 = filter.fir_filter_fff(1, (firdes.band_pass(1.0,baseband_rate,38e3-15e3/2,38e3+15e3/2,1e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_3.declare_sample_delay(0)
        self.fir_filter_xxx_2 = filter.fir_filter_fff(1, (firdes.band_pass(1.0,baseband_rate,19e3-500,19e3+500,1e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_2.declare_sample_delay(0)
        self.fir_filter_xxx_1 = filter.fir_filter_fff(audio_decim, (firdes.low_pass(1.0,baseband_rate,15e3,1e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_1.declare_sample_delay(0)
        self.fir_filter_xxx_0 = filter.fir_filter_ccc(1, (firdes.low_pass(1.0, baseband_rate, 80e3,35e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((10**(1.*volume/10), ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((10**(1.*volume/10), ))
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.audio_sink_0 = audio.sink(audio_rate, "", True)
        self.analog_pll_freqdet_cf_0 = analog.pll_freqdet_cf(1.0*0 + (loop_bw*2*math.pi/baseband_rate), +(2.0 * math.pi * 90e3 / baseband_rate), -(2.0 * math.pi * 90e3 / baseband_rate))
        self.analog_fm_deemph_1 = analog.fm_deemph(fs=baseband_rate, tau=75e-6)
        self.analog_fm_deemph_0 = analog.fm_deemph(fs=baseband_rate, tau=75e-6)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.uhd_usrp_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.fir_filter_xxx_0, 0))
        self.connect((self.fir_filter_xxx_2, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.fir_filter_xxx_2, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.fir_filter_xxx_2, 0), (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.fir_filter_xxx_2, 0), (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.fir_filter_xxx_3, 0), (self.blocks_multiply_xx_0, 2))
        self.connect((self.fir_filter_xxx_4, 0), (self.blocks_multiply_xx_0_0, 3))
        self.connect((self.fir_filter_xxx_2, 0), (self.blocks_multiply_xx_0_0, 2))
        self.connect((self.fir_filter_xxx_1, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.fir_filter_xxx_2, 0), (self.gr_rds_freq_divider_0, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.fir_filter_xxx_5, 0))
        self.connect((self.gr_rds_freq_divider_0, 0), (self.fir_filter_xxx_7, 0))
        self.connect((self.fir_filter_xxx_7, 0), (self.gr_rds_bpsk_demod_0, 1))
        self.connect((self.digital_diff_decoder_bb_0, 0), (self.gr_rds_data_decoder_0, 0))
        self.connect((self.gr_rds_bpsk_demod_0, 0), (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.fir_filter_xxx_6, 0), (self.gr_rds_bpsk_demod_0, 0))
        self.connect((self.fir_filter_xxx_2, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.wxgui_fftsink2_0_0_0, 0))
        self.connect((self.fir_filter_xxx_3, 0), (self.wxgui_fftsink2_0_0_0_1, 0))
        self.connect((self.fir_filter_xxx_4, 0), (self.wxgui_fftsink2_0_0_0_1_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.fir_filter_xxx_6, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.wxgui_fftsink2_0_0_0_1_0_0, 0))
        self.connect((self.fir_filter_xxx_5, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.fir_filter_xxx_5, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.fir_filter_xxx_0, 0), (self.analog_pll_freqdet_cf_0, 0))
        self.connect((self.analog_pll_freqdet_cf_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.analog_pll_freqdet_cf_0, 0), (self.fir_filter_xxx_1, 0))
        self.connect((self.analog_pll_freqdet_cf_0, 0), (self.fir_filter_xxx_2, 0))
        self.connect((self.analog_pll_freqdet_cf_0, 0), (self.fir_filter_xxx_4, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.analog_fm_deemph_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.wxgui_fftsink2_0_0_0_1_0_1, 0))
        self.connect((self.analog_fm_deemph_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0), (self.audio_sink_0, 1))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.rational_resampler_xxx_1, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.analog_fm_deemph_1, 0))
        self.connect((self.analog_fm_deemph_1, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.analog_pll_freqdet_cf_0, 0), (self.fir_filter_xxx_3, 0))
コード例 #23
0
ファイル: polyglot.py プロジェクト: debanjum/Polyglots
    def __init__(self):
        gr.top_block.__init__(self, "Polyglot")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Polyglot")
        try:
             self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
             pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "polyglot")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 8
        self.samp_rate = samp_rate = 32000
        self.psk_samp_rate = psk_samp_rate = 31.25
        self.fsk_scale = fsk_scale = 1.2
        self.freq = freq = 1000
        self.bw = bw = 75

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=int(samp_rate/(sps*psk_samp_rate)),
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_sink_x_0 = qtgui.sink_f(
        	1024, #fftsize
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"QT GUI Plot", #name
        	True, #plotfreq
        	True, #plotwaterfall
        	True, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0/10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_sink_x_0_win)
        
        
        self.digital_psk_mod_0 = digital.psk.psk_mod(
          constellation_points=2,
          mod_code="none",
          differential=True,
          samples_per_symbol=sps,
          excess_bw=0.01,
          verbose=False,
          log=False,
          )
        self.blocks_not_xx_0 = blocks.not_ii()
        self.blocks_multiply_xx_1_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.9, ))
        self.blocks_int_to_float_0_0 = blocks.int_to_float(1, fsk_scale)
        self.blocks_int_to_float_0 = blocks.int_to_float(1, fsk_scale)
        self.blocks_file_source_0_0_0 = blocks.file_source(gr.sizeof_int*1, "baudotmessage.bin", True)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "varicodemessage.bin", True)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.band_pass_filter_0_1 = filter.interp_fir_filter_fff(1, firdes.band_pass(
        	1, samp_rate, 500, 1500, 10, firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(samp_rate, "", True)
        self.analog_sig_source_x_1 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, freq+bw, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, freq-bw, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_int_to_float_0_0, 0), (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_multiply_xx_1_0, 0), (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_file_source_0_0_0, 0), (self.blocks_not_xx_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_int_to_float_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_file_source_0_0_0, 0), (self.blocks_int_to_float_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.band_pass_filter_0_1, 0))
        self.connect((self.band_pass_filter_0_1, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.band_pass_filter_0_1, 0), (self.audio_sink_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_1_0, 0))
        self.connect((self.blocks_not_xx_0, 0), (self.blocks_int_to_float_0_0, 0))
        self.connect((self.digital_psk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_1_0, 1))
        self.connect((self.blocks_file_source_0, 0), (self.digital_psk_mod_0, 0))
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 0))
コード例 #24
0
ファイル: SorDeRa_sdr.py プロジェクト: Ismas/SorDeRa
    def __init__(self):
        gr.top_block.__init__(self, "RX logic")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 192000
        self.mode = mode = 2
        self.bw = bw = 3200
        self.aud_rate = aud_rate = 22050
        self.visualsq = visualsq = 1
        self.st = st = 1
        self.sq = sq = -700
        self.sb_pos = sb_pos = ((bw*mode==2)-(bw*mode==3))
        self.rec = rec = 1
        self.laj_0 = laj_0 = 0
        self.laj = laj = 0
        self.lai_0 = lai_0 = 0
        self.lai = lai = 0
        self.freq = freq = 98500000
        self.device = device = "fcd=0,type=2"
        self.dev = dev = 19000
        self.decimation = decimation = samp_rate/aud_rate
        self.batswitch = batswitch = 0
        self.batido = batido = 2950
        self.VEC = VEC = 1280

        ##################################################
        # Blocks
        ##################################################
        self.rtlsdr_source_0 = osmosdr.source( args="nchan=" + str(1) + " " + device )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(7, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(0, 0)
        self.rtlsdr_source_0.set_gain(14, 0)
        self.rtlsdr_source_0.set_if_gain(14, 0)
        self.rtlsdr_source_0.set_bb_gain(14, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.probe_st = analog.probe_avg_mag_sqrd_f(10, 1)
        self.low_pass_filter_0_2 = filter.fir_filter_ccf(decimation, firdes.low_pass(
        	1, samp_rate, bw*(2+(mode==2)+(mode==3)), 500, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_1_0_0_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, samp_rate, 14000, 1000, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_1 = filter.fir_filter_fff(1, firdes.low_pass(
        	30, samp_rate, 14000, 1000, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_0_0_0 = filter.interp_fir_filter_fff(1, firdes.low_pass(
        	visualsq, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_0_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0 = filter.fir_filter_ccf(1, firdes.high_pass(
        	1, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76))
        self.fractional_resampler_xx_0_0_0 = filter.fractional_resampler_ff(0, samp_rate/48000.0)
        self.fractional_resampler_xx_0_0 = filter.fractional_resampler_ff(0, samp_rate/48000.0)
        self.fractional_resampler_xx_0 = filter.fractional_resampler_ff(0, (samp_rate/decimation)/48000.0)
        self.fft_vxx_0 = fft.fft_vcc(VEC, True, (window.blackmanharris(1024)), True, 1)
        self.fft_probe = blocks.probe_signal_vf(VEC)
        self.blocks_wavfile_sink_0 = blocks.wavfile_sink("/tmp/CAPTURE.WAV", 2, 48000, 16)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, VEC)
        self.blocks_multiply_xx_0_1_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_real_0_0_0_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(VEC)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((-complex(lai,laj), ))
        self.blks2_valve_0_1 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(rec))
        self.blks2_valve_0_0_1 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(mode!=5))
        self.blks2_valve_0_0_0 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(0))
        self.blks2_valve_0_0 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(mode!=4))
        self.blks2_valve_0 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(rec))
        self.blks2_selector_0_1_0 = grc_blks2.selector(
        	item_size=gr.sizeof_gr_complex*1,
        	num_inputs=2,
        	num_outputs=1,
        	input_index=(mode==3),
        	output_index=0,
        )
        self.blks2_selector_0_0_1_0 = grc_blks2.selector(
        	item_size=gr.sizeof_float*1,
        	num_inputs=3,
        	num_outputs=1,
        	input_index=(mode>3)+(mode>4),
        	output_index=0,
        )
        self.blks2_selector_0_0_1 = grc_blks2.selector(
        	item_size=gr.sizeof_float*1,
        	num_inputs=3,
        	num_outputs=1,
        	input_index=(mode>3)+(mode>4),
        	output_index=0,
        )
        self.blks2_selector_0_0 = grc_blks2.selector(
        	item_size=gr.sizeof_float*1,
        	num_inputs=4,
        	num_outputs=1,
        	input_index=mode,
        	output_index=0,
        )
        self.blks2_selector_0 = grc_blks2.selector(
        	item_size=gr.sizeof_gr_complex*1,
        	num_inputs=1,
        	num_outputs=4,
        	input_index=0,
        	output_index=mode,
        )
        self.band_pass_filter_0_0_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	250, samp_rate, 18500, 19500, 500, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	120, samp_rate, 24000, 52000, 1000, firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(48000, "dmix:CARD=Pro,DEV=0", False)
        self.analog_wfm_rcv_1 = analog.wfm_rcv(
        	quad_rate=samp_rate,
        	audio_decimation=1,
        )
        self.analog_sig_source_x_0_0_0 = analog.sig_source_c(samp_rate/decimation, analog.GR_COS_WAVE, -bw, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, dev+(bw*mode==2)+(bw*mode==3), 1, 0)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(0.25)
        self.analog_fm_demod_cf_0 = analog.fm_demod_cf(
        	channel_rate=samp_rate,
        	audio_decim=samp_rate/48000,
        	deviation=50000,
        	audio_pass=15000,
        	audio_stop=16000,
        	gain=3.0,
        	tau=50e-6,
        )
        self.analog_fm_deemph_0_0 = analog.fm_deemph(fs=48000, tau=50e-6)
        self.analog_fm_deemph_0 = analog.fm_deemph(fs=48000, tau=50e-6)
        self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(64, 0.9)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
        	channel_rate=samp_rate/decimation,
        	audio_decim=samp_rate/decimation/aud_rate,
        	audio_pass=(samp_rate/decimation/2)-500,
        	audio_stop=(samp_rate/decimation/2)-100,
        )
        self.analog_agc3_xx_0 = analog.agc3_cc(0.0001, 0.0001, 0.9, 0.1)
        self.analog_agc3_xx_0.set_max_gain(200)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.fft_probe, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blks2_valve_0_0_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0, 0))
        self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_0_1_0, 0))
        self.connect((self.low_pass_filter_0_1, 0), (self.analog_fm_deemph_0, 0))
        self.connect((self.analog_fm_deemph_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.analog_wfm_rcv_1, 0), (self.low_pass_filter_0_1, 0))
        self.connect((self.analog_wfm_rcv_1, 0), (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_wfm_rcv_1, 0), (self.band_pass_filter_0_0_0, 0))
        self.connect((self.analog_fm_deemph_0_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.low_pass_filter_0_1_0_0_0, 0), (self.analog_fm_deemph_0_0, 0))
        self.connect((self.analog_agc3_xx_0, 0), (self.analog_wfm_rcv_1, 0))
        self.connect((self.blks2_valve_0_0_1, 0), (self.analog_agc3_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0_1, 0))
        self.connect((self.blocks_multiply_xx_0_1_0, 0), (self.low_pass_filter_0_1_0_0_0, 0))
        self.connect((self.band_pass_filter_0_0_0, 0), (self.blocks_multiply_xx_0_1_0, 1))
        self.connect((self.band_pass_filter_0_0_0, 0), (self.blocks_multiply_xx_0_1_0, 2))
        self.connect((self.analog_fm_deemph_0_0, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.analog_fm_deemph_0, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.fractional_resampler_xx_0_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.fractional_resampler_xx_0_0, 0))
        self.connect((self.blks2_valve_0_0, 0), (self.analog_fm_demod_cf_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_2, 0))
        self.connect((self.blocks_complex_to_real_0_0_0_0, 0), (self.blks2_selector_0_0, 3))
        self.connect((self.blocks_complex_to_real_0_0_0_0, 0), (self.blks2_selector_0_0, 2))
        self.connect((self.blks2_selector_0_1_0, 0), (self.blocks_multiply_xx_0_0_0, 0))
        self.connect((self.blocks_multiply_xx_0_0_0, 0), (self.blocks_complex_to_real_0_0_0_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0, 0), (self.blocks_multiply_xx_0_0_0, 1))
        self.connect((self.analog_am_demod_cf_0, 0), (self.blks2_selector_0_0, 0))
        self.connect((self.blks2_selector_0, 0), (self.analog_am_demod_cf_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blks2_selector_0_0, 1))
        self.connect((self.blks2_selector_0, 1), (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.blks2_selector_0_0, 0), (self.low_pass_filter_0_0_0_0, 0))
        self.connect((self.blks2_selector_0, 2), (self.high_pass_filter_0, 0))
        self.connect((self.blks2_selector_0, 3), (self.low_pass_filter_0_0_0, 0))
        self.connect((self.high_pass_filter_0, 0), (self.blks2_selector_0_1_0, 0))
        self.connect((self.low_pass_filter_0_0_0, 0), (self.blks2_selector_0_1_0, 1))
        self.connect((self.analog_fm_demod_cf_0, 0), (self.blks2_selector_0_0_1, 1))
        self.connect((self.analog_fm_demod_cf_0, 0), (self.blks2_selector_0_0_1_0, 1))
        self.connect((self.fractional_resampler_xx_0_0_0, 0), (self.blks2_selector_0_0_1_0, 2))
        self.connect((self.fractional_resampler_xx_0_0, 0), (self.blks2_selector_0_0_1, 2))
        self.connect((self.blks2_selector_0_0_1_0, 0), (self.audio_sink_0, 1))
        self.connect((self.blks2_selector_0_0_1, 0), (self.audio_sink_0, 0))
        self.connect((self.blks2_valve_0, 0), (self.blocks_wavfile_sink_0, 1))
        self.connect((self.blks2_selector_0_0_1_0, 0), (self.blks2_valve_0, 0))
        self.connect((self.blks2_selector_0_0_1, 0), (self.blks2_valve_0_1, 0))
        self.connect((self.blks2_valve_0_1, 0), (self.blocks_wavfile_sink_0, 0))
        self.connect((self.fractional_resampler_xx_0, 0), (self.blks2_selector_0_0_1_0, 0))
        self.connect((self.fractional_resampler_xx_0, 0), (self.blks2_selector_0_0_1, 0))
        self.connect((self.low_pass_filter_0_2, 0), (self.analog_feedforward_agc_cc_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.low_pass_filter_0_0_0_0, 0), (self.fractional_resampler_xx_0, 0))
        self.connect((self.analog_feedforward_agc_cc_0, 0), (self.blks2_selector_0, 0))
        self.connect((self.band_pass_filter_0_0_0, 0), (self.probe_st, 0))
コード例 #25
0
    def __init__(self):
        gr.top_block.__init__(self, "Message Test")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Message Test")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "message_test")

        if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            self.restoreGeometry(self.settings.value("geometry").toByteArray())
        else:
            self.restoreGeometry(
                self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 16
        self.nfilts = nfilts = 32
        self.timing_loop_bw = timing_loop_bw = 62.8e-3
        self.taps_0 = taps_0 = [1.0, 0.25 - 0.25j, 0.50 + 0.10j, -0.3 + 0.2j]
        self.taps = taps = [
            1.0 + 0.0j,
        ]
        self.samp_rate_0 = samp_rate_0 = 10e3
        self.samp_rate = samp_rate = 32e3
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(sps), 0.35, 11 * sps * nfilts)
        self.phase_bw = phase_bw = 62.8e-3
        self.lpf_transition_width = lpf_transition_width = 500
        self.lpf_cutoff_freq = lpf_cutoff_freq = 3e3
        self.excess_bw = excess_bw = 0.35
        self.eq_gain = eq_gain = 10e-3
        self.center_freq = center_freq = 5e3
        self.bpsk = bpsk = digital.constellation_rect(
            ([1 + 1j, -1 + 1j, -1 - 1j, 1 - 1j]), ([0, 1, 2, 3]), 4, 2, 2, 1,
            1).base()
        self.arity = arity = 4

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_1_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "Test: Downconersion",  #name
            2  #number of inputs
        )
        self.qtgui_time_sink_x_1_0.set_update_time(0.10)
        self.qtgui_time_sink_x_1_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_1_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_1_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                    qtgui.TRIG_SLOPE_POS, 0.0,
                                                    0, 0, "")
        self.qtgui_time_sink_x_1_0.enable_autoscale(False)
        self.qtgui_time_sink_x_1_0.enable_grid(False)
        self.qtgui_time_sink_x_1_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_1_0.enable_control_panel(False)
        self.qtgui_time_sink_x_1_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_1_0.disable_legend()

        labels = [
            'Down_Baseband', 'Bandpass', 'Passband(Real)', 'Passband(Img)', '',
            '', '', '', '', ''
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_1_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_0_win)
        self.qtgui_time_sink_x_1 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "Test: Upconersion",  #name
            2  #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_1.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_1.enable_autoscale(False)
        self.qtgui_time_sink_x_1.enable_grid(False)
        self.qtgui_time_sink_x_1.enable_axis_labels(True)
        self.qtgui_time_sink_x_1.enable_control_panel(False)
        self.qtgui_time_sink_x_1.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_1.disable_legend()

        labels = [
            'Baseband', 'Bandpass', 'Passband(Real)', 'Passband(Img)', '', '',
            '', '', '', ''
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_win)
        self.qtgui_freq_sink_x_1_1 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Down Conversion and LPF",  #name
            3  #number of inputs
        )
        self.qtgui_freq_sink_x_1_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1_1.set_y_axis(-100, 0)
        self.qtgui_freq_sink_x_1_1.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_1_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0,
                                                    0, "")
        self.qtgui_freq_sink_x_1_1.enable_autoscale(True)
        self.qtgui_freq_sink_x_1_1.enable_grid(False)
        self.qtgui_freq_sink_x_1_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_1_1.enable_axis_labels(True)
        self.qtgui_freq_sink_x_1_1.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_1_1.disable_legend()

        if "float" == "float" or "float" == "msg_float":
            self.qtgui_freq_sink_x_1_1.set_plot_pos_half(not True)

        labels = ['Bandpass', 'IF', 'LPF', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(3):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_1_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1_1.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_1_1_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_1_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_1_1_win)
        self.low_pass_filter_0_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, lpf_cutoff_freq,
                            lpf_transition_width, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, lpf_cutoff_freq,
                            lpf_transition_width, firdes.WIN_HAMMING, 6.76))
        self.digital_pfb_clock_sync_xxx_0_0_0 = digital.pfb_clock_sync_ccf(
            sps, timing_loop_bw, (rrc_taps), nfilts, nfilts / 2, 1.5, 1)
        self.digital_constellation_modulator_0 = digital.generic_mod(
            constellation=bpsk,
            differential=False,
            samples_per_symbol=sps,
            pre_diff_code=True,
            excess_bw=excess_bw,
            verbose=True,
            log=False,
        )
        self.digital_constellation_decoder_cb_0_0 = digital.constellation_decoder_cb(
            bpsk)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, 10e3,
                                                 True)
        self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(
            2, 8, "", False, gr.GR_MSB_FIRST)
        self.blocks_multiply_xx_0_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((1, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((2, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1,
            '/home/peter/Desktop/acoustic_radio/Testings/bin_test.txt', True)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1,
            '/home/peter/Desktop/acoustic_radio/Testings/bin_test_qpsk_NOpacketEncode_output.txt',
            False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_float_2 = blocks.complex_to_float(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, center_freq, -1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, center_freq, 1, 0)
        self.analog_agc_xx_0 = analog.agc_ff(1e-4, 1.0, 1.0)
        self.analog_agc_xx_0.set_max_gain(65536)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc_xx_0, 0),
                     (self.blocks_multiply_xx_0_0_0, 0))
        self.connect((self.analog_agc_xx_0, 0),
                     (self.blocks_multiply_xx_0_1, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0_1, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0_0_0, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_complex_to_float_2, 0),
                     (self.qtgui_time_sink_x_1, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.analog_agc_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.qtgui_time_sink_x_1_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.qtgui_freq_sink_x_1_1, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.qtgui_time_sink_x_1, 1))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0_0_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.blocks_multiply_xx_0_1, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_multiply_xx_0_1, 0),
                     (self.qtgui_freq_sink_x_1_1, 1))
        self.connect((self.blocks_repack_bits_bb_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.digital_constellation_modulator_0, 0))
        self.connect((self.digital_constellation_decoder_cb_0_0, 0),
                     (self.blocks_repack_bits_bb_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.blocks_complex_to_float_2, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0_0_0, 0),
                     (self.digital_constellation_decoder_cb_0_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.qtgui_freq_sink_x_1_1, 2))
        self.connect((self.low_pass_filter_0, 0),
                     (self.qtgui_time_sink_x_1_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.blocks_float_to_complex_0, 1))
コード例 #26
0
ファイル: top_block.py プロジェクト: CRL-Purdue/vip-sdr
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        try:
             self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
             pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 16000
        self.repeat = repeat = samp_rate/80

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
        	1024, #size
        	samp_rate, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1)
        
        self.qtgui_time_sink_x_0_0.set_y_label("Amplitude", "")
        
        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.blocks_unpacked_to_packed_xx_1 = blocks.unpacked_to_packed_bb(8, gr.GR_MSB_FIRST)
        self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(8)
        self.blocks_uchar_to_float_0_0_0 = blocks.uchar_to_float()
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
        self.blocks_short_to_char_0 = blocks.short_to_char(1)
        self.blocks_rms_xx_0_0 = blocks.rms_ff(1)
        self.blocks_rms_xx_0 = blocks.rms_ff(1)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char*1, repeat)
        self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(1, 8, "", False, gr.GR_MSB_FIRST)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_short*1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_multiply_xx_0_2 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vss((256, ))
        self.blocks_integrate_xx_1 = blocks.integrate_ff(repeat)
        self.blocks_integrate_xx_0_1 = blocks.integrate_ff(repeat)
        self.blocks_integrate_xx_0_0 = blocks.integrate_ff(repeat)
        self.blocks_integrate_xx_0 = blocks.integrate_ff(repeat)
        self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_short*1, "/home/sidekiq/Documents/Documentation_SDR/sdr.in", True)
        self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char*1, "/home/sidekiq/Documents/Documentation_SDR/text_output", False)
        self.blocks_file_sink_0_0.set_unbuffered(True)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_argmax_xx_0 = blocks.argmax_fs(1)
        self.blocks_add_xx_0_0 = blocks.add_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((1, ))
        self.blocks_abs_xx_0_2 = blocks.abs_ff(1)
        self.blocks_abs_xx_0_1 = blocks.abs_ff(1)
        self.blocks_abs_xx_0_0 = blocks.abs_ff(1)
        self.blocks_abs_xx_0 = blocks.abs_ff(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=1,
        		preamble="11111000",
        		access_code="11111111",
        		pad_for_usrp=False,
        	),
        	payload_length=1,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
        	),
        )
        self.audio_sink_1 = audio.sink(16000, "", True)
        self.analog_sig_source_x_1 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1330, 1, 0)
        self.analog_sig_source_x_0_1 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 1330, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 2720, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 2720, 1, 0)
        self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc(100)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_frequency_modulator_fc_0, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0_0, 0))    
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_2, 0))    
        self.connect((self.analog_sig_source_x_0_1, 0), (self.blocks_multiply_xx_0_1, 0))    
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_unpacked_to_packed_xx_1, 0))    
        self.connect((self.blks2_packet_encoder_0, 0), (self.blocks_unpack_k_bits_bb_0, 0))    
        self.connect((self.blocks_abs_xx_0, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.blocks_abs_xx_0_0, 0), (self.blocks_add_xx_0_0, 0))    
        self.connect((self.blocks_abs_xx_0_1, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.blocks_abs_xx_0_2, 0), (self.blocks_add_xx_0_0, 1))    
        self.connect((self.blocks_add_const_vxx_0, 0), (self.analog_frequency_modulator_fc_0, 0))    
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_rms_xx_0, 0))    
        self.connect((self.blocks_add_xx_0_0, 0), (self.blocks_rms_xx_0_0, 0))    
        self.connect((self.blocks_argmax_xx_0, 0), (self.blocks_null_sink_1, 0))    
        self.connect((self.blocks_argmax_xx_0, 1), (self.blocks_short_to_float_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.audio_sink_1, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0_0, 1))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0_1, 1))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0_2, 1))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_null_sink_0, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_float_to_uchar_0, 0), (self.blks2_packet_decoder_0, 0))    
        self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_abs_xx_0_2, 0))    
        self.connect((self.blocks_integrate_xx_0_0, 0), (self.blocks_abs_xx_0, 0))    
        self.connect((self.blocks_integrate_xx_0_1, 0), (self.blocks_abs_xx_0_0, 0))    
        self.connect((self.blocks_integrate_xx_1, 0), (self.blocks_abs_xx_0_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_short_to_char_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_integrate_xx_0, 0))    
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_integrate_xx_1, 0))    
        self.connect((self.blocks_multiply_xx_0_1, 0), (self.blocks_integrate_xx_0_1, 0))    
        self.connect((self.blocks_multiply_xx_0_2, 0), (self.blocks_integrate_xx_0_0, 0))    
        self.connect((self.blocks_repack_bits_bb_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.blocks_repack_bits_bb_0, 0), (self.blocks_uchar_to_float_0_0_0, 0))    
        self.connect((self.blocks_repeat_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_rms_xx_0, 0), (self.blocks_argmax_xx_0, 1))    
        self.connect((self.blocks_rms_xx_0_0, 0), (self.blocks_argmax_xx_0, 0))    
        self.connect((self.blocks_short_to_char_0, 0), (self.blocks_repack_bits_bb_0, 0))    
        self.connect((self.blocks_short_to_float_0, 0), (self.blocks_float_to_uchar_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_uchar_to_float_0, 0))    
        self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_add_const_vxx_0, 0))    
        self.connect((self.blocks_uchar_to_float_0_0_0, 0), (self.qtgui_time_sink_x_0_0, 0))    
        self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_repeat_0, 0))    
        self.connect((self.blocks_unpacked_to_packed_xx_1, 0), (self.blocks_file_sink_0_0, 0))    
コード例 #27
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48000
        self.seed = seed = 128
        self.m_rate = m_rate = 0.8
        self.if_rate = if_rate = samp_rate * 40
        self.gauss = gauss = 0
        self.fc = fc = 511e3
        self.dpp = dpp = 100.0

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=if_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rational_resampler_xxx_0_1 = filter.rational_resampler_fff(
            interpolation=3,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
            interpolation=40,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.interp_fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, 7500, 100, firdes.WIN_HAMMING, 6.76))
        self.hilbert_fc_0 = filter.hilbert_fc(301, firdes.WIN_HAMMING, 6.76)
        self.channels_fading_model_0 = channels.fading_model(
            8, dpp / if_rate, False, 2, 256)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            '/media/akio/ssd1/fading_generator/5-263831-B-6.wav', True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (m_rate, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((1, ))
        self.band_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.band_pass(4, if_rate, fc - 8e3, fc + 8e3, 100,
                             firdes.WIN_HAMMING, 6.76))
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            if_rate, analog.GR_COS_WAVE, fc, 1, 0)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
            channel_rate=fc,
            audio_decim=40,
            audio_pass=7500,
            audio_stop=10e3,
        )
        self.analog_agc_xx_0 = analog.agc_cc(1e-4, 1.0, 1.0)
        self.analog_agc_xx_0.set_max_gain(65536)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc_xx_0, 0), (self.analog_am_demod_cf_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.blocks_null_sink_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.band_pass_filter_0, 0), (self.analog_agc_xx_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.rational_resampler_xxx_0_1, 0))
        self.connect((self.channels_fading_model_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.channels_fading_model_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.rational_resampler_xxx_0_1, 0),
                     (self.low_pass_filter_0, 0))
コード例 #28
0
ファイル: rds.py プロジェクト: maxburkhardt/rtlsdr
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Rds")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.sound_samp_rate = sound_samp_rate = 44.1e3
        self.samp_rate = samp_rate = 2e6
        self.samp_post_receive = samp_post_receive = 350e3
        self.freq = freq = 90.7e6

        ##################################################
        # Blocks
        ##################################################
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	label='freq',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freq_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	minimum=87.9e6,
        	maximum=107.9e6,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freq_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Final Output",
        	sample_rate=17.5e3,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(0, 0)
        self.rtlsdr_source_0.set_gain(10, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.low_pass_filter_1 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, samp_post_receive, 2.2e3, 2e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate, 75e3, 150e3, firdes.WIN_HAMMING, 6.76))
        self.fractional_resampler_xx_2 = filter.fractional_resampler_ff(0, 20)
        self.fractional_resampler_xx_0 = filter.fractional_resampler_cc(0, 4)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.band_pass_filter_0_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	1, samp_post_receive, 18.5e3, 19.5e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	1, samp_post_receive, 54e3, 60e3, 3e3, firdes.WIN_HAMMING, 6.76))
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=350e3,
        	audio_decimation=2,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.fractional_resampler_xx_0, 0))
        self.connect((self.fractional_resampler_xx_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.band_pass_filter_0_0, 0))
        self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_0, 2))
        self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 3))
        self.connect((self.fractional_resampler_xx_2, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.low_pass_filter_1, 0), (self.fractional_resampler_xx_2, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_1, 0))
コード例 #29
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Radio")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.volume = volume = 1
        self.sample_rate = sample_rate = 5e6
        self.freq = freq = 105.1e6
        self.fm_sample = fm_sample = 500e3
        self.audio_rate = audio_rate = 48e3

        ##################################################
        # Blocks
        ##################################################
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            label="Volume",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._volume_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            minimum=0,
            maximum=10,
            num_steps=20,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_volume_sizer)
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_freq_sizer,
            value=self.freq,
            callback=self.set_freq,
            label="Frequency",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._freq_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_freq_sizer,
            value=self.freq,
            callback=self.set_freq,
            minimum=80e6,
            maximum=180e6,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_freq_sizer)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=freq,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=sample_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=int(audio_rate / 1000),
            decimation=int(fm_sample / 10000),
            taps=None,
            fractional_bw=None,
        )
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "")
        self.osmosdr_source_0.set_sample_rate(sample_rate)
        self.osmosdr_source_0.set_center_freq(freq, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.low_pass_filter_0 = filter.fir_filter_ccf(
            int(sample_rate / fm_sample),
            firdes.low_pass(1, sample_rate, 100e3, 10e3, firdes.WIN_HAMMING,
                            6.76))
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.audio_sink_0 = audio.sink(int(audio_rate), "", True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=fm_sample,
            audio_decimation=10,
        )
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, volume)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.audio_sink_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
コード例 #30
0
ファイル: fm_radio_rx.py プロジェクト: rrobotics/hackrf-tests
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Radio")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.volume = volume = 1
        self.sample_rate = sample_rate = 5e6
        self.freq = freq = 105.1e6
        self.fm_sample = fm_sample = 500e3
        self.audio_rate = audio_rate = 48e3

        ##################################################
        # Blocks
        ##################################################
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            label="Volume",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._volume_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            minimum=0,
            maximum=10,
            num_steps=20,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_volume_sizer)
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_freq_sizer,
            value=self.freq,
            callback=self.set_freq,
            label="Frequency",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._freq_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_freq_sizer,
            value=self.freq,
            callback=self.set_freq,
            minimum=80e6,
            maximum=180e6,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_freq_sizer)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=freq,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=sample_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=int(audio_rate / 1000), decimation=int(fm_sample / 10000), taps=None, fractional_bw=None
        )
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + "")
        self.osmosdr_source_0.set_sample_rate(sample_rate)
        self.osmosdr_source_0.set_center_freq(freq, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.low_pass_filter_0 = filter.fir_filter_ccf(
            int(sample_rate / fm_sample), firdes.low_pass(1, sample_rate, 100e3, 10e3, firdes.WIN_HAMMING, 6.76)
        )
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.audio_sink_0 = audio.sink(int(audio_rate), "", True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(quad_rate=fm_sample, audio_decimation=10)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, volume)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.audio_sink_0, 0))
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_0, 0))
コード例 #31
0
ファイル: top_block.py プロジェクト: RScrusoe/sem_v
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.n = self.n = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.n.AddPage(grc_wxgui.Panel(self.n), "FFT")
        self.n.AddPage(grc_wxgui.Panel(self.n), "Time")
        self.Add(self.n)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.n.GetPage(1).GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.n.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.n.GetPage(0).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.n.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.hilbert_fc_0 = filter.hilbert_fc(10000, firdes.WIN_HAMMING, 6.76)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_2 = blocks.add_vff(1)
        self.analog_sig_source_x_0_2 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 10000, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_TRI_WAVE, 500, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.analog_sig_source_x_0_2, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_2, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_2, 1))
        self.connect((self.blocks_add_xx_2, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_add_xx_2, 0), (self.wxgui_scopesink2_0, 0))
コード例 #32
0
ファイル: top_block.py プロジェクト: tshrjn/EE304P
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.sliderFc = sliderFc = 20000
		self.sliderBeta = sliderBeta = 1
		self.samp_rate = samp_rate = 200000

		##################################################
		# Blocks
		##################################################
		_sliderFc_sizer = wx.BoxSizer(wx.VERTICAL)
		self._sliderFc_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_sliderFc_sizer,
			value=self.sliderFc,
			callback=self.set_sliderFc,
			label='sliderFc',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._sliderFc_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_sliderFc_sizer,
			value=self.sliderFc,
			callback=self.set_sliderFc,
			minimum=0,
			maximum=100000,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_sliderFc_sizer)
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=samp_rate,
			fft_size=1024,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="FFT Plot",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		_sliderBeta_sizer = wx.BoxSizer(wx.VERTICAL)
		self._sliderBeta_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_sliderBeta_sizer,
			value=self.sliderBeta,
			callback=self.set_sliderBeta,
			label='sliderBeta',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._sliderBeta_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_sliderBeta_sizer,
			value=self.sliderBeta,
			callback=self.set_sliderBeta,
			minimum=0,
			maximum=100,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_sliderBeta_sizer)
		self.blocks_transcendental_0_0 = blocks.transcendental("sin", "float")
		self.blocks_transcendental_0 = blocks.transcendental("cos", "float")
		self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate)
		self.blocks_sub_xx_0 = blocks.sub_ff(1)
		self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
		self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
		self.blocks_integrate_xx_0 = blocks.integrate_ff(1)
		self.analog_sig_source_x_0_0_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, sliderFc, 1, 0)
		self.analog_sig_source_x_0_0 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, sliderFc, 1, 0)
		self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 1000, 1, 0)
		self.Beta = blocks.multiply_const_vff((sliderBeta, ))

		##################################################
		# Connections
		##################################################
		self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0))
		self.connect((self.blocks_throttle_0, 0), (self.blocks_integrate_xx_0, 0))
		self.connect((self.blocks_integrate_xx_0, 0), (self.Beta, 0))
		self.connect((self.Beta, 0), (self.blocks_transcendental_0, 0))
		self.connect((self.Beta, 0), (self.blocks_transcendental_0_0, 0))
		self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0, 1))
		self.connect((self.blocks_transcendental_0_0, 0), (self.blocks_multiply_xx_0, 0))
		self.connect((self.analog_sig_source_x_0_0_0, 0), (self.blocks_multiply_xx_0_0, 0))
		self.connect((self.blocks_transcendental_0, 0), (self.blocks_multiply_xx_0_0, 1))
		self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_sub_xx_0, 0))
		self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_sub_xx_0, 1))
		self.connect((self.blocks_sub_xx_0, 0), (self.wxgui_scopesink2_0, 0))
		self.connect((self.blocks_sub_xx_0, 0), (self.wxgui_fftsink2_0, 0))
コード例 #33
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")

        if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            self.restoreGeometry(self.settings.value("geometry").toByteArray())
        else:
            self.restoreGeometry(
                self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 44100

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_vector_sink_f_0 = qtgui.vector_sink_f(
            1024,
            0,
            1.0,
            "x-Axis",
            "y-Axis",
            "vector sink",
            1  # Number of inputs
        )
        self.qtgui_vector_sink_f_0.set_update_time(0.10)
        self.qtgui_vector_sink_f_0.set_y_axis(-140, 10)
        self.qtgui_vector_sink_f_0.enable_autoscale(False)
        self.qtgui_vector_sink_f_0.enable_grid(False)
        self.qtgui_vector_sink_f_0.set_x_axis_units("")
        self.qtgui_vector_sink_f_0.set_y_axis_units("")
        self.qtgui_vector_sink_f_0.set_ref_level(0)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_vector_sink_f_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_vector_sink_f_0.set_line_label(i, labels[i])
            self.qtgui_vector_sink_f_0.set_line_width(i, widths[i])
            self.qtgui_vector_sink_f_0.set_line_color(i, colors[i])
            self.qtgui_vector_sink_f_0.set_line_alpha(i, alphas[i])

        self._qtgui_vector_sink_f_0_win = sip.wrapinstance(
            self.qtgui_vector_sink_f_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_vector_sink_f_0_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "freq_sink",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "float" == "float" or "float" == "msg_float":
            self.qtgui_freq_sink_x_0.set_plot_pos_half(not False)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.fft_vxx_0 = fft.fft_vfc(1024, True, (window.blackmanharris(1024)),
                                     1)
        self.blocks_wavfile_source_1 = blocks.wavfile_source(
            '/home/jsarp4/Documents/gnu_radio_flowcharts/CSS_USRP_impl/chirps/1.wav',
            True)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            '/home/jsarp4/Documents/gnu_radio_flowcharts/CSS_USRP_impl/chirps/inv.wav',
            True)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_float * 1, 1024)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1024)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.qtgui_vector_sink_f_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_wavfile_source_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_float_0, 0))
コード例 #34
0
ファイル: top_block.py プロジェクト: tshrjn/EE304P
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.vol = vol =  .05
		self.samp_rate = samp_rate = 256000

		##################################################
		# Blocks
		##################################################
		_vol_sizer = wx.BoxSizer(wx.VERTICAL)
		self._vol_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_vol_sizer,
			value=self.vol,
			callback=self.set_vol,
			label='vol',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._vol_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_vol_sizer,
			value=self.vol,
			callback=self.set_vol,
			minimum=0,
			maximum= .1,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_vol_sizer)
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_f(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=samp_rate/8,
			fft_size=1024,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="FFT Plot",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0_0.win)
		self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(8, (firdes.low_pass(1,samp_rate,2000,100)), -51500, samp_rate)
		self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_float*1, samp_rate/8)
		self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate/8)
		self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
		self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
		self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((vol, ))
		self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/Jack_Sparrow/EE304P/Lab05/ssb_lsb_256k_complex2.dat", True)
		self.blocks_complex_to_float_1 = blocks.complex_to_float(1)
		self.blocks_add_xx_0 = blocks.add_vff(1)
		self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
			interpolation=3,
			decimation=2,
			taps=None,
			fractional_bw=None,
		)
		self.audio_sink_0 = audio.sink(48000, "", True)
		self.analog_sig_source_x_0_0 = analog.sig_source_f(samp_rate/8, analog.GR_COS_WAVE, 1500, 1, 0)
		self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate/8, analog.GR_SIN_WAVE, 1500, 1, 0)

		##################################################
		# Connections
		##################################################
		self.connect((self.blocks_file_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
		self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_float_1, 0))
		self.connect((self.blocks_complex_to_float_1, 0), (self.blocks_throttle_0_0, 0))
		self.connect((self.blocks_complex_to_float_1, 1), (self.blocks_throttle_0, 0))
		self.connect((self.blocks_throttle_0_0, 0), (self.blocks_multiply_xx_0_0, 1))
		self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0, 0))
		self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
		self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_xx_0, 0))
		self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_add_xx_0, 0))
		self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.wxgui_scopesink2_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.audio_sink_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.wxgui_fftsink2_0_0, 0))
		self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
		self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blks2_rational_resampler_xxx_0, 0))
コード例 #35
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Dsbsc")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 320000

        ##################################################
        # Blocks
        ##################################################
        self.lab2_part2 = self.lab2_part2 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.lab2_part2.AddPage(grc_wxgui.Panel(self.lab2_part2), "scope")
        self.lab2_part2.AddPage(grc_wxgui.Panel(self.lab2_part2), "fft")
        self.lab2_part2.AddPage(grc_wxgui.Panel(self.lab2_part2), "fft1")
        self.Add(self.lab2_part2)
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f(
            self.lab2_part2.GetPage(0).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.lab2_part2.GetPage(0).Add(self.wxgui_scopesink2_0_0.win)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
            self.lab2_part2.GetPage(2).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.lab2_part2.GetPage(2).Add(self.wxgui_fftsink2_1.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.lab2_part2.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.lab2_part2.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, 30000, 100, firdes.WIN_HAMMING,
                            6.76))
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((1, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((0, ))
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.wxgui_fftsink2_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.wxgui_scopesink2_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.low_pass_filter_0, 0))
コード例 #36
0
ファイル: top_block.py プロジェクト: tshrjn/EE304P
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 320000

		##################################################
		# Blocks
		##################################################
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=samp_rate,
			fft_size=1024,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="FFT Plot",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		self.hilbert_fc_0 = filter.hilbert_fc(64)
		self.high_pass_filter_0 = gr.interp_fir_filter_fff(1, firdes.high_pass(
			1, samp_rate, 15000, 10, firdes.WIN_HAMMING, 6.76))
		self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate)
		self.blocks_multiply_xx_1_0 = blocks.multiply_vff(1)
		self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
		self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
		self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
		self.blocks_add_xx_0 = blocks.add_vff(1)
		self.analog_sig_source_x_0_0_2 = analog.sig_source_c(samp_rate, analog.GR_SIN_WAVE, 20000, 1, 0)
		self.analog_sig_source_x_0_0_1 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 20000, 1, 0)
		self.analog_sig_source_x_0_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 20000, 1, 0)
		self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)

		##################################################
		# Connections
		##################################################
		self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0))
		self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0, 1))
		self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_throttle_0, 0))
		self.connect((self.blocks_throttle_0, 0), (self.high_pass_filter_0, 0))
		self.connect((self.high_pass_filter_0, 0), (self.hilbert_fc_0, 0))
		self.connect((self.hilbert_fc_0, 0), (self.blocks_multiply_xx_1, 0))
		self.connect((self.analog_sig_source_x_0_0_2, 0), (self.blocks_multiply_xx_1, 1))
		self.connect((self.high_pass_filter_0, 0), (self.blocks_multiply_xx_1_0, 1))
		self.connect((self.analog_sig_source_x_0_0_1, 0), (self.blocks_multiply_xx_1_0, 0))
		self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_complex_to_real_0, 0))
		self.connect((self.blocks_multiply_xx_1_0, 0), (self.blocks_add_xx_0, 0))
		self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_add_xx_0, 1))
		self.connect((self.blocks_add_xx_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.blocks_add_xx_0, 0), (self.wxgui_scopesink2_0, 0))
コード例 #37
0
    def __init__(self,
                 bits_per_symbol=2,
                 rolloff=0.5,
                 sound_card_sample_rate=22000):
        gr.top_block.__init__(self, "If Psk Rx Rpi")

        #TODO: CHECK BOUNDARIES OF INPUT PARAMETERS

        ##################################################
        # Variables
        ##################################################
        self.if_decimation = if_decimation = 2
        self.sound_card_sample_rate = sound_card_sample_rate
        self.samples_per_symbol = samples_per_symbol = 16 / if_decimation
        self.symbol_rate = symbol_rate = sound_card_sample_rate / if_decimation / samples_per_symbol
        self.bits_per_symbol = bits_per_symbol
        self.rolloff = rolloff
        self.hdlc_packet_overhead = hdlc_packet_overhead = 6 * 8
        self.hdlc_packet_length = hdlc_packet_length = 16 * 8
        self.channel_bit_rate = channel_bit_rate = symbol_rate * bits_per_symbol

        self.variable_rrc_filter_taps = variable_rrc_filter_taps = firdes.root_raised_cosine(
            1, sound_card_sample_rate / if_decimation, symbol_rate, rolloff,
            11 * samples_per_symbol)

        self.source_bit_rate = source_bit_rate = channel_bit_rate * hdlc_packet_length / (
            hdlc_packet_overhead + hdlc_packet_length)
        self.if_frequency = if_frequency = sound_card_sample_rate / 4

        ##################################################
        # Blocks
        ##################################################
        self.raspi_decoder_psk_constellation_decoder_0 = raspi_decoder.psk_constellation_decoder(
            bits_per_symbol=bits_per_symbol,
            differential=True,
            mod_code="gray",
            debug=False,
        )
        self.low_pass_filter_0_0 = filter.fir_filter_fff(
            if_decimation,
            firdes.low_pass(1.66, sound_card_sample_rate,
                            symbol_rate * (1 + rolloff),
                            sound_card_sample_rate / 8, firdes.WIN_HANN, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_fff(
            if_decimation,
            firdes.low_pass(1.66, sound_card_sample_rate,
                            symbol_rate * (1 + rolloff),
                            sound_card_sample_rate / 8, firdes.WIN_HANN, 6.76))
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            samples_per_symbol, 2 * math.pi / 100, (variable_rrc_filter_taps),
            32, 0, 3, 1)
        self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(
            hdlc_packet_length / 8, hdlc_packet_length)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(
            2 * math.pi / 100 * 2, 8, True)
        self.blocks_tagged_file_sink_0 = blocks.tagged_file_sink(
            gr.sizeof_char * 1, source_bit_rate)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, "burst")
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.audio_source_0 = audio.source(sound_card_sample_rate, "", True)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            sound_card_sample_rate, analog.GR_COS_WAVE, if_frequency, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            sound_card_sample_rate, analog.GR_SIN_WAVE, if_frequency, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'),
                         (self.blocks_pdu_to_tagged_stream_0, 'pdus'))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.audio_source_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.audio_source_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.blocks_tagged_file_sink_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.raspi_decoder_psk_constellation_decoder_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.raspi_decoder_psk_constellation_decoder_0, 0),
                     (self.digital_hdlc_deframer_bp_0, 0))
コード例 #38
0
ファイル: top_block.py プロジェクト: tshrjn/EE304P
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.vol = vol = 4
        self.samp_rate = samp_rate = 100000

        ##################################################
        # Blocks
        ##################################################
        _vol_sizer = wx.BoxSizer(wx.VERTICAL)
        self._vol_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_vol_sizer,
        	value=self.vol,
        	callback=self.set_vol,
        	label='vol',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._vol_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_vol_sizer,
        	value=self.vol,
        	callback=self.set_vol,
        	minimum=0,
        	maximum=5,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_vol_sizer)
        self.low_pass_filter_0_0_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, samp_rate, 3500, 100, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, samp_rate, 3500, 100, firdes.WIN_HAMMING, 6.76))
        self.blocks_multiply_xx_0_0_0_2 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0_0_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((vol, ))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_float*1, "/home/students/btech/b13236/EE304P/mid-sem/modulated_signal.dat", True)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.audio_sink_0 = audio.sink(44100, "", True)
        self.analog_sig_source_x_1_2 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 3000, 1, 0)
        self.analog_sig_source_x_1_1 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 3000, 1, 0)
        self.analog_sig_source_x_1_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 30000, 1, 0)
        self.analog_sig_source_x_1 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 30000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_0_0_0, 1))    
        self.connect((self.analog_sig_source_x_1_0, 0), (self.blocks_multiply_xx_0_0_0_0, 1))    
        self.connect((self.analog_sig_source_x_1_1, 0), (self.blocks_multiply_xx_0_0_0_0_0, 0))    
        self.connect((self.analog_sig_source_x_1_2, 0), (self.blocks_multiply_xx_0_0_0_2, 1))    
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_xx_0_0_0, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_xx_0_0_0_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.blocks_multiply_xx_0_0_0, 0), (self.low_pass_filter_0_0, 0))    
        self.connect((self.blocks_multiply_xx_0_0_0_0, 0), (self.low_pass_filter_0_0_0, 0))    
        self.connect((self.blocks_multiply_xx_0_0_0_0_0, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.blocks_multiply_xx_0_0_0_2, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.low_pass_filter_0_0, 0), (self.blocks_multiply_xx_0_0_0_2, 0))    
        self.connect((self.low_pass_filter_0_0_0, 0), (self.blocks_multiply_xx_0_0_0_0_0, 1))    
コード例 #39
0
ファイル: OnOffKeying.py プロジェクト: davidfdzp/sdr
    def __init__(self):
        gr.top_block.__init__(self, "On Off Keying")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("On Off Keying")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "OnOffKeying")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 44100
        self.carrier_freq = carrier_freq = 10000
        self.samp_delay = samp_delay = 0
        self.noise = noise = 0
        self.modulating_freq = modulating_freq = 100
        self.lf = lf = 100
        self.filter_taps = filter_taps = firdes.low_pass(
            1, samp_rate, carrier_freq, 25000, firdes.WIN_HAMMING, 6.76)
        self.bit_delay = bit_delay = 0
        self.Glow = Glow = 3

        ##################################################
        # Blocks
        ##################################################
        self._samp_delay_range = Range(0, 1000, 1, 0, 200)
        self._samp_delay_win = RangeWidget(self._samp_delay_range,
                                           self.set_samp_delay, 'samp_delay',
                                           "counter_slider", float)
        self.top_grid_layout.addWidget(self._samp_delay_win)
        self._noise_range = Range(0, 1, 1e-3, 0, 200)
        self._noise_win = RangeWidget(self._noise_range, self.set_noise,
                                      'noise in [mV]', "counter_slider", float)
        self.top_grid_layout.addWidget(self._noise_win)
        self._lf_range = Range(50, 200, 1, 100, 200)
        self._lf_win = RangeWidget(self._lf_range, self.set_lf,
                                   'Low-pass filter cut-off frequency',
                                   "counter_slider", float)
        self.top_grid_layout.addWidget(self._lf_win)
        self._carrier_freq_range = Range(10000, 100000, 1, 10000, 200)
        self._carrier_freq_win = RangeWidget(self._carrier_freq_range,
                                             self.set_carrier_freq,
                                             'carrier_freq', "counter_slider",
                                             float)
        self.top_grid_layout.addWidget(self._carrier_freq_win)
        self._Glow_range = Range(0.1, 100, 0.1, 3, 200)
        self._Glow_win = RangeWidget(self._Glow_range, self.set_Glow,
                                     'Low-pass filter gain', "counter_slider",
                                     float)
        self.top_grid_layout.addWidget(self._Glow_win)
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
            interpolation=1, decimation=10, taps=None, fractional_bw=None)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=10, decimation=1, taps=None, fractional_bw=None)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            3  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        labels = [
            'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
            'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(3):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            1024,  #size
            "",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                   qtgui.TRIG_SLOPE_POS, 0.0,
                                                   0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(True)
        self.qtgui_const_sink_x_0.enable_grid(False)
        self.qtgui_const_sink_x_0.enable_axis_labels(True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "red", "red", "red", "red", "red", "red", "red",
            "red"
        ]
        styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_const_sink_x_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win)
        self._modulating_freq_range = Range(10, 1000, 1, 100, 200)
        self._modulating_freq_win = RangeWidget(self._modulating_freq_range,
                                                self.set_modulating_freq,
                                                'modulating_freq',
                                                "counter_slider", float)
        self.top_grid_layout.addWidget(self._modulating_freq_win)
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(Glow, samp_rate, lf, 1000, firdes.WIN_HAMMING,
                            6.76))
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff(
            20,
            np.convolve(np.array(filter.firdes.gaussian(1, 20, 1.0, 4 * 20)),
                        np.array((1, ) * 20)))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            1, filter_taps, 0, samp_rate)
        self.fir_filter_xxx_0 = filter.fir_filter_fff(
            20,
            np.convolve(np.array(filter.firdes.gaussian(1, 20, 1.0, 4 * 20)),
                        np.array((1, ) * 20)))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            1, 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bf(
            [0, 1], 1)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(320, True)
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=noise,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=[1.0 + 1.0j],
            noise_seed=0,
            block_tags=False)
        self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(0.9)
        self.blocks_float_to_complex_0_0 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1,
            '/mnt/c/Users/David Fernandez Pina/sdr/MyTest.txt', True, 0, 0)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1,
                                                   '/dev/pts/0', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_delay_1 = blocks.delay(gr.sizeof_char * 1, 0)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, samp_delay)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self._bit_delay_range = Range(0, 8, 1, 0, 200)
        self._bit_delay_win = RangeWidget(self._bit_delay_range,
                                          self.set_bit_delay, 'bit_delay',
                                          "counter_slider", int)
        self.top_grid_layout.addWidget(self._bit_delay_win)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, carrier_freq, 1, 0, 0)
        self.analog_sig_source_x_0.set_block_alias("Carrier")

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.qtgui_time_sink_x_0, 2))
        self.connect((self.blocks_delay_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.blocks_delay_1, 0),
                     (self.blocks_unpacked_to_packed_xx_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.blocks_float_to_complex_0_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_unpacked_to_packed_xx_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.blocks_delay_1, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0),
                     (self.interp_fir_filter_xxx_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.fir_filter_xxx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.interp_fir_filter_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_delay_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_float_to_complex_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.qtgui_time_sink_x_0, 1))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.fir_filter_xxx_0, 0))
コード例 #40
0
ファイル: top_block.py プロジェクト: RScrusoe/sem_v
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.ntaps = ntaps = 1408
        self.nfilts = nfilts = 32
        self.excess_bw = excess_bw = 0.45
        self.timing_bw = timing_bw = 2 * pi / 100
        self.sr2 = sr2 = 300000
        self.samp_rate_0 = samp_rate_0 = 32000
        self.samp_rate = samp_rate = 100000
        self.s = s = 0.01
        self.rx_taps = rx_taps = filter.firdes.root_raised_cosine(nfilts, nfilts * sps, 1.0, excess_bw, ntaps)
        self.freq_bw = freq_bw = 2 * pi / 100
        self.fll_ntaps = fll_ntaps = 55

        ##################################################
        # Blocks
        ##################################################
        self.n = self.n = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.n.AddPage(grc_wxgui.Panel(self.n), "tab1")
        self.n.AddPage(grc_wxgui.Panel(self.n), "tab2")
        self.n.AddPage(grc_wxgui.Panel(self.n), "tab3")
        self.Add(self.n)
        self.wxgui_scopesink2_2 = scopesink2.scope_sink_c(
            self.n.GetPage(1).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.n.GetPage(1).Add(self.wxgui_scopesink2_2.win)
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_f(
            self.n.GetPage(0).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.n.GetPage(0).Add(self.wxgui_scopesink2_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
            self.n.GetPage(2).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.n.GetPage(2).Add(self.wxgui_scopesink2_0.win)
        _s_sizer = wx.BoxSizer(wx.VERTICAL)
        self._s_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_s_sizer,
            value=self.s,
            callback=self.set_s,
            label="s",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._s_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_s_sizer,
            value=self.s,
            callback=self.set_s,
            minimum=-5,
            maximum=5,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_s_sizer)
        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(
            4, taps=(firdes.root_raised_cosine(32, 32, 1.0, 0.45, 1408)), flt_size=32
        )
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.iir_filter_xxx_0_0 = filter.iir_filter_ffd(([1.0001, -1]), ([-1, 1]), True)
        self.iir_filter_xxx_0 = filter.iir_filter_ffd((0.01,), ([-1, 0.99]), True)
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(4, 2 * pi / 100, (rx_taps), 32, 16, 1.5, 1)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(
            (((1 + 1j), (1 - 1j), (-1 + 1j), (-1 - 1j))), 1
        )
        self.blocks_vco_c_0 = blocks.vco_c(samp_rate, -5, 1)
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_float * 1, "127.0.0.1", 12345, 1472, True)
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_float * 1, "127.0.0.1", 12345, 1472, True)
        self.blocks_threshold_ff_0_0 = blocks.threshold_ff(-0.001, 0.001, 0)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(-0.001, 0.001, 0)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_xx_2 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vff((1,))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((1.413,))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((1.413,))
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, 1000)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.blocks_add_const_vxx_0_0 = blocks.add_const_vff((-0.5,))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-0.5,))
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_SIN_WAVE, 10, 1, 0)
        self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 4, 1000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0), (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_add_const_vxx_0_0, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_complex_to_imag_0, 0), (self.blocks_multiply_xx_2, 1))
        self.connect((self.blocks_complex_to_imag_0, 0), (self.blocks_threshold_ff_0_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_threshold_ff_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.iir_filter_xxx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_multiply_xx_2, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blocks_delay_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.iir_filter_xxx_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_threshold_ff_0_0, 0), (self.blocks_add_const_vxx_0_0, 0))
        self.connect((self.blocks_udp_source_0, 0), (self.blocks_multiply_const_vxx_2, 0))
        self.connect((self.blocks_vco_c_0, 0), (self.blocks_multiply_xx_0, 2))
        self.connect((self.blocks_vco_c_0, 0), (self.wxgui_scopesink2_2, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.blocks_complex_to_imag_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.blocks_complex_to_real_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.iir_filter_xxx_0, 0), (self.blocks_udp_sink_0, 0))
        self.connect((self.iir_filter_xxx_0, 0), (self.wxgui_scopesink2_1, 0))
        self.connect((self.iir_filter_xxx_0_0, 0), (self.blocks_vco_c_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.blocks_multiply_xx_0, 0))
コード例 #41
0
    def __init__(self,
                 tx_file,
                 bits_per_symbol=2,
                 rolloff=0.5,
                 sound_card_sample_rate=22000):
        gr.top_block.__init__(self, "If Psk Tx Rpi")

        ##################################################
        # Variables
        ##################################################
        self.sound_card_sample_rate = sound_card_sample_rate
        self.samples_per_symbol = samples_per_symbol = 16
        self.symbol_rate = symbol_rate = sound_card_sample_rate / samples_per_symbol
        self.bits_per_symbol = bits_per_symbol
        self.hdlc_packet_overhead = hdlc_packet_overhead = 6 * 8
        self.hdlc_packet_length = hdlc_packet_length = 16 * 8
        self.channel_bit_rate = channel_bit_rate = symbol_rate * bits_per_symbol
        self.source_bit_rate = source_bit_rate = channel_bit_rate * hdlc_packet_length / (
            hdlc_packet_overhead + hdlc_packet_length)
        self.rolloff = rolloff
        self.quantization_depth = quantization_depth = 16
        self.if_frequency = if_frequency = sound_card_sample_rate / 4

        ##################################################
        # Blocks
        ##################################################
        self.digital_psk_mod_0 = digital.psk.psk_mod(
            constellation_points=pow(2, bits_per_symbol),
            mod_code="gray",
            differential=True,
            samples_per_symbol=samples_per_symbol,
            excess_bw=rolloff,
            verbose=False,
            log=False,
        )
        self.digital_hdlc_framer_pb_0 = digital.hdlc_framer_pb("packet_len")
        self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu(
            blocks.byte_t, "packet_len")
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(
            gr.sizeof_char, 1, hdlc_packet_length / 8, "packet_len")
        self.blocks_multiply_xx_0_0_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0_0 = blocks.multiply_vff(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char * 1,
                                                       tx_file, False)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.audio_sink_0 = audio.sink(int(sound_card_sample_rate), "", True)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            sound_card_sample_rate, analog.GR_COS_WAVE, if_frequency, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            sound_card_sample_rate, analog.GR_SIN_WAVE, if_frequency, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'),
                         (self.digital_hdlc_framer_pb_0, 'in'))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0_0_1, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_0_0_0, 1))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_multiply_xx_0_0_1, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.blocks_multiply_xx_0_0_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0_0_1, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.blocks_tagged_stream_to_pdu_0, 0))
        self.connect((self.blocks_unpacked_to_packed_xx_0, 0),
                     (self.digital_psk_mod_0, 0))
        self.connect((self.digital_hdlc_framer_pb_0, 0),
                     (self.blocks_unpacked_to_packed_xx_0, 0))
        self.connect((self.digital_psk_mod_0, 0),
                     (self.blocks_complex_to_float_0, 0))
コード例 #42
0
ファイル: rds_rx.py プロジェクト: razor/rds-tmc-decoder
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Stereo FM receiver and RDS Decoder")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1000000
        self.bb_decim = bb_decim = 4
        self.freq_offset = freq_offset = 250000
        self.freq = freq = 106.1e6
        self.baseband_rate = baseband_rate = samp_rate/bb_decim
        self.audio_decim = audio_decim = 5
        self.xlate_bandwidth = xlate_bandwidth = 100000
        self.volume = volume = 0
        self.gain = gain = 37.6
        self.freq_tune = freq_tune = freq - freq_offset
        self.audio_rate = audio_rate = 48000
        self.audio_decim_rate = audio_decim_rate = baseband_rate/audio_decim

        ##################################################
        # Blocks
        ##################################################
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_volume_sizer,
        	value=self.volume,
        	callback=self.set_volume,
        	label="Volume",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._volume_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_volume_sizer,
        	value=self.volume,
        	callback=self.set_volume,
        	minimum=-20,
        	maximum=10,
        	num_steps=300,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_volume_sizer, 0, 1, 1, 1)
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "BB")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Demod")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "L+R")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Pilot")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "DSBSC")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "RDS")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "L-R")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "RDS constellation")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Waterfall")
        self.GridAdd(self.nb, 2, 0, 1, 2)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label="RF Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0,
        	maximum=49.6,
        	num_steps=124,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_gain_sizer, 0, 0, 1, 1)
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	label="Freq",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freq_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	minimum=88.1e6,
        	maximum=107.9e6,
        	num_steps=99,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_freq_sizer, 1, 0, 1, 2)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_f(
        	self.nb.GetPage(8).GetWin(),
        	baseband_freq=0,
        	dynamic_range=100,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        )
        self.nb.GetPage(8).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_c(
        	self.nb.GetPage(7).GetWin(),
        	title="Scope Plot",
        	sample_rate=2375,
        	v_scale=0.4,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=True,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.nb.GetPage(7).Add(self.wxgui_scopesink2_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.nb.GetPage(3).GetWin(),
        	title="Pilot",
        	sample_rate=baseband_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.nb.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_0_0_1_0_1 = fftsink2.fft_sink_c(
        	self.nb.GetPage(5).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=audio_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="RDS",
        	peak_hold=False,
        )
        self.nb.GetPage(5).Add(self.wxgui_fftsink2_0_0_0_1_0_1.win)
        self.wxgui_fftsink2_0_0_0_1_0_0 = fftsink2.fft_sink_f(
        	self.nb.GetPage(6).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=-50,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="L-R",
        	peak_hold=False,
        )
        self.nb.GetPage(6).Add(self.wxgui_fftsink2_0_0_0_1_0_0.win)
        self.wxgui_fftsink2_0_0_0_1 = fftsink2.fft_sink_f(
        	self.nb.GetPage(4).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="DSBSC Sub-carrier",
        	peak_hold=False,
        )
        self.nb.GetPage(4).Add(self.wxgui_fftsink2_0_0_0_1.win)
        self.wxgui_fftsink2_0_0_0 = fftsink2.fft_sink_f(
        	self.nb.GetPage(2).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=audio_decim_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="L+R",
        	peak_hold=False,
        )
        self.nb.GetPage(2).Add(self.wxgui_fftsink2_0_0_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_f(
        	self.nb.GetPage(1).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=baseband_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=True,
        	avg_alpha=0.8,
        	title="FM Demod",
        	peak_hold=False,
        )
        self.nb.GetPage(1).Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.nb.GetPage(0).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=-30,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=True,
        	avg_alpha=0.8,
        	title="Baseband",
        	peak_hold=False,
        )
        self.nb.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq_tune, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(gain, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.root_raised_cosine_filter_0 = filter.fir_filter_ccf(1, firdes.root_raised_cosine(
        	1, samp_rate/bb_decim/audio_decim, 2375, 1, 100))
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
                interpolation=audio_rate,
                decimation=audio_decim_rate,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=audio_rate,
                decimation=audio_decim_rate,
                taps=None,
                fractional_bw=None,
        )
        self.gr_rds_parser_0 = rds.parser(False, True)
        self.gr_rds_panel_0 = rds.rdsPanel(freq, self.GetWin())
        self.Add(self.gr_rds_panel_0.panel)
        self.gr_rds_decoder_0 = rds.decoder(False, False)
        self.freq_xlating_fir_filter_xxx_1 = filter.freq_xlating_fir_filter_fcc(audio_decim, (firdes.low_pass(2500.0,baseband_rate,2.4e3,2e3,firdes.WIN_HAMMING)), 57e3, baseband_rate)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (firdes.low_pass(1, samp_rate, xlate_bandwidth, 100000)), freq_offset, samp_rate)
        self.fir_filter_xxx_5 = filter.fir_filter_fff(audio_decim, (firdes.low_pass(1.0,baseband_rate,20e3,40e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_5.declare_sample_delay(0)
        self.fir_filter_xxx_3 = filter.fir_filter_fff(1, (firdes.band_pass(1.0,baseband_rate,38e3-13e3,38e3+13e3,3e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_3.declare_sample_delay(0)
        self.fir_filter_xxx_2 = filter.fir_filter_fcc(1, (firdes.complex_band_pass(1.0,baseband_rate,19e3-500,19e3+500,1e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_2.declare_sample_delay(0)
        self.fir_filter_xxx_1 = filter.fir_filter_fff(audio_decim, (firdes.low_pass(1.0,baseband_rate,13e3,3e3,firdes.WIN_HAMMING)))
        self.fir_filter_xxx_1.declare_sample_delay(0)
        self.digital_mpsk_receiver_cc_0 = digital.mpsk_receiver_cc(2, 0, 1*cmath.pi/100.0, -0.06, 0.06, 0.5, 0.05, samp_rate/bb_decim/audio_decim/ 2375.0, 0.001, 0.005)
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((10**(1.*(volume+15)/10), ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((10**(1.*(volume+15)/10), ))
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_char*1, 2)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=samp_rate,
        	audio_decimation=bb_decim,
        )
        self.analog_pll_refout_cc_0 = analog.pll_refout_cc(0.001, 2 * math.pi * (19000+200) / baseband_rate, 2 * math.pi * (19000-200) / baseband_rate)
        self.analog_fm_deemph_0_0_0 = analog.fm_deemph(fs=audio_decim_rate, tau=75e-6)
        self.analog_fm_deemph_0_0 = analog.fm_deemph(fs=audio_decim_rate, tau=75e-6)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.fir_filter_xxx_1, 0), (self.wxgui_fftsink2_0_0_0, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.fir_filter_xxx_3, 0), (self.wxgui_fftsink2_0_0_0_1, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.fir_filter_xxx_5, 0))
        self.connect((self.analog_fm_deemph_0_0_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.analog_fm_deemph_0_0_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.analog_fm_deemph_0_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.wxgui_fftsink2_0_0_0_1_0_0, 0))
        self.connect((self.fir_filter_xxx_5, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.fir_filter_xxx_5, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.fir_filter_xxx_3, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.analog_fm_deemph_0_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.fir_filter_xxx_1, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.fir_filter_xxx_3, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.fir_filter_xxx_2, 0))
        self.connect((self.fir_filter_xxx_2, 0), (self.analog_pll_refout_cc_0, 0))
        self.connect((self.analog_pll_refout_cc_0, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.analog_pll_refout_cc_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_complex_to_imag_0, 0))
        self.connect((self.blocks_complex_to_imag_0, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_complex_to_imag_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_wfm_rcv_0, 0), (self.freq_xlating_fir_filter_xxx_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.wxgui_fftsink2_0_0_0_1_0_1, 0))
        self.connect((self.digital_mpsk_receiver_cc_0, 0), (self.wxgui_scopesink2_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.root_raised_cosine_filter_0, 0))
        self.connect((self.root_raised_cosine_filter_0, 0), (self.digital_mpsk_receiver_cc_0, 0))
        self.connect((self.digital_mpsk_receiver_cc_0, 0), (self.blocks_complex_to_real_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0), (self.gr_rds_decoder_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_null_sink_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_null_sink_0, 1))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.gr_rds_decoder_0, "out", self.gr_rds_parser_0, "in")
        self.msg_connect(self.gr_rds_parser_0, "out", self.gr_rds_panel_0, "in")
コード例 #43
0
    def __init__(self):
        gr.top_block.__init__(self, "Lab 2 Task 1")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Lab 2 Task 1")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "lab2_task1_1")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 960000

        ##################################################
        # Blocks
        ##################################################
        self.tab = Qt.QTabWidget()
        self.tab_widget_0 = Qt.QWidget()
        self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_0)
        self.tab_grid_layout_0 = Qt.QGridLayout()
        self.tab_layout_0.addLayout(self.tab_grid_layout_0)
        self.tab.addTab(self.tab_widget_0, 'Message')
        self.tab_widget_1 = Qt.QWidget()
        self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_1)
        self.tab_grid_layout_1 = Qt.QGridLayout()
        self.tab_layout_1.addLayout(self.tab_grid_layout_1)
        self.tab.addTab(self.tab_widget_1, 'Modulated')
        self.tab_widget_2 = Qt.QWidget()
        self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_2)
        self.tab_grid_layout_2 = Qt.QGridLayout()
        self.tab_layout_2.addLayout(self.tab_grid_layout_2)
        self.tab.addTab(self.tab_widget_2, 'Demodulated')
        self.top_grid_layout.addWidget(self.tab)
        self.freq = Qt.QTabWidget()
        self.freq_widget_0 = Qt.QWidget()
        self.freq_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                           self.freq_widget_0)
        self.freq_grid_layout_0 = Qt.QGridLayout()
        self.freq_layout_0.addLayout(self.freq_grid_layout_0)
        self.freq.addTab(self.freq_widget_0, 'Message')
        self.freq_widget_1 = Qt.QWidget()
        self.freq_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                           self.freq_widget_1)
        self.freq_grid_layout_1 = Qt.QGridLayout()
        self.freq_layout_1.addLayout(self.freq_grid_layout_1)
        self.freq.addTab(self.freq_widget_1, 'Modulated')
        self.freq_widget_2 = Qt.QWidget()
        self.freq_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                           self.freq_widget_2)
        self.freq_grid_layout_2 = Qt.QGridLayout()
        self.freq_layout_2.addLayout(self.freq_grid_layout_2)
        self.freq.addTab(self.freq_widget_2, 'Demodulated')
        self.top_grid_layout.addWidget(self.freq)
        self.qtgui_time_sink_x_1 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            'Demodulated',  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_1.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_1.enable_tags(False)
        self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_1.enable_autoscale(True)
        self.qtgui_time_sink_x_1.enable_grid(False)
        self.qtgui_time_sink_x_1.enable_axis_labels(True)
        self.qtgui_time_sink_x_1.enable_control_panel(False)
        self.qtgui_time_sink_x_1.enable_stem_plot(False)

        labels = [
            'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
            'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.tab_layout_2.addWidget(self._qtgui_time_sink_x_1_win)
        self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "Message",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0_0.enable_tags(True)
        self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                      qtgui.TRIG_SLOPE_POS,
                                                      0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0_0.enable_stem_plot(False)

        labels = [
            'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
            'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_0.addWidget(self._qtgui_time_sink_x_0_0_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            'Modulated',  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        labels = [
            'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
            'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_1.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_freq_sink_x_2 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_KAISER,  #wintype
            0,  #fc
            samp_rate,  #bw
            'Demodulated',  #name
            1)
        self.qtgui_freq_sink_x_2.set_update_time(0.10)
        self.qtgui_freq_sink_x_2.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_2.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_2.enable_autoscale(True)
        self.qtgui_freq_sink_x_2.enable_grid(False)
        self.qtgui_freq_sink_x_2.set_fft_average(1.0)
        self.qtgui_freq_sink_x_2.enable_axis_labels(True)
        self.qtgui_freq_sink_x_2.enable_control_panel(False)

        self.qtgui_freq_sink_x_2.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_2.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_2.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_2.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_2.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_2.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_2_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_2.pyqwidget(), Qt.QWidget)
        self.freq_layout_2.addWidget(self._qtgui_freq_sink_x_2_win)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_KAISER,  #wintype
            0,  #fc
            samp_rate,  #bw
            'Message',  #name
            1)
        self.qtgui_freq_sink_x_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_1.enable_autoscale(True)
        self.qtgui_freq_sink_x_1.enable_grid(False)
        self.qtgui_freq_sink_x_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_1.enable_axis_labels(True)
        self.qtgui_freq_sink_x_1.enable_control_panel(False)

        self.qtgui_freq_sink_x_1.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_1_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget)
        self.freq_layout_0.addWidget(self._qtgui_freq_sink_x_1_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_KAISER,  #wintype
            0,  #fc
            samp_rate,  #bw
            'Modulated',  #name
            1)
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(True)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.freq_layout_1.addWidget(self._qtgui_freq_sink_x_0_win)
        self.low_pass_filter_0 = filter.interp_fir_filter_fff(
            1,
            firdes.low_pass(2, samp_rate, 15000, 100, firdes.WIN_KAISER, 6.76))
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_throttle_0_0_0 = blocks.throttle(gr.sizeof_float * 1,
                                                     samp_rate, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 100000, 1, 0, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 10000, 0.5, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_throttle_0_0_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_throttle_0_0_0, 0),
                     (self.qtgui_freq_sink_x_1, 0))
        self.connect((self.blocks_throttle_0_0_0, 0),
                     (self.qtgui_time_sink_x_0_0_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.qtgui_freq_sink_x_2, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.qtgui_time_sink_x_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.dc_blocker_xx_0, 0))
コード例 #44
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="fmReceiver3")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2000000
        self.freq = freq = 99.3e6

        ##################################################
        # Blocks
        ##################################################
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	label='freq',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freq_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	minimum=88e6,
        	maximum=120e6,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freq_sizer)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	dynamic_range=100,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot original",
        )
        self.Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.rtlsdr_source_1 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_1.set_sample_rate(samp_rate)
        self.rtlsdr_source_1.set_center_freq(freq, 0)
        self.rtlsdr_source_1.set_freq_corr(0, 0)
        self.rtlsdr_source_1.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_1.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_1.set_gain_mode(False, 0)
        self.rtlsdr_source_1.set_gain(49.2, 0)
        self.rtlsdr_source_1.set_if_gain(20, 0)
        self.rtlsdr_source_1.set_bb_gain(20, 0)
        self.rtlsdr_source_1.set_antenna("", 0)
        self.rtlsdr_source_1.set_bandwidth(0, 0)
          
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
                interpolation=48,
                decimation=500,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=4,
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate, 1e5, 1e6, firdes.WIN_HAMMING, 6.76))
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.band_pass_filter_0_0 = filter.interp_fir_filter_fff(1, firdes.band_pass(
        	1, samp_rate, 54e3, 60e3, 3e3, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.interp_fir_filter_fff(1, firdes.band_pass(
        	1, samp_rate, 18.5e3, 19.5e3, 3e3, firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(48000, "", True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=5e5,
        	audio_decimation=1,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv_0, 0), (self.band_pass_filter_0, 0))    
        self.connect((self.analog_wfm_rcv_0, 0), (self.band_pass_filter_0_0, 0))    
        self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_1, 0))    
        self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 2))    
        self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_0, 3))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.rational_resampler_xxx_1, 0), (self.audio_sink_0, 0))    
        self.connect((self.rtlsdr_source_1, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.rtlsdr_source_1, 0), (self.wxgui_waterfallsink2_0, 0))    
コード例 #45
0
    def __init__(self):
        gr.top_block.__init__(self, "Uhd Hf Am")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Uhd Hf Am")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "uhd_hf_am")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2.5e6
        self.rx_freq = rx_freq = 1.0e6
        self.fine_freq = fine_freq = 0
        self.coarse_freq = coarse_freq = 0
        self.volume = volume = 1
        self.usb_lsb = usb_lsb = -1
        self.ssb_am = ssb_am = 0
        self.selection = selection = ((1, 0, 0), (0, 1, 0), (0, 0, 1))
        self.pll_lbw = pll_lbw = 200
        self.pll_freq = pll_freq = 100
        self.lpf_cutoff = lpf_cutoff = 2e3
        self.interp = interp = 48
        self.freq_label = freq_label = rx_freq + fine_freq + coarse_freq
        self.decim = decim = samp_rate / 1e3
        self.decay_rate = decay_rate = 100e-6
        self.audio_ref = audio_ref = 1
        self.audio_max_gain = audio_max_gain = 1
        self.audio_gain = audio_gain = 1
        self.audio_decay = audio_decay = 100
        self.audio_attack = audio_attack = 1000

        ##################################################
        # Blocks
        ##################################################
        self._volume_range = Range(0, 100, .1, 1, 200)
        self._volume_win = RangeWidget(self._volume_range, self.set_volume,
                                       "volume", "counter_slider", float)
        self.top_grid_layout.addWidget(self._volume_win, 7, 0, 1, 4)
        for r in range(7, 8):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._usb_lsb_options = (
            -1,
            1,
        )
        self._usb_lsb_labels = (
            'USB',
            'LSB',
        )
        self._usb_lsb_group_box = Qt.QGroupBox("usb_lsb")
        self._usb_lsb_box = Qt.QHBoxLayout()

        class variable_chooser_button_group(Qt.QButtonGroup):
            def __init__(self, parent=None):
                Qt.QButtonGroup.__init__(self, parent)

            @pyqtSlot(int)
            def updateButtonChecked(self, button_id):
                self.button(button_id).setChecked(True)

        self._usb_lsb_button_group = variable_chooser_button_group()
        self._usb_lsb_group_box.setLayout(self._usb_lsb_box)
        for i, label in enumerate(self._usb_lsb_labels):
            radio_button = Qt.QRadioButton(label)
            self._usb_lsb_box.addWidget(radio_button)
            self._usb_lsb_button_group.addButton(radio_button, i)
        self._usb_lsb_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._usb_lsb_button_group, "updateButtonChecked",
            Qt.Q_ARG("int", self._usb_lsb_options.index(i)))
        self._usb_lsb_callback(self.usb_lsb)
        self._usb_lsb_button_group.buttonClicked[int].connect(
            lambda i: self.set_usb_lsb(self._usb_lsb_options[i]))
        self.top_grid_layout.addWidget(self._usb_lsb_group_box, 5, 5, 1, 1)
        for r in range(5, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(5, 6):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._ssb_am_options = (
            0,
            1,
            2,
        )
        self._ssb_am_labels = (
            'SSB',
            'AM',
            'AM*',
        )
        self._ssb_am_group_box = Qt.QGroupBox("ssb_am")
        self._ssb_am_box = Qt.QHBoxLayout()

        class variable_chooser_button_group(Qt.QButtonGroup):
            def __init__(self, parent=None):
                Qt.QButtonGroup.__init__(self, parent)

            @pyqtSlot(int)
            def updateButtonChecked(self, button_id):
                self.button(button_id).setChecked(True)

        self._ssb_am_button_group = variable_chooser_button_group()
        self._ssb_am_group_box.setLayout(self._ssb_am_box)
        for i, label in enumerate(self._ssb_am_labels):
            radio_button = Qt.QRadioButton(label)
            self._ssb_am_box.addWidget(radio_button)
            self._ssb_am_button_group.addButton(radio_button, i)
        self._ssb_am_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._ssb_am_button_group, "updateButtonChecked",
            Qt.Q_ARG("int", self._ssb_am_options.index(i)))
        self._ssb_am_callback(self.ssb_am)
        self._ssb_am_button_group.buttonClicked[int].connect(
            lambda i: self.set_ssb_am(self._ssb_am_options[i]))
        self.top_grid_layout.addWidget(self._ssb_am_group_box, 4, 4, 1, 1)
        for r in range(4, 5):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 5):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._rx_freq_range = Range(.2e6, 100e6, 100e3, 1.0e6, 200)
        self._rx_freq_win = RangeWidget(self._rx_freq_range, self.set_rx_freq,
                                        "rx_freq", "counter_slider", float)
        self.top_grid_layout.addWidget(self._rx_freq_win, 4, 0, 1, 4)
        for r in range(4, 5):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._pll_lbw_tool_bar = Qt.QToolBar(self)
        self._pll_lbw_tool_bar.addWidget(Qt.QLabel("pll_lbw" + ": "))
        self._pll_lbw_line_edit = Qt.QLineEdit(str(self.pll_lbw))
        self._pll_lbw_tool_bar.addWidget(self._pll_lbw_line_edit)
        self._pll_lbw_line_edit.returnPressed.connect(lambda: self.set_pll_lbw(
            eng_notation.str_to_num(
                str(self._pll_lbw_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._pll_lbw_tool_bar, 9, 7, 1, 1)
        for r in range(9, 10):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(7, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._pll_freq_tool_bar = Qt.QToolBar(self)
        self._pll_freq_tool_bar.addWidget(Qt.QLabel("pll_freq" + ": "))
        self._pll_freq_line_edit = Qt.QLineEdit(str(self.pll_freq))
        self._pll_freq_tool_bar.addWidget(self._pll_freq_line_edit)
        self._pll_freq_line_edit.returnPressed.connect(
            lambda: self.set_pll_freq(
                eng_notation.str_to_num(
                    str(self._pll_freq_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._pll_freq_tool_bar, 9, 6, 1, 1)
        for r in range(9, 10):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(6, 7):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._lpf_cutoff_options = (
            2e3,
            3e3,
            4e3,
            8e3,
        )
        self._lpf_cutoff_labels = (
            str(self._lpf_cutoff_options[0]),
            str(self._lpf_cutoff_options[1]),
            str(self._lpf_cutoff_options[2]),
            str(self._lpf_cutoff_options[3]),
        )
        self._lpf_cutoff_tool_bar = Qt.QToolBar(self)
        self._lpf_cutoff_tool_bar.addWidget(Qt.QLabel("lpf_cutoff" + ": "))
        self._lpf_cutoff_combo_box = Qt.QComboBox()
        self._lpf_cutoff_tool_bar.addWidget(self._lpf_cutoff_combo_box)
        for label in self._lpf_cutoff_labels:
            self._lpf_cutoff_combo_box.addItem(label)
        self._lpf_cutoff_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._lpf_cutoff_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._lpf_cutoff_options.index(i)))
        self._lpf_cutoff_callback(self.lpf_cutoff)
        self._lpf_cutoff_combo_box.currentIndexChanged.connect(
            lambda i: self.set_lpf_cutoff(self._lpf_cutoff_options[i]))
        self.top_grid_layout.addWidget(self._lpf_cutoff_tool_bar, 4, 5, 1, 1)
        for r in range(4, 5):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(5, 6):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._fine_freq_range = Range(-1e3, 1e3, 1, 0, 200)
        self._fine_freq_win = RangeWidget(self._fine_freq_range,
                                          self.set_fine_freq, "fine_freq",
                                          "counter_slider", float)
        self.top_grid_layout.addWidget(self._fine_freq_win, 6, 0, 1, 4)
        for r in range(6, 7):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._decay_rate_options = (
            100e-6,
            65e-3,
            20e-3,
        )
        self._decay_rate_labels = (
            'Fast',
            'Medium',
            'Slow',
        )
        self._decay_rate_group_box = Qt.QGroupBox("decay_rate")
        self._decay_rate_box = Qt.QHBoxLayout()

        class variable_chooser_button_group(Qt.QButtonGroup):
            def __init__(self, parent=None):
                Qt.QButtonGroup.__init__(self, parent)

            @pyqtSlot(int)
            def updateButtonChecked(self, button_id):
                self.button(button_id).setChecked(True)

        self._decay_rate_button_group = variable_chooser_button_group()
        self._decay_rate_group_box.setLayout(self._decay_rate_box)
        for i, label in enumerate(self._decay_rate_labels):
            radio_button = Qt.QRadioButton(label)
            self._decay_rate_box.addWidget(radio_button)
            self._decay_rate_button_group.addButton(radio_button, i)
        self._decay_rate_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._decay_rate_button_group, "updateButtonChecked",
            Qt.Q_ARG("int", self._decay_rate_options.index(i)))
        self._decay_rate_callback(self.decay_rate)
        self._decay_rate_button_group.buttonClicked[int].connect(
            lambda i: self.set_decay_rate(self._decay_rate_options[i]))
        self.top_grid_layout.addWidget(self._decay_rate_group_box, 4, 6, 1, 1)
        for r in range(4, 5):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(6, 7):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._coarse_freq_range = Range(-100e3, 100e3, 1, 0, 200)
        self._coarse_freq_win = RangeWidget(self._coarse_freq_range,
                                            self.set_coarse_freq,
                                            "coarse_freq", "counter_slider",
                                            float)
        self.top_grid_layout.addWidget(self._coarse_freq_win, 5, 0, 1, 4)
        for r in range(5, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._audio_ref_tool_bar = Qt.QToolBar(self)
        self._audio_ref_tool_bar.addWidget(Qt.QLabel("audio_ref" + ": "))
        self._audio_ref_line_edit = Qt.QLineEdit(str(self.audio_ref))
        self._audio_ref_tool_bar.addWidget(self._audio_ref_line_edit)
        self._audio_ref_line_edit.returnPressed.connect(
            lambda: self.set_audio_ref(
                eng_notation.str_to_num(
                    str(self._audio_ref_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._audio_ref_tool_bar, 9, 3, 1, 1)
        for r in range(9, 10):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(3, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._audio_max_gain_tool_bar = Qt.QToolBar(self)
        self._audio_max_gain_tool_bar.addWidget(
            Qt.QLabel("audio_max_gain" + ": "))
        self._audio_max_gain_line_edit = Qt.QLineEdit(str(self.audio_max_gain))
        self._audio_max_gain_tool_bar.addWidget(self._audio_max_gain_line_edit)
        self._audio_max_gain_line_edit.returnPressed.connect(
            lambda: self.set_audio_max_gain(
                eng_notation.str_to_num(
                    str(self._audio_max_gain_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._audio_max_gain_tool_bar, 9, 5, 1,
                                       1)
        for r in range(9, 10):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(5, 6):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._audio_gain_tool_bar = Qt.QToolBar(self)
        self._audio_gain_tool_bar.addWidget(Qt.QLabel("audio_gain" + ": "))
        self._audio_gain_line_edit = Qt.QLineEdit(str(self.audio_gain))
        self._audio_gain_tool_bar.addWidget(self._audio_gain_line_edit)
        self._audio_gain_line_edit.returnPressed.connect(
            lambda: self.set_audio_gain(
                eng_notation.str_to_num(
                    str(self._audio_gain_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._audio_gain_tool_bar, 9, 4, 1, 1)
        for r in range(9, 10):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 5):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._audio_decay_tool_bar = Qt.QToolBar(self)
        self._audio_decay_tool_bar.addWidget(Qt.QLabel("audio_decay" + ": "))
        self._audio_decay_line_edit = Qt.QLineEdit(str(self.audio_decay))
        self._audio_decay_tool_bar.addWidget(self._audio_decay_line_edit)
        self._audio_decay_line_edit.returnPressed.connect(
            lambda: self.set_audio_decay(
                eng_notation.str_to_num(
                    str(self._audio_decay_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._audio_decay_tool_bar, 9, 2, 1, 1)
        for r in range(9, 10):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 3):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._audio_attack_tool_bar = Qt.QToolBar(self)
        self._audio_attack_tool_bar.addWidget(Qt.QLabel("audio_attack" + ": "))
        self._audio_attack_line_edit = Qt.QLineEdit(str(self.audio_attack))
        self._audio_attack_tool_bar.addWidget(self._audio_attack_line_edit)
        self._audio_attack_line_edit.returnPressed.connect(
            lambda: self.set_audio_attack(
                eng_notation.str_to_num(
                    str(self._audio_attack_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._audio_attack_tool_bar, 9, 1, 1, 1)
        for r in range(9, 10):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.uhd_usrp_source_1 = uhd.usrp_source(
            ",".join(("addr=192.168.10.2", "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_1.set_clock_source('external', 0)
        self.uhd_usrp_source_1.set_time_source('external', 0)
        self.uhd_usrp_source_1.set_subdev_spec('A:AB', 0)
        self.uhd_usrp_source_1.set_samp_rate(samp_rate)
        self.uhd_usrp_source_1.set_time_now(uhd.time_spec(time.time()),
                                            uhd.ALL_MBOARDS)
        self.uhd_usrp_source_1.set_center_freq(uhd.tune_request(rx_freq, ), 0)
        self.uhd_usrp_source_1.set_gain(0, 0)
        self.uhd_usrp_source_1.set_auto_dc_offset(True, 0)
        self.uhd_usrp_source_1.set_auto_iq_balance(True, 0)
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
            interpolation=1,
            decimation=4,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc(
            interpolation=200,
            decimation=int(samp_rate / 1e3),
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=interp,
            decimation=int(decim),
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate / decim * interp / 3,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 8, 0, 1,
                                       4)
        for r in range(8, 9):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0,
                                                     qtgui.NUM_GRAPH_HORIZ, 1)
        self.qtgui_number_sink_0.set_update_time(0.010)
        self.qtgui_number_sink_0.set_title('')

        labels = ["RSSI", '', '', '', '', '', '', '', '', '']
        units = ['', '', '', '', '', '', '', '', '', '']
        colors = [("blue", "red"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black")]
        factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        for i in xrange(1):
            self.qtgui_number_sink_0.set_min(i, 0)
            self.qtgui_number_sink_0.set_max(i, 50)
            self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0.set_label(i, labels[i])
            self.qtgui_number_sink_0.set_unit(i, units[i])
            self.qtgui_number_sink_0.set_factor(i, factor[i])

        self.qtgui_number_sink_0.enable_autoscale(False)
        self._qtgui_number_sink_0_win = sip.wrapinstance(
            self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win, 5, 6, 1,
                                       1)
        for r in range(5, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(6, 7):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c(
            2048,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate / decim * interp / 3,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0.set_update_time(0.0010)
        self.qtgui_freq_sink_x_0_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0,
                                                    0, "")
        self.qtgui_freq_sink_x_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0.enable_grid(True)
        self.qtgui_freq_sink_x_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0_0.enable_control_panel(False)

        if not False:
            self.qtgui_freq_sink_x_0_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True)

        labels = ['', 'processed', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 6, 4,
                                       3, 2)
        for r in range(6, 9):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 6):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            2048,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate / decim * interp,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.010)
        self.qtgui_freq_sink_x_0.set_y_axis(-120, -10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(True)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ['pre-d', 'processed', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 4, 4,
                                       4)
        for r in range(0, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.low_pass_filter_0_1 = filter.interp_fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate / decim * interp / 3, 1.5e3, 100,
                            firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_0 = filter.fir_filter_ccf(
            3,
            firdes.low_pass(1, samp_rate / decim * interp, lpf_cutoff, 100,
                            firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.interp_fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate / decim * interp / 3, 1.5e3, 100,
                            firdes.WIN_HAMMING, 6.76))
        self._freq_label_tool_bar = Qt.QToolBar(self)

        if None:
            self._freq_label_formatter = None
        else:
            self._freq_label_formatter = lambda x: eng_notation.num_to_str(x)

        self._freq_label_tool_bar.addWidget(Qt.QLabel('Tuned Freq' + ": "))
        self._freq_label_label = Qt.QLabel(
            str(self._freq_label_formatter(self.freq_label)))
        self._freq_label_tool_bar.addWidget(self._freq_label_label)
        self.top_grid_layout.addWidget(self._freq_label_tool_bar, 5, 4, 1, 1)
        for r in range(5, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 5):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.fosphor_qt_sink_c_0 = fosphor.qt_sink_c()
        self.fosphor_qt_sink_c_0.set_fft_window(window.WIN_BLACKMAN_hARRIS)
        self.fosphor_qt_sink_c_0.set_frequency_range(
            rx_freq, samp_rate / int(samp_rate / 1e3) * 200)
        self._fosphor_qt_sink_c_0_win = sip.wrapinstance(
            self.fosphor_qt_sink_c_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._fosphor_qt_sink_c_0_win, 0, 0, 4,
                                       4)
        for r in range(0, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.blocks_multiply_xx_1_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_matrix_xx_0_0_0 = blocks.multiply_matrix_cc(
            (selection[ssb_am], ), gr.TPP_ALL_TO_ALL)
        self.blocks_multiply_matrix_xx_0 = blocks.multiply_matrix_ff(
            (selection[ssb_am], ), gr.TPP_ALL_TO_ALL)
        self.blocks_multiply_const_vxx_1_0 = blocks.multiply_const_vff(
            (100000, ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff(
            (usb_lsb, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (volume, ))
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(
            1000, 1 / 1000.0, 4000, 1)
        self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.audio_sink_0 = audio.sink(16000, '', True)
        self.analog_sig_source_x_0_0_0 = analog.sig_source_f(
            samp_rate / decim * interp / 3, analog.GR_SIN_WAVE, 1.5e3, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            samp_rate / decim * interp / 3, analog.GR_COS_WAVE, 1.5e3, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -1 * (fine_freq + coarse_freq), 1,
            0)
        self.analog_pll_carriertracking_cc_0 = analog.pll_carriertracking_cc(
            math.pi / pll_lbw, math.pi / pll_freq, -math.pi / pll_freq)
        self.analog_agc2_xx_0_0 = analog.agc2_ff(audio_attack, audio_decay,
                                                 audio_ref, audio_gain)
        self.analog_agc2_xx_0_0.set_max_gain(audio_max_gain)
        self.analog_agc2_xx_0 = analog.agc2_cc(0.1, decay_rate, .3, 1000)
        self.analog_agc2_xx_0.set_max_gain(65000)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.analog_agc2_xx_0_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.analog_pll_carriertracking_cc_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.analog_pll_carriertracking_cc_0, 0),
                     (self.blocks_multiply_matrix_xx_0_0_0, 2))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.analog_sig_source_x_0_0_0, 0),
                     (self.blocks_multiply_xx_1_0, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_matrix_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.low_pass_filter_0_1, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_moving_average_xx_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_multiply_matrix_xx_0, 2))
        self.connect((self.blocks_complex_to_real_0_0, 0),
                     (self.blocks_multiply_matrix_xx_0, 1))
        self.connect((self.blocks_moving_average_xx_0, 0),
                     (self.blocks_multiply_const_vxx_1_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_1_0, 0),
                     (self.qtgui_number_sink_0, 0))
        self.connect((self.blocks_multiply_matrix_xx_0, 0),
                     (self.analog_agc2_xx_0_0, 0))
        self.connect((self.blocks_multiply_matrix_xx_0_0_0, 0),
                     (self.qtgui_freq_sink_x_0_0, 0))
        self.connect((self.blocks_multiply_matrix_xx_0_0_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_1_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.analog_pll_carriertracking_cc_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.blocks_complex_to_real_0_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.blocks_multiply_matrix_xx_0_0_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.blocks_multiply_matrix_xx_0_0_0, 1))
        self.connect((self.low_pass_filter_0_1, 0),
                     (self.blocks_multiply_xx_1_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.fosphor_qt_sink_c_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.uhd_usrp_source_1, 0), (self.analog_agc2_xx_0, 0))
コード例 #46
0
    def __init__(self):
        gr.top_block.__init__(self, "Channel Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Channel Block")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "channel_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sound_card_sample_rate = sound_card_sample_rate = 22000
        self.samples_per_symbol = samples_per_symbol = 16
        self.symbol_rate = symbol_rate = sound_card_sample_rate / samples_per_symbol
        self.rx_frequency_error = rx_frequency_error = 100
        self.quantization_depth = quantization_depth = 16
        self.if_frequency = if_frequency = sound_card_sample_rate / 4

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_1_2_0 = qtgui.time_sink_f(
            500,  #size
            sound_card_sample_rate,  #samp_rate
            "Received signal",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_1_2_0.set_update_time(0.10)
        self.qtgui_time_sink_x_1_2_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_1_2_0.set_y_label("Amplitude", "")

        self.qtgui_time_sink_x_1_2_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_1_2_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                      qtgui.TRIG_SLOPE_POS,
                                                      0.0, 0, 0, "")
        self.qtgui_time_sink_x_1_2_0.enable_autoscale(True)
        self.qtgui_time_sink_x_1_2_0.enable_grid(False)
        self.qtgui_time_sink_x_1_2_0.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_1_2_0.disable_legend()

        labels = ["", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1_2_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1_2_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1_2_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1_2_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1_2_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1_2_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1_2_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_1_2_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1_2_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_2_0_win)
        self.low_pass_filter_0_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1.66, sound_card_sample_rate,
                            sound_card_sample_rate / 4,
                            sound_card_sample_rate / 8, firdes.WIN_HANN, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1.66, sound_card_sample_rate,
                            sound_card_sample_rate / 4,
                            sound_card_sample_rate / 8, firdes.WIN_HANN, 6.76))
        self.final = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            sound_card_sample_rate,  #bw
            "Distorted baseband signal",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.final.set_update_time(1.0 / 10)
        self._final_win = sip.wrapinstance(self.final.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._final_win)

        self.final.enable_rf_freq(False)

        self.channels_fading_model_0 = channels.fading_model(
            16, 0, False, 4.0, 0)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            "tx_signal.wav", False)
        self.blocks_wavfile_sink_0 = blocks.wavfile_sink(
            "rx_signal.wav", 1, sound_card_sample_rate, quantization_depth)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 sound_card_sample_rate, True)
        self.blocks_multiply_xx_0_0_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_sig_source_x_0_1 = analog.sig_source_f(
            sound_card_sample_rate, analog.GR_SIN_WAVE,
            if_frequency + rx_frequency_error, 1, 0)
        self.analog_sig_source_x_0_0_0 = analog.sig_source_f(
            sound_card_sample_rate, analog.GR_COS_WAVE,
            if_frequency + rx_frequency_error, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            sound_card_sample_rate, analog.GR_COS_WAVE, if_frequency, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            sound_card_sample_rate, analog.GR_SIN_WAVE, if_frequency, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0, 0),
                     (self.blocks_multiply_xx_0_0_0, 0))
        self.connect((self.analog_sig_source_x_0_1, 0),
                     (self.blocks_multiply_xx_0_0_1, 1))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_0_0_0, 1))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_multiply_xx_0_0_1, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.channels_fading_model_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_multiply_xx_0_0_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0_0_1, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_wavfile_sink_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_time_sink_x_1_2_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.channels_fading_model_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.channels_fading_model_0, 0), (self.final, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.blocks_float_to_complex_0, 0))
コード例 #47
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self,
                                         title="Non Linear Junction Detector")

        ##################################################
        # Variables
        ##################################################
        self.volume = volume = -19
        self.variable_check_box_0 = variable_check_box_0 = 0
        self.samp_rate = samp_rate = 4000000
        self.demod_rate = demod_rate = 40000
        self.audio_rate = audio_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=audio_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            label='volume',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._volume_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            minimum=-20,
            maximum=10,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_volume_sizer)
        self._variable_check_box_0_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.variable_check_box_0,
            callback=self.set_variable_check_box_0,
            label='rf_on_off',
            true=60,
            false=0,
        )
        self.Add(self._variable_check_box_0_check_box)
        self.sdr_source_0 = sdr.source({}, "CF32", ([0]), {})
        self.sdr_source_0.set_samp_rate(samp_rate)
        self.sdr_source_0.set_center_freq(999000000, 0)
        self.sdr_source_0.set_gain(10, 0)
        self.sdr_sink_0 = sdr.sink({}, "CF32", ([0]), {})
        self.sdr_sink_0.set_samp_rate(samp_rate)
        self.sdr_sink_0.set_center_freq(5875000000, 0)
        self.sdr_sink_0.set_gain(0, 0)
        self.sdr_sink_0.set_antenna('TX/RX', 0)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=48,
            decimation=40,
            taps=None,
            fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_fff(
            100,
            firdes.low_pass(3, samp_rate, 10000, 5000, firdes.WIN_HAMMING,
                            6.76))
        self.high_pass_filter_0 = filter.fir_filter_fff(
            1, firdes.high_pass(2, demod_rate, 100, 50, firdes.WIN_HANN, 6.76))
        self.fosphor_wx_sink_c_0 = fosphor.wx_sink_c(self.GetWin())
        self.fosphor_wx_sink_c_0.set_fft_window(window.WIN_BLACKMAN_hARRIS)
        self.fosphor_wx_sink_c_0.set_frequency_range(999000000, samp_rate)
        self.Add(self.fosphor_wx_sink_c_0.win)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_float * 1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_abs_xx_0 = blocks.abs_ii(1)
        self.audio_sink_0 = audio.sink(audio_rate, '', True)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, -1000000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            100000, analog.GR_COS_WAVE, 0, 2, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_abs_xx_0, 0), (self.high_pass_filter_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_null_sink_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.sdr_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_null_source_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.high_pass_filter_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_abs_xx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.sdr_source_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.sdr_source_0, 0), (self.fosphor_wx_sink_c_0, 0))
コード例 #48
0
ファイル: ask_keyer.py プロジェクト: gbThreepwood/winchRemote
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Ask Keyer")

        ##################################################
        # Variables
        ##################################################
        self.tx_freq = tx_freq = 433.9e6
        self.symbol_length = symbol_length = 750e-6
        self.samp_rate = samp_rate = 2e6

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" )
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(tx_freq, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(20, 0)
        self.osmosdr_sink_0.set_if_gain(20, 0)
        self.osmosdr_sink_0.set_bb_gain(20, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)
          
        self.blocks_vector_source_x_0 = blocks.vector_source_f([0,0,1,1,1,1,0,0,1,1,0,1,0,1,0,1,0,0,0,0,0,0,1,1,0], True, 1, [])
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_float*1, int(symbol_length*samp_rate))
        self.blocks_patterned_interleaver_0_0 = blocks.patterned_interleaver(gr.sizeof_float*1, ([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]))
        self.blocks_patterned_interleaver_0 = blocks.patterned_interleaver(gr.sizeof_float*1, ([2,0,1]))
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, tx_freq, 1, 0)
        self.analog_const_source_x_0_1 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1)
        self.analog_const_source_x_0_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_patterned_interleaver_0, 2))    
        self.connect((self.analog_const_source_x_0_0, 0), (self.blocks_patterned_interleaver_0_0, 1))    
        self.connect((self.analog_const_source_x_0_1, 0), (self.blocks_patterned_interleaver_0, 1))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_patterned_interleaver_0, 0), (self.blocks_patterned_interleaver_0_0, 0))    
        self.connect((self.blocks_patterned_interleaver_0_0, 0), (self.blocks_repeat_0, 0))    
        self.connect((self.blocks_repeat_0, 0), (self.blocks_throttle_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.osmosdr_sink_0, 0))    
        self.connect((self.blocks_throttle_0_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_patterned_interleaver_0, 0))    
コード例 #49
0
    def __init__(self):
        gr.top_block.__init__(self, "add constant")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("add constant")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "addconstant")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        labels = [
            'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
            'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_ff(0)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 8000, 0.5, 0, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 350, 0.9, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
コード例 #50
0
ファイル: rx.py プロジェクト: pjbalt/satellite
    def __init__(self, freq=0, gain=0, loopbw=100, fllbw=0.002):
        gr.top_block.__init__(self, "Rx")

        ##################################################
        # Parameters
        ##################################################
        self.freq = freq
        self.gain = gain
        self.loopbw = loopbw
        self.fllbw = fllbw

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 8
        self.excess_bw = excess_bw = 0.25
        self.target_samp_rate = target_samp_rate = sps*(200e3/(1 + excess_bw))
        
        self.qpsk_const = qpsk_const = digital.constellation_qpsk().base()
        
        self.dsp_rate = dsp_rate = 100e6
        self.const_choice = const_choice = "qpsk"
        
        self.bpsk_const = bpsk_const = digital.constellation_bpsk().base()
        
        self.barker_code_two_dim = barker_code_two_dim = [-1.0000 - 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j,  1.0000 + 1.0000j,  1.0000 + 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j,  1.0000 + 1.0000j, -1.0000 - 1.0000j,  1.0000 + 1.0000j, -1.0000 - 1.0000j]
        self.barker_code_one_dim = barker_code_one_dim = sqrt(2)*numpy.real([-1.0000 - 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j,  1.0000 + 1.0000j,  1.0000 + 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j,  1.0000 + 1.0000j, -1.0000 - 1.0000j,  1.0000 + 1.0000j, -1.0000 - 1.0000j])
        self.rrc_delay = rrc_delay = int(round(-44*excess_bw + 33))
        self.nfilts = nfilts = 32
        self.n_barker_rep = n_barker_rep = 10
        self.dec_factor = dec_factor = ceil(dsp_rate/target_samp_rate)
        self.constellation = constellation = qpsk_const if (const_choice=="qpsk") else bpsk_const
        self.barker_code = barker_code = barker_code_two_dim if (const_choice == "qpsk") else barker_code_one_dim
        self.preamble_syms = preamble_syms = numpy.matlib.repmat(barker_code, 1, n_barker_rep)[0]
        self.n_rrc_taps = n_rrc_taps = rrc_delay * int(sps*nfilts)
        self.n_codewords = n_codewords = 1
        self.even_dec_factor = even_dec_factor = dec_factor if (dec_factor % 1 == 1) else (dec_factor+1)
        self.const_order = const_order = pow(2,constellation.bits_per_symbol())
        self.codeword_len = codeword_len = 18444
        self.usrp_rx_addr = usrp_rx_addr = "192.168.10.2"
        self.samp_rate = samp_rate = dsp_rate/even_dec_factor
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts*sps, 1.0, excess_bw, n_rrc_taps)
        self.rf_center_freq = rf_center_freq = 1428.4309e6
        self.preamble_size = preamble_size = len(preamble_syms)
        self.pmf_peak_threshold = pmf_peak_threshold = 0.6
        self.payload_size = payload_size = codeword_len*n_codewords/int(numpy.log2(const_order))
        self.dataword_len = dataword_len = 6144
        self.barker_len = barker_len = 13

        ##################################################
        # Blocks
        ##################################################
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(gain, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna('', 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.mods_turbo_decoder_0 = mods.turbo_decoder(codeword_len, dataword_len)
        self.mods_frame_sync_fast_0 = mods.frame_sync_fast(pmf_peak_threshold, preamble_size, payload_size, 0, 1, 1, int(const_order))
        self.mods_fifo_async_sink_0 = mods.fifo_async_sink('/tmp/async_rx')
        self.interp_fir_filter_xxx_0_0 = filter.interp_fir_filter_fff(1, ( numpy.ones(n_barker_rep*barker_len)))
        self.interp_fir_filter_xxx_0_0.declare_sample_delay(0)
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(1, ( numpy.flipud(numpy.conj(preamble_syms))))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.framers_gr_hdlc_deframer_b_0 = framers.gr_hdlc_deframer_b(0)
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, 2*pi/50, (rrc_taps), nfilts, nfilts/2, pi/8, 1)
        self.digital_map_bb_0_0_0 = digital.map_bb(([1,- 1]))
        self.digital_fll_band_edge_cc_1 = digital.fll_band_edge_cc(sps, excess_bw, rrc_delay * int(sps) + 1, fllbw)
        self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0x7F, 16)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(2*pi/loopbw, 2**constellation.bits_per_symbol(), False)
        self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(constellation.base())
        self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(constellation.bits_per_symbol())
        self.blocks_rms_xx_1 = blocks.rms_cf(0.0001)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_1_1 = blocks.multiply_const_vcc((1.0/sqrt(2), ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((1.0/(preamble_size*sqrt(2)), ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_divide_xx_1 = blocks.divide_ff(1)
        self.blocks_divide_xx_0 = blocks.divide_cc(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_mag_1 = blocks.complex_to_mag(1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.framers_gr_hdlc_deframer_b_0, 'pdu'), (self.mods_fifo_async_sink_0, 'async_pdu'))    
        self.connect((self.blocks_complex_to_mag_1, 0), (self.blocks_divide_xx_1, 0))    
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.interp_fir_filter_xxx_0_0, 0))    
        self.connect((self.blocks_divide_xx_0, 0), (self.digital_fll_band_edge_cc_1, 0))    
        self.connect((self.blocks_divide_xx_1, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.blocks_divide_xx_1, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_divide_xx_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.mods_frame_sync_fast_0, 2))    
        self.connect((self.blocks_multiply_const_vxx_1_1, 0), (self.blocks_complex_to_mag_1, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.mods_frame_sync_fast_0, 1))    
        self.connect((self.blocks_rms_xx_1, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.digital_map_bb_0_0_0, 0))    
        self.connect((self.digital_constellation_decoder_cb_0, 0), (self.blocks_unpack_k_bits_bb_0, 0))    
        self.connect((self.digital_costas_loop_cc_0, 0), (self.blocks_complex_to_mag_squared_0, 0))    
        self.connect((self.digital_costas_loop_cc_0, 0), (self.interp_fir_filter_xxx_0, 0))    
        self.connect((self.digital_costas_loop_cc_0, 0), (self.mods_frame_sync_fast_0, 0))    
        self.connect((self.digital_descrambler_bb_0, 0), (self.framers_gr_hdlc_deframer_b_0, 0))    
        self.connect((self.digital_fll_band_edge_cc_1, 0), (self.digital_pfb_clock_sync_xxx_0, 0))    
        self.connect((self.digital_map_bb_0_0_0, 0), (self.mods_turbo_decoder_0, 0))    
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_costas_loop_cc_0, 0))    
        self.connect((self.interp_fir_filter_xxx_0, 0), (self.blocks_multiply_const_vxx_1, 0))    
        self.connect((self.interp_fir_filter_xxx_0, 0), (self.blocks_multiply_const_vxx_1_1, 0))    
        self.connect((self.interp_fir_filter_xxx_0_0, 0), (self.blocks_divide_xx_1, 1))    
        self.connect((self.mods_frame_sync_fast_0, 0), (self.digital_constellation_decoder_cb_0, 0))    
        self.connect((self.mods_turbo_decoder_0, 0), (self.digital_descrambler_bb_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_divide_xx_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_rms_xx_1, 0))    
コード例 #51
0
ファイル: gr_car_counter.py プロジェクト: jbm9/gr_car_counter
    def __init__(self,
                              alsa_dev="default:CARD=Device",
                              averaging_period=1.0,
                              zscore_period=300.0,
                              trigger_threshold=1.0,
                              trigger_holdoff=2.0,
                              debug_print_period=3.0,
                              logfile_path=None,
                              NFFT = 128,
                              audio_rate=48000,
                              audio_decim=6):
        gr.top_block.__init__(self)

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = audio_rate/audio_decim

        ##################################################
        # Blocks
        ##################################################

        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=1,
                decimation=audio_decim,
                taps=None,
                fractional_bw=None,
        )
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.audio_source_0 = audio.source(audio_rate, alsa_dev, True)

        self.pack_for_fft = blocks.stream_to_vector(gr.sizeof_float*1, NFFT)
        self.fft = fft.fft_vfc(NFFT, True, (fft.window.blackmanharris(NFFT)), 1)
        self.unpack_fft = blocks.vector_to_stream(gr.sizeof_gr_complex*1, NFFT)

        self.mag = blocks.complex_to_mag(1)

        self.median = np_median(NFFT)


        averaging_samples = int(averaging_period * self.samp_rate / NFFT)
        self.moving_average = blocks.moving_average_ff(averaging_samples, 1.0/averaging_samples)

        z_score_samples = int(zscore_period * self.samp_rate / NFFT)
        self.z_score = jbm_z_score(z_score_samples)

        debug_print_samples = int(debug_print_period * self.samp_rate/NFFT)
        self.print_decim = jbm_print_decim(debug_print_samples)

        if logfile_path == None:
            logfile_path = ("carlog_%d.txt" % time.time())
        logfile = file(logfile_path, "a")
        self.threshold_ts = jbm_threshold_timestamp(time.time(), self.samp_rate/NFFT, trigger_threshold, trigger_holdoff, logfile)




        ##################################################
        # Connections
        ##################################################
        self.connect((self.audio_source_0, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect(self.rational_resampler_xxx_0, self.pack_for_fft)
        self.connect(self.pack_for_fft, self.fft, self.unpack_fft, self.mag)
        self.connect(self.mag, self.median)
        self.connect(self.median, self.moving_average, self.z_score)
        self.connect((self.z_score,0), self.threshold_ts)

        if debug_print_period != 0:
            for i in range(3):
                self.connect((self.z_score, i), (self.print_decim, i))
        else:
            for i in range(3):
                dummy_null_sink = blocks.null_sink(gr.sizeof_float)
                self.connect((self.z_score, i), dummy_null_sink)
コード例 #52
0
ファイル: Project.py プロジェクト: bigbrett/engs110_FM_stereo
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FM Stereo Receiver")

        ##################################################
        # Variables
        ##################################################
        self.smux_filt_samprate = smux_filt_samprate = 256e3
        self.smux_decim = smux_decim = 8
        self.samp_rate = samp_rate = 2.048e6
        self.right_gain = right_gain = 3
        self.left_gain = left_gain = 3
        self.bpf_base = bpf_base = 23e3
        self.RF_Gain = RF_Gain = 45
        self.CF = CF = 99.3e6

        ##################################################
        # Blocks
        ##################################################
        self._samp_rate_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.samp_rate,
        	callback=self.set_samp_rate,
        	label="Sample Rate: 1.024M, 1.4M, 1.8M, 1.92M, 2.048M, 2.4M & 2. 56M",
        	converter=forms.float_converter(),
        )
        self.GridAdd(self._samp_rate_text_box, 1, 0, 1, 1)
        _right_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._right_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_right_gain_sizer,
        	value=self.right_gain,
        	callback=self.set_right_gain,
        	label="R Audio Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._right_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_right_gain_sizer,
        	value=self.right_gain,
        	callback=self.set_right_gain,
        	minimum=0,
        	maximum=5,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_right_gain_sizer, 0, 1, 1, 1)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "BB Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Demod Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Stereo Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Stereo Signal")
        self.GridAdd(self.notebook_0, 2, 0, 1, 2)
        _left_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._left_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_left_gain_sizer,
        	value=self.left_gain,
        	callback=self.set_left_gain,
        	label="L Audio Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._left_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_left_gain_sizer,
        	value=self.left_gain,
        	callback=self.set_left_gain,
        	minimum=0,
        	maximum=5,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_left_gain_sizer, 0, 0, 1, 1)
        _RF_Gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._RF_Gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_RF_Gain_sizer,
        	value=self.RF_Gain,
        	callback=self.set_RF_Gain,
        	label="RF Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._RF_Gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_RF_Gain_sizer,
        	value=self.RF_Gain,
        	callback=self.set_RF_Gain,
        	minimum=0,
        	maximum=100,
        	num_steps=45,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_RF_Gain_sizer, 1, 1, 1, 1)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=0,
        	dynamic_range=100,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Baseband Waterfall",
        	size=(800,100),
        )
        self.notebook_0.GetPage(0).GridAdd(self.wxgui_waterfallsink2_0.win, 3, 0, 1, 2)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.notebook_0.GetPage(3).GetWin(),
        	title="Scope Plot",
        	sample_rate=32e3,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=2,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        	size=(800,500),
        )
        self.notebook_0.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_1 = fftsink2.fft_sink_f(
        	self.notebook_0.GetPage(2).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=32e3,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Difference FFT ",
        	peak_hold=False,
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_0_1.win)
        self.wxgui_fftsink2_0_0_0 = fftsink2.fft_sink_f(
        	self.notebook_0.GetPage(1).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate/8,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Demodulated FFT",
        	peak_hold=False,
        	size=(800,800),
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_0_0_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Baseband FFT",
        	peak_hold=False,
        	size=(800,100),
        )
        self.notebook_0.GetPage(0).GridAdd(self.wxgui_fftsink2_0_0.win, 2, 0, 1, 2)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.notebook_0.GetPage(2).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=32e3,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Sum FFT",
        	peak_hold=False,
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_0.win)
        self.rfgain = blocks.multiply_const_vcc((RF_Gain, ))
        self.low_pass_filter_1_0 = filter.fir_filter_fff(smux_decim, firdes.low_pass(
        	1, smux_filt_samprate, 15e3, 500, firdes.WIN_HAMMING, 1))
        self.low_pass_filter_0 = filter.fir_filter_ccf(2, firdes.low_pass(
        	2, samp_rate/4, 100e3, 500, firdes.WIN_KAISER, 6.76))
        self.iir_filter_xxx_0 = filter.iir_filter_ccf((-0.00266, 0.00504, -0.00309, -0.00136, 0.00663, -0.01052, 0.01103, -0.00731, 0.00016, 0.00800, -0.01396, 0.01490, -0.00971, -0.00035, 0.01173, -0.01979, 0.02054, -0.01240, -0.00273, 0.01960, -0.03122, 0.03124, -0.01669, -0.01017, 0.04137, -0.06448, 0.06476, -0.02634, -0.07449, 0.33571, -0.00000, -0.33571, 0.07449, 0.02634, -0.06476, 0.06448, -0.04137, 0.01017, 0.01669, -0.03124, 0.03122, -0.01960, 0.00273, 0.01240, -0.02054, 0.01979, -0.01173, 0.00035, 0.00971, -0.01490, 0.01396, -0.00800, -0.00016, 0.00731, -0.01103, 0.01052, -0.00663, 0.00136, 0.00309, -0.00504, 0.00266
        ), (1 , ), False)
        self.fir_filter_xxx_0_0 = filter.fir_filter_ccf(4, (1,1,1,1))
        self.fir_filter_xxx_0_0.declare_sample_delay(0)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_xx_1_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((right_gain, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((left_gain, ))
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/Users/bretttt/iCloud_drive/16S/engs110/project/radio_dat/IQ_Data_STEREO1", True)
        self.blocks_divide_xx_1 = blocks.divide_cc(1)
        self.blocks_delay_2 = blocks.delay(gr.sizeof_gr_complex*1, 30)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.1, ))
        self.baseband_LPF = filter.fir_filter_fff(smux_decim, firdes.low_pass(
        	1, smux_filt_samprate, 15e3, 500, firdes.WIN_KAISER, 6.76))
        self.band_pass_filter_0_0_0 = filter.fir_filter_fcc(1, firdes.complex_band_pass(
        	1, smux_filt_samprate, 18000, 20000, 1000, firdes.WIN_KAISER, 1))
        self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	1, smux_filt_samprate, bpf_base, bpf_base+30e3, 500, firdes.WIN_KAISER, 6.76))
        self.audio_sink_0_0_0_0 = audio.sink(32000, "", True)
        self.analog_pll_refout_cc_0_0 = analog.pll_refout_cc(3.14/100, 0.152*3.14, 0.144*3.14)
        self.analog_fm_deemph_0_0 = analog.fm_deemph(fs=samp_rate/8, tau=75e-6)
        self.analog_fm_deemph_0 = analog.fm_deemph(fs=samp_rate/8, tau=75e-6)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0)
        _CF_sizer = wx.BoxSizer(wx.VERTICAL)
        self._CF_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_CF_sizer,
        	value=self.CF,
        	callback=self.set_CF,
        	label="Center Frequency",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._CF_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_CF_sizer,
        	value=self.CF,
        	callback=self.set_CF,
        	minimum=80e6,
        	maximum=108e6,
        	num_steps=280,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_CF_sizer, 3, 0, 1, 2)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.analog_fm_deemph_0, 0), (self.audio_sink_0_0_0_0, 0))    
        self.connect((self.analog_fm_deemph_0_0, 0), (self.audio_sink_0_0_0_0, 1))    
        self.connect((self.analog_pll_refout_cc_0_0, 0), (self.blocks_multiply_xx_1_0, 0))    
        self.connect((self.analog_pll_refout_cc_0_0, 0), (self.blocks_multiply_xx_1_0, 1))    
        self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.band_pass_filter_0_0_0, 0), (self.analog_pll_refout_cc_0_0, 0))    
        self.connect((self.baseband_LPF, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.baseband_LPF, 0), (self.blocks_sub_xx_0, 0))    
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_divide_xx_1, 1))    
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_complex_to_imag_0, 0), (self.band_pass_filter_0, 0))    
        self.connect((self.blocks_complex_to_imag_0, 0), (self.band_pass_filter_0_0_0, 0))    
        self.connect((self.blocks_complex_to_imag_0, 0), (self.baseband_LPF, 0))    
        self.connect((self.blocks_complex_to_imag_0, 0), (self.wxgui_fftsink2_0_0_0, 0))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_delay_2, 0), (self.blocks_multiply_conjugate_cc_0, 1))    
        self.connect((self.blocks_divide_xx_1, 0), (self.blocks_delay_2, 0))    
        self.connect((self.blocks_divide_xx_1, 0), (self.iir_filter_xxx_0, 0))    
        self.connect((self.blocks_file_source_0_0, 0), (self.rfgain, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_add_const_vxx_0, 0))    
        self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.blocks_complex_to_imag_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.analog_fm_deemph_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.analog_fm_deemph_0_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.wxgui_fftsink2_0_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.wxgui_scopesink2_0, 1))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_1_0, 0))    
        self.connect((self.blocks_multiply_xx_1_0, 0), (self.blocks_complex_to_real_0, 0))    
        self.connect((self.blocks_sub_xx_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.fir_filter_xxx_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_waterfallsink2_0, 0))    
        self.connect((self.fir_filter_xxx_0_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.iir_filter_xxx_0, 0), (self.blocks_multiply_conjugate_cc_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.blocks_divide_xx_1, 0))    
        self.connect((self.low_pass_filter_1_0, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.low_pass_filter_1_0, 0), (self.blocks_sub_xx_0, 1))    
        self.connect((self.rfgain, 0), (self.blocks_throttle_0, 0))    
コード例 #53
0
ファイル: audio_tx.py プロジェクト: Petelr/acoustic_radio
    def __init__(self):
        gr.top_block.__init__(self, "Audio Tx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Audio Tx")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "audio_tx")

        if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            self.restoreGeometry(self.settings.value("geometry").toByteArray())
        else:
            self.restoreGeometry(
                self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 1
        self.nfilts = nfilts = 25
        self.samp_rate = samp_rate = 32E3
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(sps), 0.35, 45 * nfilts)
        self.qpsk = qpsk = digital.constellation_rect(([
            0.707 + 0.707j, -0.707 + 0.707j, -0.707 - 0.707j, 0.707 - 0.707j
        ]), ([0, 1, 2, 3]), 4, 2, 2, 1, 1).base()
        self.phase_bw = phase_bw = 6.28 / 100.0
        self.excess_bw = excess_bw = 0.35

        self.BPSK = BPSK = digital.constellation_qpsk().base()

        ##################################################
        # Blocks
        ##################################################
        self._phase_bw_range = Range(0.0, 1.0, 0.01, 6.28 / 100.0, 200)
        self._phase_bw_win = RangeWidget(self._phase_bw_range,
                                         self.set_phase_bw, 'Phase: Bandwidth',
                                         "slider", float)
        self.top_layout.addWidget(self._phase_bw_win)
        self.qtgui_time_sink_x_1_1 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_1_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1_1.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_1_1.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_1_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_1_1.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                    qtgui.TRIG_SLOPE_POS, 0.0,
                                                    0, 0, "")
        self.qtgui_time_sink_x_1_1.enable_autoscale(False)
        self.qtgui_time_sink_x_1_1.enable_grid(False)
        self.qtgui_time_sink_x_1_1.enable_axis_labels(True)
        self.qtgui_time_sink_x_1_1.enable_control_panel(False)
        self.qtgui_time_sink_x_1_1.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_1_1.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_1_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_1_win)
        self.qtgui_time_sink_x_1_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_1_0.set_update_time(0.10)
        self.qtgui_time_sink_x_1_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_1_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_1_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                    qtgui.TRIG_SLOPE_POS, 0.0,
                                                    0, 0, "")
        self.qtgui_time_sink_x_1_0.enable_autoscale(False)
        self.qtgui_time_sink_x_1_0.enable_grid(False)
        self.qtgui_time_sink_x_1_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_1_0.enable_control_panel(False)
        self.qtgui_time_sink_x_1_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_1_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_1_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_0_win)
        self.qtgui_time_sink_x_1 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_1.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_1.enable_autoscale(False)
        self.qtgui_time_sink_x_1.enable_grid(False)
        self.qtgui_time_sink_x_1.enable_axis_labels(True)
        self.qtgui_time_sink_x_1.enable_control_panel(False)
        self.qtgui_time_sink_x_1.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_1.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_const_sink_x_0_0 = qtgui.const_sink_c(
            1024,  #size
            "demod",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                     qtgui.TRIG_SLOPE_POS, 0.0,
                                                     0, "")
        self.qtgui_const_sink_x_0_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0_0.enable_grid(True)
        self.qtgui_const_sink_x_0_0.enable_axis_labels(True)

        if not True:
            self.qtgui_const_sink_x_0_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "red", "red", "red", "red", "red", "red", "red",
            "red"
        ]
        styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_const_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_const_sink_x_0_0_win)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            1024,  #size
            "Rx",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                   qtgui.TRIG_SLOPE_POS, 0.0,
                                                   0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0.enable_grid(True)
        self.qtgui_const_sink_x_0.enable_axis_labels(True)

        if not True:
            self.qtgui_const_sink_x_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "red", "red", "red", "red", "red", "red", "red",
            "red"
        ]
        styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_const_sink_x_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 0, 1, 1,
                                       1)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(0, 1)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(1, 2)]
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, samp_rate, 1.6E3, .6E3, firdes.WIN_HAMMING,
                            6.76))
        self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76)
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            sps, .063, (rrc_taps), nfilts, nfilts / 2, 1.5, 1)
        self.digital_lms_dd_equalizer_cc_0 = digital.lms_dd_equalizer_cc(
            8, .01, 1, BPSK)
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(4)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(
            phase_bw, 4, False)
        self.digital_constellation_receiver_cb_0 = digital.constellation_receiver_cb(
            BPSK, phase_bw, 0, 2 * 3.14)
        self.digital_constellation_modulator_0 = digital.generic_mod(
            constellation=BPSK,
            differential=True,
            samples_per_symbol=sps,
            pre_diff_code=True,
            excess_bw=2,
            verbose=False,
            log=False,
        )
        self.blocks_multiply_xx_3_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_3 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_2_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_2_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_2_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_2 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1,
            '/home/peter/Desktop/acoustic_radio/test_input.txt', True)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1, '/home/peter/Desktop/output.txt', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_imag_1 = blocks.complex_to_imag(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_3 = blocks.add_vff(1)
        self.blocks_add_xx_1 = blocks.add_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=sps,
                bits_per_symbol=1,
                preamble='',
                access_code='',
                pad_for_usrp=False,
            ),
            payload_length=1,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code='',
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )
        self.analog_sig_source_x_0_1_0_0 = analog.sig_source_c(
            samp_rate, analog.GR_SIN_WAVE, 4E3, 1, 0)
        self.analog_sig_source_x_0_1_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 4E3, 1, 0)
        self.analog_sig_source_x_0_1 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 4E3, 1, 0)
        self.analog_sig_source_x_0_0_0 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, 4E3, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, 4E3, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 4E3, 1, 0)
        self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(
            1024, 1.55)
        self.analog_const_source_x_0_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, -1)
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, -1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_multiply_xx_3, 1))
        self.connect((self.analog_const_source_x_0_0, 0),
                     (self.blocks_multiply_xx_3_0, 1))
        self.connect((self.analog_feedforward_agc_cc_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_3_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0, 0),
                     (self.blocks_multiply_xx_3, 0))
        self.connect((self.analog_sig_source_x_0_1, 0),
                     (self.blocks_multiply_xx_2, 1))
        self.connect((self.analog_sig_source_x_0_1_0, 0),
                     (self.blocks_multiply_xx_2_0, 1))
        self.connect((self.analog_sig_source_x_0_1_0_0, 0),
                     (self.blocks_multiply_xx_2_0_0, 1))
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_constellation_modulator_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_xx_2, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_xx_2_1, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_add_xx_1, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_add_xx_3, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.blocks_add_xx_1, 0))
        self.connect((self.blocks_complex_to_imag_1, 0),
                     (self.blocks_add_xx_3, 1))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_add_xx_1, 1))
        self.connect((self.blocks_multiply_xx_2_0, 0),
                     (self.blocks_complex_to_imag_0, 0))
        self.connect((self.blocks_multiply_xx_2_0_0, 0),
                     (self.blocks_complex_to_imag_1, 0))
        self.connect((self.blocks_multiply_xx_2_1, 0),
                     (self.blocks_add_xx_3, 0))
        self.connect((self.blocks_multiply_xx_3, 0),
                     (self.blocks_multiply_xx_2_1, 1))
        self.connect((self.blocks_multiply_xx_3_0, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 0),
                     (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 4),
                     (self.qtgui_const_sink_x_0_0, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 3),
                     (self.qtgui_time_sink_x_1, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 1),
                     (self.qtgui_time_sink_x_1_0, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 2),
                     (self.qtgui_time_sink_x_1_1, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.digital_lms_dd_equalizer_cc_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_lms_dd_equalizer_cc_0, 0),
                     (self.digital_constellation_receiver_cb_0, 0))
        self.connect((self.digital_lms_dd_equalizer_cc_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blocks_multiply_xx_2_0, 0))
        self.connect((self.hilbert_fc_0, 0),
                     (self.blocks_multiply_xx_2_0_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.analog_feedforward_agc_cc_0, 0))
コード例 #54
0
ファイル: slackradio.py プロジェクト: devnulling/slackradio
    def __init__(self, freq=88.5e6, gain=30, input_gain=.3, pilot_gain=.09, ps="DEFCON", rds_gain=.1, stereo_gain=.3, wavfile=""):
        gr.top_block.__init__(self, "Slackradio")

        ##################################################
        # Parameters
        ##################################################
        self.freq = freq
        self.gain = gain
        self.input_gain = input_gain
        self.pilot_gain = pilot_gain
        self.ps = ps
        self.rds_gain = rds_gain
        self.stereo_gain = stereo_gain
        self.wavfile = wavfile

        ##################################################
        # Variables
        ##################################################
        self.usrp_rate = usrp_rate = 19e3*20
        self.outbuffer = outbuffer = 1024
        self.fm_max_dev = fm_max_dev = 80e3

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink = uhd.usrp_sink(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink.set_samp_rate(1e6)
        self.uhd_usrp_sink.set_center_freq(freq, 0)
        self.uhd_usrp_sink.set_gain(gain, 0)
        self.uhd_usrp_sink.set_antenna("TX/RX", 0)
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
                interpolation=100,
                decimation=38,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
                interpolation=380,
                decimation=48,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=380,
                decimation=48,
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_0_0_0 = filter.interp_fir_filter_fff(1, firdes.low_pass(
        	1, usrp_rate, 15e3, 2e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_0 = filter.interp_fir_filter_fff(1, firdes.low_pass(
        	1, usrp_rate, 15e3, 2e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.interp_fir_filter_fff(1, firdes.low_pass(
        	1, usrp_rate, 2.5e3, .5e3, firdes.WIN_HAMMING, 6.76))
        (self.low_pass_filter_0).set_max_output_buffer(1024)
        self.gr_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2)
        (self.gr_unpack_k_bits_bb_0).set_max_output_buffer(4096)
        self.gr_sub_xx_0 = blocks.sub_ff(1)
        self.gr_sig_source_x_0_1 = analog.sig_source_f(usrp_rate, analog.GR_SIN_WAVE, 19e3, 1, 0)
        self.gr_sig_source_x_0_0 = analog.sig_source_f(usrp_rate, analog.GR_SIN_WAVE, 57e3, 1, 0)
        self.gr_sig_source_x_0 = analog.sig_source_f(usrp_rate, analog.GR_SIN_WAVE, 38e3, 1, 0)
        self.gr_rds_encoder_0 = rds.encoder(1, 8, True, ps, 89.8e6,
        			True, False, 13, 3,
        			147, "CYBERSPECTRUM")
        	
        (self.gr_rds_encoder_0).set_max_output_buffer(4096)
        self.gr_multiply_xx_1 = blocks.multiply_vff(1)
        self.gr_multiply_xx_0 = blocks.multiply_vff(1)
        (self.gr_multiply_xx_0).set_max_output_buffer(1024)
        self.gr_map_bb_1 = digital.map_bb(([1,2]))
        (self.gr_map_bb_1).set_max_output_buffer(4096)
        self.gr_map_bb_0 = digital.map_bb(([-1,1]))
        (self.gr_map_bb_0).set_max_output_buffer(4096)
        self.gr_frequency_modulator_fc_0 = analog.frequency_modulator_fc(2*math.pi*fm_max_dev/usrp_rate)
        (self.gr_frequency_modulator_fc_0).set_max_output_buffer(1024)
        self.gr_diff_encoder_bb_0 = digital.diff_encoder_bb(2)
        (self.gr_diff_encoder_bb_0).set_max_output_buffer(4096)
        self.gr_char_to_float_0 = blocks.char_to_float(1, 1)
        (self.gr_char_to_float_0).set_max_output_buffer(1024)
        self.gr_add_xx_1 = blocks.add_vff(1)
        (self.gr_add_xx_1).set_max_output_buffer(1024)
        self.gr_add_xx_0 = blocks.add_vff(1)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(wavfile, True)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", "", "52001", 10000, False)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_float*1, 160)
        self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vff((input_gain, ))
        self.blocks_multiply_const_vxx_0_0_1 = blocks.multiply_const_vff((pilot_gain, ))
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((rds_gain, ))
        (self.blocks_multiply_const_vxx_0_0).set_max_output_buffer(1024)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((input_gain, ))

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.gr_rds_encoder_0, 'rds in'))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.gr_add_xx_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_0_1, 0), (self.gr_add_xx_1, 1))    
        self.connect((self.blocks_multiply_const_vxx_0_1, 0), (self.rational_resampler_xxx_0_0, 0))    
        self.connect((self.blocks_repeat_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_wavfile_source_0, 1), (self.blocks_multiply_const_vxx_0_1, 0))    
        self.connect((self.gr_add_xx_0, 0), (self.low_pass_filter_0_0, 0))    
        self.connect((self.gr_add_xx_1, 0), (self.gr_frequency_modulator_fc_0, 0))    
        self.connect((self.gr_char_to_float_0, 0), (self.blocks_repeat_0, 0))    
        self.connect((self.gr_diff_encoder_bb_0, 0), (self.gr_map_bb_1, 0))    
        self.connect((self.gr_frequency_modulator_fc_0, 0), (self.rational_resampler_xxx_1, 0))    
        self.connect((self.gr_map_bb_0, 0), (self.gr_char_to_float_0, 0))    
        self.connect((self.gr_map_bb_1, 0), (self.gr_unpack_k_bits_bb_0, 0))    
        self.connect((self.gr_multiply_xx_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))    
        self.connect((self.gr_multiply_xx_1, 0), (self.gr_add_xx_1, 2))    
        self.connect((self.gr_rds_encoder_0, 0), (self.gr_diff_encoder_bb_0, 0))    
        self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_1, 0))    
        self.connect((self.gr_sig_source_x_0_0, 0), (self.gr_multiply_xx_0, 0))    
        self.connect((self.gr_sig_source_x_0_1, 0), (self.blocks_multiply_const_vxx_0_0_1, 0))    
        self.connect((self.gr_sub_xx_0, 0), (self.low_pass_filter_0_0_0, 0))    
        self.connect((self.gr_unpack_k_bits_bb_0, 0), (self.gr_map_bb_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.gr_multiply_xx_0, 1))    
        self.connect((self.low_pass_filter_0_0, 0), (self.gr_add_xx_1, 3))    
        self.connect((self.low_pass_filter_0_0_0, 0), (self.gr_multiply_xx_1, 1))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.gr_add_xx_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.gr_sub_xx_0, 0))    
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.gr_add_xx_0, 1))    
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.gr_sub_xx_0, 1))    
        self.connect((self.rational_resampler_xxx_1, 0), (self.uhd_usrp_sink, 0))    
コード例 #55
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self,
                                         title="Intensity Interferometer")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 250e3
        self.magnitude = magnitude = 0.05
        self.integ = integ = 1
        self.beat = beat = 1

        ##################################################
        # Blocks
        ##################################################
        _magnitude_sizer = wx.BoxSizer(wx.VERTICAL)
        self._magnitude_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_magnitude_sizer,
            value=self.magnitude,
            callback=self.set_magnitude,
            label="Magnitude",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._magnitude_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_magnitude_sizer,
            value=self.magnitude,
            callback=self.set_magnitude,
            minimum=0.05,
            maximum=0.5,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_magnitude_sizer)
        _integ_sizer = wx.BoxSizer(wx.VERTICAL)
        self._integ_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_integ_sizer,
            value=self.integ,
            callback=self.set_integ,
            label="Integration Time (Sec)",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._integ_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_integ_sizer,
            value=self.integ,
            callback=self.set_integ,
            minimum=1,
            maximum=30,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_integ_sizer)
        _beat_sizer = wx.BoxSizer(wx.VERTICAL)
        self._beat_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_beat_sizer,
            value=self.beat,
            callback=self.set_beat,
            label="Beat Frequency (kHz)",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._beat_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_beat_sizer,
            value=self.beat,
            callback=self.set_beat,
            minimum=1,
            maximum=10,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_beat_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="2nd detector power level",
            sample_rate=2,
            v_scale=0,
            v_offset=0,
            t_scale=450,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_STRIPCHART,
            y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate / 10,
            fft_size=1024,
            fft_rate=8,
            average=True,
            avg_alpha=0.1,
            title="First Detector Spectrum",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(
            1.0 / ((samp_rate / 10) * integ), 1)
        self.low_pass_filter_0 = gr.fir_filter_fff(
            int(samp_rate / 25e3),
            firdes.low_pass(1, samp_rate, 11e3, 2.5e3, firdes.WIN_HAMMING,
                            6.76))
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(
            gr.sizeof_float * 1, int(samp_rate / 20))
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.band_pass_filter_0 = gr.fir_filter_fff(
            1,
            firdes.band_pass(1, samp_rate / 10, (beat * 1000) - 100,
                             (beat * 1000) + 100, 50, firdes.WIN_HAMMING,
                             6.76))
        self.analog_sig_source_x_0_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 122e3, magnitude, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 122e3 - (beat * 1000), magnitude, 0)
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, 0.2, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 2))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.single_pole_iir_filter_xx_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.single_pole_iir_filter_xx_0, 0),
                     (self.blocks_keep_one_in_n_0, 0))
コード例 #56
0
ファイル: ssb_receiver.py プロジェクト: Tubbz-alt/SDR-Exp
    def __init__(self):
        gr.top_block.__init__(self, "SSB Receiver")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("SSB Receiver")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "ssb_receiver")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.ssb_width = ssb_width = 3000
        self.freq_offset = freq_offset = 51500
        self.center_freq = center_freq = 50300000
        self.station_freq = station_freq = center_freq + freq_offset + ssb_width / 2
        self.samp_rate = samp_rate = 256000
        self.resamp_factor = resamp_factor = 8

        ##################################################
        # Blocks
        ##################################################
        self._freq_offset_range = Range(50000, 60000, 100, 51500, 200)
        self._freq_offset_win = RangeWidget(self._freq_offset_range,
                                            self.set_freq_offset,
                                            'Frequency offset',
                                            "counter_slider", float)
        self.top_grid_layout.addWidget(self._freq_offset_win)
        self._station_freq_tool_bar = Qt.QToolBar(self)

        if None:
            self._station_freq_formatter = None
        else:
            self._station_freq_formatter = lambda x: str(x)

        self._station_freq_tool_bar.addWidget(
            Qt.QLabel('Station frequency' + ": "))
        self._station_freq_label = Qt.QLabel(
            str(self._station_freq_formatter(self.station_freq)))
        self._station_freq_tool_bar.addWidget(self._station_freq_label)
        self.top_grid_layout.addWidget(self._station_freq_tool_bar)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=3,
            decimation=2,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_sink_x_0 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            center_freq + freq_offset,  #fc
            samp_rate / resamp_factor,  #bw
            'FIR Filter',  #name
            False,  #plotfreq
            True,  #plotwaterfall
            False,  #plottime
            False,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 100)
        self._qtgui_sink_x_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win)

        self.qtgui_sink_x_0.enable_rf_freq(True)

        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            center_freq,  #fc
            samp_rate,  #bw
            'Signal spectrum',  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-50, 50)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(True)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            resamp_factor, (firdes.low_pass(1, samp_rate, ssb_width / 2, 100)),
            freq_offset, samp_rate)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.15, ))
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1, 'D:\\ssb_lsb_256k_complex2.dat', True)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            samp_rate / resamp_factor, analog.GR_SIN_WAVE, 1500, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate / resamp_factor, analog.GR_COS_WAVE, 1500, 1, 0)
        self.analog_agc2_xx_0 = analog.agc2_cc(0.3, 0.00001, 0.2, 1)
        self.analog_agc2_xx_0.set_max_gain(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_throttle_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.analog_agc2_xx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.qtgui_sink_x_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
コード例 #57
0
ファイル: top_block.py プロジェクト: c177pilot/oa
    def __init__(self,
                 antenna="TX/RX",
                 vor_freq_1=111e6,
                 com_freq_1=135.275e6,
                 vor_freq_2=111e6,
                 rx_gain=30,
                 gain=20):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.vor_freq_1 = vor_freq_1
        self.com_freq_1 = com_freq_1
        self.vor_freq_2 = vor_freq_2
        self.rx_gain = rx_gain
        self.gain = gain

        ##################################################
        # Variables
        ##################################################
        self.obs_decimation = obs_decimation = 25
        self.ils_decimation = ils_decimation = 50
        self.am_sample_rate = am_sample_rate = 12.5e3
        self.vor_samp_rate = vor_samp_rate = 250e3
        self.vor_freq_entry_2 = vor_freq_entry_2 = vor_freq_2
        self.vor_freq_entry_1 = vor_freq_entry_1 = vor_freq_1
        self.vor_center_freq_0 = vor_center_freq_0 = (117.95e6 -
                                                      108.00e6) / 2 + 117.95e6
        self.vor_center_freq = vor_center_freq = (117.95e6 -
                                                  108.00e6) / 2 + 117.95e6
        self.squelch_slider = squelch_slider = -110
        self.rxgain = rxgain = 15
        self.phase_correction = phase_correction = 5
        self.obs_sample_rate = obs_sample_rate = am_sample_rate / obs_decimation
        self.ils_sample_rate = ils_sample_rate = am_sample_rate / ils_decimation
        self.gain_slider = gain_slider = gain
        self.com_freq_entry_1 = com_freq_entry_1 = com_freq_1
        self.band_center_freq = band_center_freq = (136.975e6 -
                                                    108.0e6) / 2 + 108.0e6
        self.audio_select = audio_select = 0
        self.audio_sample_rate = audio_sample_rate = 48e3
        self.am_decimation = am_decimation = 1

        ##################################################
        # Blocks
        ##################################################
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "RF Analyzer")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Channel FFT")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Demod Audio FFT")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Ref and Phase Scope")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Manipulated Ref and Phase")
        self.Add(self.notebook_0)
        self._vor_freq_entry_1_text_box = forms.text_box(
            parent=self.notebook_0.GetPage(0).GetWin(),
            value=self.vor_freq_entry_1,
            callback=self.set_vor_freq_entry_1,
            label='vor_freq_entry_1',
            converter=forms.float_converter(),
        )
        self.notebook_0.GetPage(0).Add(self._vor_freq_entry_1_text_box)
        _gain_slider_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_slider_text_box = forms.text_box(
            parent=self.notebook_0.GetPage(0).GetWin(),
            sizer=_gain_slider_sizer,
            value=self.gain_slider,
            callback=self.set_gain_slider,
            label='gain_slider',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._gain_slider_slider = forms.slider(
            parent=self.notebook_0.GetPage(0).GetWin(),
            sizer=_gain_slider_sizer,
            value=self.gain_slider,
            callback=self.set_gain_slider,
            minimum=0,
            maximum=30,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.notebook_0.GetPage(0).Add(_gain_slider_sizer)
        self._com_freq_entry_1_text_box = forms.text_box(
            parent=self.notebook_0.GetPage(0).GetWin(),
            value=self.com_freq_entry_1,
            callback=self.set_com_freq_entry_1,
            label='com_freq_entry_1',
            converter=forms.float_converter(),
        )
        self.notebook_0.GetPage(0).Add(self._com_freq_entry_1_text_box)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(1).GetWin(),
            title="Scope Plot",
            sample_rate=10e3,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=2,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
            self.GetWin(),
            unit="Units",
            minval=-100,
            maxval=100,
            factor=1.0,
            decimal_places=10,
            ref_level=0,
            sample_rate=10,
            number_rate=15,
            average=False,
            avg_alpha=None,
            label="Number Plot",
            peak_hold=False,
            show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=12.5e3,
            fft_size=1024,
            fft_rate=5,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self._vor_freq_entry_2_text_box = forms.text_box(
            parent=self.notebook_0.GetPage(0).GetWin(),
            value=self.vor_freq_entry_2,
            callback=self.set_vor_freq_entry_2,
            label='vor_freq_entry_2',
            converter=forms.float_converter(),
        )
        self.notebook_0.GetPage(0).Add(self._vor_freq_entry_2_text_box)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            device_addr="",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(2),
            ),
        )
        self.uhd_usrp_source_0.set_subdev_spec("A:0 A:0", 0)
        self.uhd_usrp_source_0.set_samp_rate(vor_samp_rate)
        self.uhd_usrp_source_0.set_center_freq(
            uhd.tune_request(com_freq_entry_1,
                             rf_freq=band_center_freq,
                             rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0)
        self.uhd_usrp_source_0.set_gain(gain_slider, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_source_0.set_center_freq(
            uhd.tune_request(vor_freq_entry_1,
                             rf_freq=band_center_freq,
                             rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 1)
        self.uhd_usrp_source_0.set_gain(gain_slider, 1)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 1)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            device_addr="",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(250e3)
        self.uhd_usrp_sink_0.set_center_freq(
            uhd.tune_request(com_freq_entry_1, 20e6), 0)
        self.uhd_usrp_sink_0.set_gain(15, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        _squelch_slider_sizer = wx.BoxSizer(wx.VERTICAL)
        self._squelch_slider_text_box = forms.text_box(
            parent=self.notebook_0.GetPage(0).GetWin(),
            sizer=_squelch_slider_sizer,
            value=self.squelch_slider,
            callback=self.set_squelch_slider,
            label='squelch_slider',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._squelch_slider_slider = forms.slider(
            parent=self.notebook_0.GetPage(0).GetWin(),
            sizer=_squelch_slider_sizer,
            value=self.squelch_slider,
            callback=self.set_squelch_slider,
            minimum=-110,
            maximum=0,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.notebook_0.GetPage(0).Add(_squelch_slider_sizer)
        self.squelch = analog.pwr_squelch_cc(squelch_slider, 0.01, 20, True)
        self.rational_resampler_xxx_2 = filter.rational_resampler_fff(
            interpolation=250,
            decimation=48,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
            interpolation=480,
            decimation=125,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=4,
            decimation=5,
            taps=None,
            fractional_bw=None,
        )
        self.openavionics_joystick_interface_0 = openavionics.joystick_interface(
        )
        self.openavionics_audio_ptt_0 = openavionics.audio_ptt()
        self.null_sink_0_0_0 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.null_sink_0_0 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.multiply_xx_0_0_0 = blocks.multiply_vcc(1)
        self.multiply_xx_0_0 = blocks.multiply_vff(1)
        self.low_pass_filter_3 = filter.fir_filter_ccf(
            1, firdes.low_pass(1, 10e3, 1, 2, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2_0_0 = filter.fir_filter_ccf(
            5, firdes.low_pass(1, 40e3, 2e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2_0 = filter.fir_filter_ccf(
            5, firdes.low_pass(1, 40e3, 2e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2 = filter.fir_filter_ccf(
            5,
            firdes.low_pass(1, vor_samp_rate, 15e3, 5e3, firdes.WIN_HAMMING,
                            6.76))
        self.low_pass_filter_1 = filter.interp_fir_filter_fff(
            1, firdes.low_pass(1, 12.5e3, 3e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            int(250e3 / 12.5e3),
            firdes.low_pass(1, vor_samp_rate, 10e3, 1e3, firdes.WIN_HAMMING,
                            6.76))
        self.goertzel_fc_0_0 = fft.goertzel_fc(10000, 1000, 30)
        self.goertzel_fc_0 = fft.goertzel_fc(40000, 4000, 30)
        self.float_to_complex_0_0 = blocks.float_to_complex(1)
        self.const_source_x_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0.450)
        self.const_source_x_0_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE,
                                                      0, 0, 0.550)
        self.const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0,
                                                    0, 0.450)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-87.2665e-3, ))
        self.band_pass_filter_0_0 = filter.fir_filter_fff(
            4, firdes.band_pass(1, 40e3, 20, 40, 20, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.fir_filter_fff(
            1, firdes.band_pass(1, 10e3, 20, 40, 20, firdes.WIN_HAMMING, 6.76))
        self.audio_source_0 = audio.source(48000, "", True)
        self.audio_sink_0 = audio.sink(int(audio_sample_rate), "", True)
        self._audio_select_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=self.audio_select,
            callback=self.set_audio_select,
            label='audio_select',
            choices=[0, 1],
            labels=['AM Voice', 'VOR Subcarrier'],
        )
        self.Add(self._audio_select_chooser)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            40e3, analog.GR_COS_WAVE, -9.96e3, 1, 0)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
            channel_rate=40e3,
            audio_decim=4,
            audio_pass=5000,
            audio_stop=5500,
        )
        self.analog_agc2_xx_0_1_0 = analog.agc2_ff(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_1_0.set_max_gain(100)
        self.analog_agc2_xx_0_1 = analog.agc2_ff(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_1.set_max_gain(100)
        self.analog_agc2_xx_0_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0_0.set_max_gain(100)
        self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0.set_max_gain(100)
        self.am_demod_cf_0 = analog.am_demod_cf(
            channel_rate=am_sample_rate,
            audio_decim=am_decimation,
            audio_pass=3e3,
            audio_stop=4e3,
        )
        self.agc2_xx_0 = analog.agc2_cc(1, 1, 0.75, 1.0)
        self.agc2_xx_0.set_max_gain(0.0)
        self.add_xx_0_0 = blocks.add_vff(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.agc2_xx_0, 0), (self.am_demod_cf_0, 0))
        self.connect((self.am_demod_cf_0, 0), (self.low_pass_filter_1, 0))
        self.connect((self.agc2_xx_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.multiply_xx_0_0, 0), (self.add_xx_0_0, 0))
        self.connect((self.const_source_x_0, 0), (self.multiply_xx_0_0, 1))
        self.connect((self.const_source_x_0_0, 0), (self.add_xx_0_0, 1))
        self.connect((self.multiply_xx_0_0_0, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.add_xx_0_0, 0), (self.float_to_complex_0_0, 0))
        self.connect((self.add_xx_0_0, 0), (self.float_to_complex_0_0, 1))
        self.connect((self.float_to_complex_0_0, 0),
                     (self.multiply_xx_0_0_0, 0))
        self.connect((self.const_source_x_0_0_0, 0),
                     (self.multiply_xx_0_0_0, 1))
        self.connect((self.uhd_usrp_source_0, 0), (self.null_sink_0_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_1, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.analog_agc2_xx_0_1_0, 0),
                     (self.wxgui_scopesink2_0, 1))
        self.connect((self.analog_agc2_xx_0_1, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.analog_agc2_xx_0_1, 0))
        self.connect((self.band_pass_filter_0_0, 0),
                     (self.analog_agc2_xx_0_1_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.goertzel_fc_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.wxgui_numbersink2_0, 0))
        self.connect((self.blocks_complex_to_arg_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.low_pass_filter_3, 0),
                     (self.blocks_complex_to_arg_0, 0))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0),
                     (self.low_pass_filter_3, 0))
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.analog_agc2_xx_0_0, 0),
                     (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.goertzel_fc_0_0, 0), (self.analog_agc2_xx_0_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.goertzel_fc_0_0, 0))
        self.connect((self.goertzel_fc_0, 0), (self.analog_agc2_xx_0, 0))
        self.connect((self.low_pass_filter_2_0_0, 0),
                     (self.analog_am_demod_cf_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.low_pass_filter_2_0_0, 0))
        self.connect((self.low_pass_filter_2_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_2_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.uhd_usrp_source_0, 1), (self.null_sink_0_0, 0))
        self.connect((self.low_pass_filter_2, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.audio_source_0, 0),
                     (self.openavionics_audio_ptt_0, 0))
        self.connect((self.openavionics_audio_ptt_0, 0),
                     (self.rational_resampler_xxx_2, 0))
        self.connect((self.rational_resampler_xxx_2, 0),
                     (self.multiply_xx_0_0, 0))
        self.connect((self.squelch, 0), (self.agc2_xx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.squelch, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_2, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.openavionics_joystick_interface_0, "out",
                         self.openavionics_audio_ptt_0, "in2")
コード例 #58
0
ファイル: tp_modes.py プロジェクト: joeblankenship1/SDR
	def __init__(self, ppm=30, srate=2.4e6, fftsize=8192):
		grc_wxgui.top_block_gui.__init__(self, title="Tp Modes")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Parameters
		##################################################
		self.ppm = ppm
		self.srate = srate
		self.fftsize = fftsize

		##################################################
		# Variables
		##################################################
		self.prefix = prefix = "/home/superkuh/vsrt_"
		self.recfile = recfile = prefix + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".log"
		self.freq = freq = 1600e6
		self.bp_width = bp_width = 30e3
		self.bp_low = bp_low = 90e3
		self.actual_lower_freq = actual_lower_freq = 10.7e9
		self.IF_lower_freq = IF_lower_freq = 950e6
		self.scope_rate = scope_rate = 2.0
		self.record = record = False
		self.realfreq_display = realfreq_display = actual_lower_freq + (freq - IF_lower_freq)
		self.integ = integ = 1
		self.capture_file = capture_file = recfile
		self.bp_high = bp_high = bp_low+bp_width

		##################################################
		# Blocks
		##################################################
		self._record_check_box = forms.check_box(
			parent=self.GetWin(),
			value=self.record,
			callback=self.set_record,
			label="Record",
			true=True,
			false=False,
		)
		self.GridAdd(self._record_check_box, 0, 1, 1, 1)
		_integ_sizer = wx.BoxSizer(wx.VERTICAL)
		self._integ_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_integ_sizer,
			value=self.integ,
			callback=self.set_integ,
			label="Integration Time (Sec)",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._integ_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_integ_sizer,
			value=self.integ,
			callback=self.set_integ,
			minimum=1,
			maximum=30,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_integ_sizer)
		self._capture_file_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.capture_file,
			callback=self.set_capture_file,
			label=" ",
			converter=forms.str_converter(),
		)
		self.GridAdd(self._capture_file_text_box, 0, 2, 1, 1)
		_bp_low_sizer = wx.BoxSizer(wx.VERTICAL)
		self._bp_low_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_bp_low_sizer,
			value=self.bp_low,
			callback=self.set_bp_low,
			label="Bandpass Low End",
			converter=forms.int_converter(),
			proportion=0,
		)
		self._bp_low_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_bp_low_sizer,
			value=self.bp_low,
			callback=self.set_bp_low,
			minimum=80e3,
			maximum=100e3,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=int,
			proportion=1,
		)
		self.Add(_bp_low_sizer)
		self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="count of LNBF beat frequency bins",
			sample_rate=scope_rate,
			v_scale=0,
			v_offset=0,
			t_scale=450,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0_0.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=srate,
			fft_size=2048,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="Total Power FFT Spectrum",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(1.0/((srate/10)*integ), 1)
		self.rtl2832_source_0 = baz.rtl_source_c(defer_creation=True, output_size=gr.sizeof_gr_complex)
		self.rtl2832_source_0.set_verbose(True)
		self.rtl2832_source_0.set_vid(0x0)
		self.rtl2832_source_0.set_pid(0x0)
		self.rtl2832_source_0.set_tuner_name("r820t")
		self.rtl2832_source_0.set_default_timeout(0)
		self.rtl2832_source_0.set_use_buffer(True)
		self.rtl2832_source_0.set_fir_coefficients(([]))
		
		self.rtl2832_source_0.set_read_length(0)
		
		
		
		
		if self.rtl2832_source_0.create() == False: raise Exception("Failed to create RTL2832 Source: rtl2832_source_0")
		
		
		self.rtl2832_source_0.set_sample_rate(scope_rate)
		
		self.rtl2832_source_0.set_frequency(IF_lower_freq)
		
		
		
		self.rtl2832_source_0.set_auto_gain_mode(True)
		self.rtl2832_source_0.set_relative_gain(True)
		self.rtl2832_source_0.set_gain(0)
		  
		self._realfreq_display_static_text = forms.static_text(
			parent=self.GetWin(),
			value=self.realfreq_display,
			callback=self.set_realfreq_display,
			label="Actual Frequency",
			converter=forms.float_converter(),
		)
		self.GridAdd(self._realfreq_display_static_text, 0, 0, 1, 1)
		self.low_pass_filter_0 = gr.fir_filter_fff(int(srate/24e4), firdes.low_pass(
			1, srate, 200e3, 24e3, firdes.WIN_HAMMING, 6.76))
		_freq_sizer = wx.BoxSizer(wx.VERTICAL)
		self._freq_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_freq_sizer,
			value=self.freq,
			callback=self.set_freq,
			label="Frequency",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._freq_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_freq_sizer,
			value=self.freq,
			callback=self.set_freq,
			minimum=950e6,
			maximum=2150e6,
			num_steps=1000,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_freq_sizer)
		self._bp_width_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.bp_width,
			callback=self.set_bp_width,
			label="BP Width",
			converter=forms.int_converter(),
		)
		self.GridAdd(self._bp_width_text_box, 0, 4, 1, 1)
		self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
		self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_float*1, int(srate/20))
		self.blocks_file_sink_1 = blocks.file_sink(gr.sizeof_float*1, "/dev/null" if record == False else capture_file)
		self.blocks_file_sink_1.set_unbuffered(True)
		self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
		self.band_pass_filter_0 = gr.fir_filter_fff(1, firdes.band_pass(
			1, srate/5, bp_low, bp_high, 24e3, firdes.WIN_HAMMING, 6.76))

		##################################################
		# Connections
		##################################################
		self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 1))
		self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 0))
		self.connect((self.blocks_multiply_xx_0, 0), (self.single_pole_iir_filter_xx_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.single_pole_iir_filter_xx_0, 0), (self.blocks_keep_one_in_n_0, 0))
		self.connect((self.blocks_keep_one_in_n_0, 0), (self.wxgui_scopesink2_0_0, 0))
		self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_file_sink_1, 0))
		self.connect((self.rtl2832_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
コード例 #59
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")

        if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            self.restoreGeometry(self.settings.value("geometry").toByteArray())
        else:
            self.restoreGeometry(
                self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2000000

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=samp_rate,
            decimation=16000,
            taps=None,
            fractional_bw=None,
        )
        self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + '')
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(144.6625e6, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(10, 0)
        self.osmosdr_sink_0.set_if_gain(48, 0)
        self.osmosdr_sink_0.set_bb_gain(20, 0)
        self.osmosdr_sink_0.set_antenna('', 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)

        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            '/home/hopkins/Downloads/morse (2).wav', True)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((1.2, ))
        self.analog_sig_source_x_0_0_0 = analog.sig_source_f(
            8e3, analog.GR_COS_WAVE, 200, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            8e3, analog.GR_COS_WAVE, 1000, 1, 0)
        self.analog_nbfm_tx_0 = analog.nbfm_tx(
            audio_rate=8000,
            quad_rate=16000,
            tau=75e-6,
            max_dev=5e3,
            fh=-1.0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_nbfm_tx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0_0_0, 0),
                     (self.blocks_multiply_xx_0, 2))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.analog_nbfm_tx_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.osmosdr_sink_0, 0))
コード例 #60
0
ファイル: rx_gui.py プロジェクト: pjbalt/satellite
    def __init__(self, freq=0, gain=40, loopbw=100, loopbw_0=100, fllbw=0.002):
        gr.top_block.__init__(self, "Rx Gui")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Rx Gui")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "rx_gui")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.freq = freq
        self.gain = gain
        self.loopbw = loopbw
        self.loopbw_0 = loopbw_0
        self.fllbw = fllbw

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 8
        self.excess_bw = excess_bw = 0.25
        self.target_samp_rate = target_samp_rate = sps*(200e3/(1 + excess_bw))
        
        self.qpsk_const = qpsk_const = digital.constellation_qpsk().base()
        
        self.dsp_rate = dsp_rate = 100e6
        self.const_choice = const_choice = "qpsk"
        
        self.bpsk_const = bpsk_const = digital.constellation_bpsk().base()
        
        self.barker_code_two_dim = barker_code_two_dim = [-1.0000 - 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j,  1.0000 + 1.0000j,  1.0000 + 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j,  1.0000 + 1.0000j, -1.0000 - 1.0000j,  1.0000 + 1.0000j, -1.0000 - 1.0000j]
        self.barker_code_one_dim = barker_code_one_dim = sqrt(2)*numpy.real([-1.0000 - 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j,  1.0000 + 1.0000j,  1.0000 + 1.0000j, -1.0000 - 1.0000j, -1.0000 - 1.0000j,  1.0000 + 1.0000j, -1.0000 - 1.0000j,  1.0000 + 1.0000j, -1.0000 - 1.0000j])
        self.rrc_delay = rrc_delay = int(round(-44*excess_bw + 33))
        self.nfilts = nfilts = 32
        self.n_barker_rep = n_barker_rep = 10
        self.dec_factor = dec_factor = ceil(dsp_rate/target_samp_rate)
        self.constellation = constellation = qpsk_const if (const_choice=="qpsk") else bpsk_const
        self.barker_code = barker_code = barker_code_two_dim if (const_choice == "qpsk") else barker_code_one_dim
        self.preamble_syms = preamble_syms = numpy.matlib.repmat(barker_code, 1, n_barker_rep)[0]
        self.n_rrc_taps = n_rrc_taps = rrc_delay * int(sps*nfilts)
        self.n_codewords = n_codewords = 1
        self.even_dec_factor = even_dec_factor = dec_factor if (dec_factor % 1 == 1) else (dec_factor+1)
        self.const_order = const_order = pow(2,constellation.bits_per_symbol())
        self.codeword_len = codeword_len = 18444
        self.usrp_rx_addr = usrp_rx_addr = "192.168.10.2"
        self.samp_rate = samp_rate = dsp_rate/even_dec_factor
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts*sps, 1.0, excess_bw, n_rrc_taps)
        self.rf_center_freq = rf_center_freq = 1428.4309e6
        self.preamble_size = preamble_size = len(preamble_syms)
        self.pmf_peak_threshold = pmf_peak_threshold = 0.6
        self.payload_size = payload_size = codeword_len*n_codewords/int(numpy.log2(const_order))
        self.dataword_len = dataword_len = 6144
        self.barker_len = barker_len = 13

        ##################################################
        # Blocks
        ##################################################
        self.tabs = Qt.QTabWidget()
        self.tabs_widget_0 = Qt.QWidget()
        self.tabs_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_0)
        self.tabs_grid_layout_0 = Qt.QGridLayout()
        self.tabs_layout_0.addLayout(self.tabs_grid_layout_0)
        self.tabs.addTab(self.tabs_widget_0, 'PMF Out')
        self.tabs_widget_1 = Qt.QWidget()
        self.tabs_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_1)
        self.tabs_grid_layout_1 = Qt.QGridLayout()
        self.tabs_layout_1.addLayout(self.tabs_grid_layout_1)
        self.tabs.addTab(self.tabs_widget_1, 'Abs PMF Out')
        self.tabs_widget_2 = Qt.QWidget()
        self.tabs_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_2)
        self.tabs_grid_layout_2 = Qt.QGridLayout()
        self.tabs_layout_2.addLayout(self.tabs_grid_layout_2)
        self.tabs.addTab(self.tabs_widget_2, 'FLL In')
        self.tabs_widget_3 = Qt.QWidget()
        self.tabs_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_3)
        self.tabs_grid_layout_3 = Qt.QGridLayout()
        self.tabs_layout_3.addLayout(self.tabs_grid_layout_3)
        self.tabs.addTab(self.tabs_widget_3, 'FLL Out')
        self.tabs_widget_4 = Qt.QWidget()
        self.tabs_layout_4 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_4)
        self.tabs_grid_layout_4 = Qt.QGridLayout()
        self.tabs_layout_4.addLayout(self.tabs_grid_layout_4)
        self.tabs.addTab(self.tabs_widget_4, 'FLL State')
        self.tabs_widget_5 = Qt.QWidget()
        self.tabs_layout_5 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_5)
        self.tabs_grid_layout_5 = Qt.QGridLayout()
        self.tabs_layout_5.addLayout(self.tabs_grid_layout_5)
        self.tabs.addTab(self.tabs_widget_5, 'PFB Sync Out')
        self.tabs_widget_6 = Qt.QWidget()
        self.tabs_layout_6 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_6)
        self.tabs_grid_layout_6 = Qt.QGridLayout()
        self.tabs_layout_6.addLayout(self.tabs_grid_layout_6)
        self.tabs.addTab(self.tabs_widget_6, 'Costas State')
        self.tabs_widget_7 = Qt.QWidget()
        self.tabs_layout_7 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_7)
        self.tabs_grid_layout_7 = Qt.QGridLayout()
        self.tabs_layout_7.addLayout(self.tabs_grid_layout_7)
        self.tabs.addTab(self.tabs_widget_7, 'Demod Bits')
        self.tabs_widget_8 = Qt.QWidget()
        self.tabs_layout_8 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_8)
        self.tabs_grid_layout_8 = Qt.QGridLayout()
        self.tabs_layout_8.addLayout(self.tabs_grid_layout_8)
        self.tabs.addTab(self.tabs_widget_8, 'Costas  Sym Out')
        self.tabs_widget_9 = Qt.QWidget()
        self.tabs_layout_9 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_widget_9)
        self.tabs_grid_layout_9 = Qt.QGridLayout()
        self.tabs_layout_9.addLayout(self.tabs_grid_layout_9)
        self.tabs.addTab(self.tabs_widget_9, 'Payload Symbols')
        self.top_layout.addWidget(self.tabs)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(gain, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna('', 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.qtgui_time_sink_x_2 = qtgui.time_sink_c(
        	preamble_size + payload_size, #size
        	samp_rate, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_2.set_update_time(0.10)
        self.qtgui_time_sink_x_2.set_y_axis(-1, 1)
        
        self.qtgui_time_sink_x_2.set_y_label('Amplitude', "")
        
        self.qtgui_time_sink_x_2.enable_tags(-1, True)
        self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_2.enable_autoscale(True)
        self.qtgui_time_sink_x_2.enable_grid(False)
        self.qtgui_time_sink_x_2.enable_axis_labels(True)
        self.qtgui_time_sink_x_2.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_2.disable_legend()
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(2*1):
            if len(labels[i]) == 0:
                if(i % 2 == 0):
                    self.qtgui_time_sink_x_2.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_2.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            else:
                self.qtgui_time_sink_x_2.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_2.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_2.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_2.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_2.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_2_win = sip.wrapinstance(self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget)
        self.tabs_layout_0.addWidget(self._qtgui_time_sink_x_2_win)
        self.qtgui_time_sink_x_1_0_0 = qtgui.time_sink_f(
        	1024, #size
        	samp_rate, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_1_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_1_0_0.set_y_axis(-128, 128)
        
        self.qtgui_time_sink_x_1_0_0.set_y_label('Amplitude', "")
        
        self.qtgui_time_sink_x_1_0_0.enable_tags(-1, False)
        self.qtgui_time_sink_x_1_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_1_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_1_0_0.enable_grid(False)
        self.qtgui_time_sink_x_1_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_1_0_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_1_0_0.disable_legend()
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1_0_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_1_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_1_0_0.pyqwidget(), Qt.QWidget)
        self.tabs_layout_7.addWidget(self._qtgui_time_sink_x_1_0_0_win)
        self.qtgui_time_sink_x_1_0 = qtgui.time_sink_f(
        	1024, #size
        	samp_rate, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_1_0.set_update_time(0.10)
        self.qtgui_time_sink_x_1_0.set_y_axis(-1, 1)
        
        self.qtgui_time_sink_x_1_0.set_y_label('Amplitude', "")
        
        self.qtgui_time_sink_x_1_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_1_0.enable_autoscale(False)
        self.qtgui_time_sink_x_1_0.enable_grid(False)
        self.qtgui_time_sink_x_1_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_1_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_1_0.disable_legend()
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_1_0_win = sip.wrapinstance(self.qtgui_time_sink_x_1_0.pyqwidget(), Qt.QWidget)
        self.tabs_layout_7.addWidget(self._qtgui_time_sink_x_1_0_win)
        self.qtgui_time_sink_x_1 = qtgui.time_sink_f(
        	8192, #size
        	samp_rate, #samp_rate
        	"", #name
        	3 #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1.set_y_axis(-1, 1)
        
        self.qtgui_time_sink_x_1.set_y_label('Amplitude', "")
        
        self.qtgui_time_sink_x_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_1.enable_autoscale(False)
        self.qtgui_time_sink_x_1.enable_grid(False)
        self.qtgui_time_sink_x_1.enable_axis_labels(True)
        self.qtgui_time_sink_x_1.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_1.disable_legend()
        
        labels = ['FLL Freq (PI Output)', 'FLL Phase Accum', 'FLL Error', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(3):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_1_win = sip.wrapinstance(self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.tabs_layout_4.addWidget(self._qtgui_time_sink_x_1_win)
        self.qtgui_time_sink_x_0_3 = qtgui.time_sink_f(
        	1024*4, #size
        	samp_rate, #samp_rate
        	"Error", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_3.set_update_time(0.10)
        self.qtgui_time_sink_x_0_3.set_y_axis(-1, 1)
        
        self.qtgui_time_sink_x_0_3.set_y_label('Amplitude', "")
        
        self.qtgui_time_sink_x_0_3.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_3.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_3.enable_autoscale(False)
        self.qtgui_time_sink_x_0_3.enable_grid(False)
        self.qtgui_time_sink_x_0_3.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_3.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0_3.disable_legend()
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_3.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_3.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_3.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_3.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_3.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_3.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_3.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_3_win = sip.wrapinstance(self.qtgui_time_sink_x_0_3.pyqwidget(), Qt.QWidget)
        self.tabs_layout_6.addWidget(self._qtgui_time_sink_x_0_3_win)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
        	preamble_size + payload_size, #size
        	samp_rate, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1)
        
        self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "")
        
        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0_0.disable_legend()
        
        labels = ['Mag Sq', 'Mag', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.tabs_layout_1.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.qtgui_sink_x_5 = qtgui.sink_c(
        	1024, #fftsize
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	True, #plotfreq
        	False, #plotwaterfall
        	False, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_5.set_update_time(1.0/10)
        self._qtgui_sink_x_5_win = sip.wrapinstance(self.qtgui_sink_x_5.pyqwidget(), Qt.QWidget)
        self.tabs_layout_3.addWidget(self._qtgui_sink_x_5_win)
        
        self.qtgui_sink_x_5.enable_rf_freq(False)
        
        
          
        self.qtgui_sink_x_1 = qtgui.sink_c(
        	1024, #fftsize
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	True, #plotfreq
        	False, #plotwaterfall
        	False, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_1.set_update_time(1.0/10)
        self._qtgui_sink_x_1_win = sip.wrapinstance(self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)
        self.tabs_layout_2.addWidget(self._qtgui_sink_x_1_win)
        
        self.qtgui_sink_x_1.enable_rf_freq(False)
        
        
          
        self.qtgui_sink_x_0 = qtgui.sink_c(
        	1024, #fftsize
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	False, #plotfreq
        	False, #plotwaterfall
        	False, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0/10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tabs_layout_5.addWidget(self._qtgui_sink_x_0_win)
        
        self.qtgui_sink_x_0.enable_rf_freq(False)
        
        
          
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_freq_sink_x_0.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tabs_layout_2.addWidget(self._qtgui_freq_sink_x_0_win)
        self.qtgui_const_sink_x_1 = qtgui.const_sink_c(
        	1024, #size
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_const_sink_x_1.set_update_time(0.10)
        self.qtgui_const_sink_x_1.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_1.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
        self.qtgui_const_sink_x_1.enable_autoscale(False)
        self.qtgui_const_sink_x_1.enable_grid(False)
        self.qtgui_const_sink_x_1.enable_axis_labels(True)
        
        if not True:
          self.qtgui_const_sink_x_1.disable_legend()
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "red", "red", "red",
                  "red", "red", "red", "red", "red"]
        styles = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0,
                   0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_1.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_const_sink_x_1_win = sip.wrapinstance(self.qtgui_const_sink_x_1.pyqwidget(), Qt.QWidget)
        self.tabs_layout_9.addWidget(self._qtgui_const_sink_x_1_win)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
        	1024, #size
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0.enable_grid(False)
        self.qtgui_const_sink_x_0.enable_axis_labels(True)
        
        if not True:
          self.qtgui_const_sink_x_0.disable_legend()
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "red", "red", "red",
                  "red", "red", "red", "red", "red"]
        styles = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0,
                   0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tabs_layout_8.addWidget(self._qtgui_const_sink_x_0_win)
        self.mods_turbo_decoder_0 = mods.turbo_decoder(codeword_len, dataword_len)
        self.mods_frame_sync_fast_0 = mods.frame_sync_fast(pmf_peak_threshold, preamble_size, payload_size, 0, 1, 1, int(const_order))
        self.mods_fifo_async_sink_0 = mods.fifo_async_sink('/tmp/async_rx')
        self.interp_fir_filter_xxx_0_0 = filter.interp_fir_filter_fff(1, ( numpy.ones(n_barker_rep*barker_len)))
        self.interp_fir_filter_xxx_0_0.declare_sample_delay(0)
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(1, ( numpy.flipud(numpy.conj(preamble_syms))))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.framers_gr_hdlc_deframer_b_0 = framers.gr_hdlc_deframer_b(0)
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, 2*pi/50, (rrc_taps), nfilts, nfilts/2, pi/8, 1)
        self.digital_map_bb_0_0_0 = digital.map_bb(([1,- 1]))
        self.digital_fll_band_edge_cc_1 = digital.fll_band_edge_cc(sps, excess_bw, rrc_delay * int(sps) + 1, fllbw)
        self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0x7F, 16)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(2*pi/loopbw, 2**constellation.bits_per_symbol(), False)
        self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(constellation.base())
        self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(constellation.bits_per_symbol())
        self.blocks_rms_xx_1 = blocks.rms_cf(0.0001)
        self.blocks_pack_k_bits_bb_1 = blocks.pack_k_bits_bb(8)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_1_1 = blocks.multiply_const_vcc((1.0/sqrt(2), ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((1.0/(preamble_size*sqrt(2)), ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_divide_xx_1 = blocks.divide_ff(1)
        self.blocks_divide_xx_0 = blocks.divide_cc(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_mag_1 = blocks.complex_to_mag(1)
        self.blocks_char_to_float_0_1 = blocks.char_to_float(1, 1)
        self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.framers_gr_hdlc_deframer_b_0, 'pdu'), (self.mods_fifo_async_sink_0, 'async_pdu'))    
        self.connect((self.blocks_char_to_float_0_0, 0), (self.qtgui_time_sink_x_1_0, 0))    
        self.connect((self.blocks_char_to_float_0_1, 0), (self.qtgui_time_sink_x_1_0_0, 0))    
        self.connect((self.blocks_complex_to_mag_1, 0), (self.blocks_divide_xx_1, 0))    
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.interp_fir_filter_xxx_0_0, 0))    
        self.connect((self.blocks_divide_xx_0, 0), (self.digital_fll_band_edge_cc_1, 0))    
        self.connect((self.blocks_divide_xx_0, 0), (self.qtgui_sink_x_1, 0))    
        self.connect((self.blocks_divide_xx_1, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.blocks_divide_xx_1, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_divide_xx_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.mods_frame_sync_fast_0, 2))    
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.qtgui_time_sink_x_2, 0))    
        self.connect((self.blocks_multiply_const_vxx_1_1, 0), (self.blocks_complex_to_mag_1, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.mods_frame_sync_fast_0, 1))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.qtgui_time_sink_x_0_0, 0))    
        self.connect((self.blocks_pack_k_bits_bb_1, 0), (self.blocks_char_to_float_0_1, 0))    
        self.connect((self.blocks_rms_xx_1, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.digital_map_bb_0_0_0, 0))    
        self.connect((self.digital_constellation_decoder_cb_0, 0), (self.blocks_unpack_k_bits_bb_0, 0))    
        self.connect((self.digital_costas_loop_cc_0, 0), (self.blocks_complex_to_mag_squared_0, 0))    
        self.connect((self.digital_costas_loop_cc_0, 0), (self.interp_fir_filter_xxx_0, 0))    
        self.connect((self.digital_costas_loop_cc_0, 0), (self.mods_frame_sync_fast_0, 0))    
        self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_const_sink_x_0, 0))    
        self.connect((self.digital_costas_loop_cc_0, 1), (self.qtgui_time_sink_x_0_3, 0))    
        self.connect((self.digital_descrambler_bb_0, 0), (self.blocks_char_to_float_0_0, 0))    
        self.connect((self.digital_descrambler_bb_0, 0), (self.blocks_pack_k_bits_bb_1, 0))    
        self.connect((self.digital_descrambler_bb_0, 0), (self.framers_gr_hdlc_deframer_b_0, 0))    
        self.connect((self.digital_fll_band_edge_cc_1, 0), (self.digital_pfb_clock_sync_xxx_0, 0))    
        self.connect((self.digital_fll_band_edge_cc_1, 0), (self.qtgui_sink_x_5, 0))    
        self.connect((self.digital_fll_band_edge_cc_1, 3), (self.qtgui_time_sink_x_1, 2))    
        self.connect((self.digital_fll_band_edge_cc_1, 1), (self.qtgui_time_sink_x_1, 0))    
        self.connect((self.digital_fll_band_edge_cc_1, 2), (self.qtgui_time_sink_x_1, 1))    
        self.connect((self.digital_map_bb_0_0_0, 0), (self.mods_turbo_decoder_0, 0))    
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_costas_loop_cc_0, 0))    
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_sink_x_0, 0))    
        self.connect((self.interp_fir_filter_xxx_0, 0), (self.blocks_multiply_const_vxx_1, 0))    
        self.connect((self.interp_fir_filter_xxx_0, 0), (self.blocks_multiply_const_vxx_1_1, 0))    
        self.connect((self.interp_fir_filter_xxx_0_0, 0), (self.blocks_divide_xx_1, 1))    
        self.connect((self.mods_frame_sync_fast_0, 0), (self.digital_constellation_decoder_cb_0, 0))    
        self.connect((self.mods_frame_sync_fast_0, 0), (self.qtgui_const_sink_x_1, 0))    
        self.connect((self.mods_turbo_decoder_0, 0), (self.digital_descrambler_bb_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_divide_xx_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_rms_xx_1, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0))