示例#1
0
 def test_multiply_const_vii_one(self):
     src_data = [
         2,
     ]
     op = blocks.multiply_const_vii((3, ))
     exp_data = [
         6,
     ]
     self.help_const_ii(src_data, exp_data, op)
示例#2
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")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sample_rate = sample_rate = 48000
        self.noise = noise = 0
        self.input_chooser = input_chooser = 1
        self.delay2_0 = delay2_0 = 17
        self.delay2 = delay2 = 5

        ##################################################
        # Blocks
        ##################################################
        self._noise_range = Range(0, 1, 0.01, 0, 200)
        self._noise_win = RangeWidget(self._noise_range, self.set_noise, 'Noise', "counter_slider", float)
        self.top_layout.addWidget(self._noise_win)
        self._input_chooser_options = (0, 1, )
        self._input_chooser_labels = ('Test Symbol stream [3,3,-3,-3]', 'Stochastic Stream', )
        self._input_chooser_tool_bar = Qt.QToolBar(self)
        self._input_chooser_tool_bar.addWidget(Qt.QLabel('Input Selection'+": "))
        self._input_chooser_combo_box = Qt.QComboBox()
        self._input_chooser_tool_bar.addWidget(self._input_chooser_combo_box)
        for label in self._input_chooser_labels: self._input_chooser_combo_box.addItem(label)
        self._input_chooser_callback = lambda i: Qt.QMetaObject.invokeMethod(self._input_chooser_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._input_chooser_options.index(i)))
        self._input_chooser_callback(self.input_chooser)
        self._input_chooser_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_input_chooser(self._input_chooser_options[i]))
        self.top_grid_layout.addWidget(self._input_chooser_tool_bar, 0,0,1,1)
        self._delay2_0_range = Range(0, 100, 1, 17, 200)
        self._delay2_0_win = RangeWidget(self._delay2_0_range, self.set_delay2_0, 'Input delay', "counter_slider", float)
        self.top_layout.addWidget(self._delay2_0_win)
        self._delay2_range = Range(0, 100, 1, 5, 200)
        self._delay2_win = RangeWidget(self._delay2_range, self.set_delay2, 'delay2', "counter_slider", float)
        self.top_layout.addWidget(self._delay2_win)
        self.qtgui_time_sink_x_1 = qtgui.time_sink_c(
        	512, #size
        	48000, #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)

        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(2):
            if len(labels[i]) == 0:
                if(i % 2 == 0):
                    self.qtgui_time_sink_x_1.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_1.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            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
        	4800, #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(-5, 5)

        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)

        if not True:
          self.qtgui_time_sink_x_0.disable_legend()

        labels = ['Chain Fixed', 'Chain Actual', 'Chain Fixed Test', '', '',
                  '', '', '', '', '']
        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, 2, -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_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.p25_freq_mod_fc_0 = p25.freq_mod_fc(
          sample_rate=48000,
          max_amplitude=4.38895,
          max_deviation=2827,
          sensitivity_adjust=1,
          verbose=False,
          log=False
          )
        self.p25_freq_demod_cf_0 = p25.freq_demod_cf(
          sample_rate=48000,
          max_amplitude=4.38895,
          max_deviation=2827,
          gain_adjust=1.0,
          verbose=False,
          log=False
          )
        self.p25_c4fm_modulator_bf_0 = p25.c4fm_modulator_bf(
            filter_gain=1,
            dibit_map=([1.0/3.0, 1.0, -(1.0/3.0), -1.0]),
            sample_rate=48000,
            symbol_rate=4800,
            span=11,
            verbose=False,
            log=False
          )
        self.p25_c4fm_demodulator_fixed_fb_0 = p25.c4fm_demodulator_fixed_fb(
            filter_gain=3.0,
            dibits=([3, 2, 0, 1]),
            sample_rate=48000,
            symbol_rate=4800,
            delay=int(delay2),
            span=11,
            verbose=False,
            log=False
          )
        self.p25_c4fm_demodulator_fb_0 = p25.c4fm_demodulator_fb(
            filter_gain=3.0,
            dibits=([3, 2, 0, 1]),
            sample_rate=48000,
            symbol_rate=4800,
            span=11,
            verbose=False,
            log=False
          )
        self.blocks_vector_source_x_0 = blocks.vector_source_i((1,1,3,3), True, 1, [])
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_int*1, 240000,True)
        self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_gr_complex*1, 1024)
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vii((1 if input_chooser == 1 else 0, ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vii((1 if input_chooser == 0 else 0, ))
        self.blocks_int_to_float_0 = blocks.int_to_float(1, 1)
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, int(delay2_0))
        self.blocks_ctrlport_monitor_performance_0 = not False or monitor("gr-perf-monitorx")
        self.blocks_char_to_float_0_0_0 = blocks.char_to_float(1, 1)
        self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1)
        self.blocks_add_xx_2 = blocks.add_vcc(1)
        self.blocks_add_xx_1 = blocks.add_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vii(1)
        self.analog_random_uniform_source_x_0 = analog.random_uniform_source_i(0, 4, 0)
        self.analog_noise_source_x_1 = analog.noise_source_c(analog.GR_GAUSSIAN, 1, 0)
        self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, float(noise), 0)
        self.analog_const_source_x_0 = analog.sig_source_c(0, analog.GR_CONST_WAVE, 0, 0, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_add_xx_2, 0))
        self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_1, 1))
        self.connect((self.analog_noise_source_x_1, 0), (self.blocks_add_xx_2, 1))
        self.connect((self.analog_random_uniform_source_x_0, 0), (self.blocks_multiply_const_vxx_2, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_add_xx_1, 0), (self.p25_freq_demod_cf_0, 0))
        self.connect((self.blocks_add_xx_2, 0), (self.blocks_skiphead_0, 0))
        self.connect((self.blocks_char_to_float_0_0, 0), (self.qtgui_time_sink_x_0, 1))
        self.connect((self.blocks_char_to_float_0_0_0, 0), (self.qtgui_time_sink_x_0, 2))
        self.connect((self.blocks_delay_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_float_to_char_0, 0), (self.p25_c4fm_modulator_bf_0, 0))
        self.connect((self.blocks_int_to_float_0, 0), (self.blocks_delay_0, 0))
        self.connect((self.blocks_int_to_float_0, 0), (self.blocks_float_to_char_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_skiphead_0, 0), (self.qtgui_time_sink_x_1, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_int_to_float_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.p25_c4fm_demodulator_fb_0, 0), (self.blocks_char_to_float_0_0, 0))
        self.connect((self.p25_c4fm_demodulator_fixed_fb_0, 0), (self.blocks_char_to_float_0_0_0, 0))
        self.connect((self.p25_c4fm_modulator_bf_0, 0), (self.p25_freq_mod_fc_0, 0))
        self.connect((self.p25_freq_demod_cf_0, 0), (self.p25_c4fm_demodulator_fb_0, 0))
        self.connect((self.p25_freq_demod_cf_0, 0), (self.p25_c4fm_demodulator_fixed_fb_0, 0))
        self.connect((self.p25_freq_mod_fc_0, 0), (self.blocks_add_xx_1, 0))
示例#3
0
 self.blocks_throttle_0_1_0 = blocks.throttle(gr.sizeof_float * 1,
                                              samp_rate)
 self.blocks_null_source_1_0_0_1 = blocks.null_source(
     gr.sizeof_gr_complex * 1)
 self.blocks_null_source_1_0_0_0_0 = blocks.null_source(
     gr.sizeof_gr_complex * 1)
 self.blocks_null_source_1_0_0_0 = blocks.null_source(
     gr.sizeof_gr_complex * 1)
 self.blocks_null_source_1_0_0 = blocks.null_source(
     gr.sizeof_gr_complex * 1)
 self.blocks_multiply_xx_2_0 = blocks.multiply_vcc(1)
 self.blocks_multiply_xx_2 = blocks.multiply_vcc(1)
 self.blocks_multiply_xx_1_0 = blocks.multiply_vii(1)
 self.blocks_multiply_xx_1 = blocks.multiply_vii(1)
 self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vcc((0.9, ))
 self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vii((-1, ))
 self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vii((-1, ))
 self.blocks_delay_0_0 = blocks.delay(gr.sizeof_int * 1,
                                      ais_burst_duration)
 self.blocks_delay_0 = blocks.delay(gr.sizeof_int * 1,
                                    ais_burst_duration)
 self.blocks_add_xx_0 = blocks.add_vcc(1)
 self.blocks_add_const_vxx_0_0 = blocks.add_const_vii((1, ))
 self.blocks_add_const_vxx_0 = blocks.add_const_vii((1, ))
 self.blks2_selector_0_1_0_0_1 = grc_blks2.selector(
     item_size=gr.sizeof_gr_complex * 1,
     num_inputs=2,
     num_outputs=1,
     input_index=0 if (func_burst_out > 0) else 0,
     output_index=0,
 )
示例#4
0
 def test_multiply_const_vii_five(self):
     src_data = [1, 2, 3, 4, 5]
     op = blocks.multiply_const_vii((6, 7, 8, 9, 10))
     exp_data = [6, 14, 24, 36, 50]
     self.help_const_ii(src_data, exp_data, op)
    def __init__(self):
        gr.top_block.__init__(self, "p25_demodulator_chain_test")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("p25_demodulator_chain_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", "p25_demodulator_chain_test")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.wave_delay = wave_delay = 5
        self.sample_rate = sample_rate = 48000
        self.input_chooser = input_chooser = 1
        self.dibits_delay = dibits_delay = 17
        self.dibit_delay = dibit_delay = 11
        self.adjustment = adjustment = 0.051533333 * 48000 / 4800

        ##################################################
        # Blocks
        ##################################################
        self.tab1 = Qt.QTabWidget()
        self.tab1_widget_0 = Qt.QWidget()
        self.tab1_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                           self.tab1_widget_0)
        self.tab1_grid_layout_0 = Qt.QGridLayout()
        self.tab1_layout_0.addLayout(self.tab1_grid_layout_0)
        self.tab1.addTab(self.tab1_widget_0, 'Byte to Dibit Mapping')
        self.tab1_widget_1 = Qt.QWidget()
        self.tab1_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                           self.tab1_widget_1)
        self.tab1_grid_layout_1 = Qt.QGridLayout()
        self.tab1_layout_1.addLayout(self.tab1_grid_layout_1)
        self.tab1.addTab(self.tab1_widget_1, 'Dibit to C4FM Mapping')
        self.tab1_widget_2 = Qt.QWidget()
        self.tab1_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                           self.tab1_widget_2)
        self.tab1_grid_layout_2 = Qt.QGridLayout()
        self.tab1_layout_2.addLayout(self.tab1_grid_layout_2)
        self.tab1.addTab(self.tab1_widget_2, 'Waveform Recovery')
        self.tab1_widget_3 = Qt.QWidget()
        self.tab1_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                           self.tab1_widget_3)
        self.tab1_grid_layout_3 = Qt.QGridLayout()
        self.tab1_layout_3.addLayout(self.tab1_grid_layout_3)
        self.tab1.addTab(self.tab1_widget_3, 'Non-Sliced Dibit Recovery')
        self.tab1_widget_4 = Qt.QWidget()
        self.tab1_layout_4 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                           self.tab1_widget_4)
        self.tab1_grid_layout_4 = Qt.QGridLayout()
        self.tab1_layout_4.addLayout(self.tab1_grid_layout_4)
        self.tab1.addTab(self.tab1_widget_4, 'Sliced Dibit Recovery')
        self.top_layout.addWidget(self.tab1)
        self._wave_delay_range = Range(0, 200, 1, 5, 200)
        self._wave_delay_win = RangeWidget(self._wave_delay_range,
                                           self.set_wave_delay,
                                           'Waveform Delay', "counter_slider",
                                           float)
        self.tab1_layout_3.addWidget(self._wave_delay_win)
        self._input_chooser_options = (
            0,
            1,
        )
        self._input_chooser_labels = (
            'Test Symbol stream [3,3,-3,-3]',
            'Stochastic Stream',
        )
        self._input_chooser_tool_bar = Qt.QToolBar(self)
        self._input_chooser_tool_bar.addWidget(
            Qt.QLabel('Input Selection' + ": "))
        self._input_chooser_combo_box = Qt.QComboBox()
        self._input_chooser_tool_bar.addWidget(self._input_chooser_combo_box)
        for label in self._input_chooser_labels:
            self._input_chooser_combo_box.addItem(label)
        self._input_chooser_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._input_chooser_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._input_chooser_options.index(i)))
        self._input_chooser_callback(self.input_chooser)
        self._input_chooser_combo_box.currentIndexChanged.connect(
            lambda i: self.set_input_chooser(self._input_chooser_options[i]))
        self.top_grid_layout.addWidget(self._input_chooser_tool_bar, 0, 0, 1,
                                       1)
        self._dibits_delay_range = Range(0, 200, 1, 17, 200)
        self._dibits_delay_win = RangeWidget(self._dibits_delay_range,
                                             self.set_dibits_delay,
                                             'Dibits Delay', "counter_slider",
                                             float)
        self.tab1_layout_3.addWidget(self._dibits_delay_win)
        self._dibit_delay_range = Range(0, 200, 1, 11, 200)
        self._dibit_delay_win = RangeWidget(self._dibit_delay_range,
                                            self.set_dibit_delay,
                                            'Dibit Delay', "counter_slider",
                                            float)
        self.tab1_layout_1.addWidget(self._dibit_delay_win)
        self.qtgui_time_sink_x_0_0_0_0_0_0 = qtgui.time_sink_f(
            1024,  #size
            48000,  #samp_rate
            "",  #name
            3  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_0_0.set_update_time(0.0001)
        self.qtgui_time_sink_x_0_0_0_0_0_0.set_y_axis(-4, 4)

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

        self.qtgui_time_sink_x_0_0_0_0_0_0.enable_tags(-1, False)
        self.qtgui_time_sink_x_0_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_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0_0_0_0_0_0.disable_legend()

        labels = [
            'Original Dibit', 'Recovered Dibit', 'Sliced Dibit', '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_0_0_0_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.tab1_layout_4.addWidget(self._qtgui_time_sink_x_0_0_0_0_0_0_win)
        self.qtgui_time_sink_x_0_0_0_0_0 = qtgui.time_sink_f(
            1024,  #size
            48000,  #samp_rate
            "",  #name
            3  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_0.set_update_time(0.0001)
        self.qtgui_time_sink_x_0_0_0_0_0.set_y_axis(-4, 4)

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

        self.qtgui_time_sink_x_0_0_0_0_0.enable_tags(-1, False)
        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)

        if not True:
            self.qtgui_time_sink_x_0_0_0_0_0.disable_legend()

        labels = [
            'Transmitted Dibit', 'Shaped Waveform', 'Recovered Dibit', '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_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.tab1_layout_3.addWidget(self._qtgui_time_sink_x_0_0_0_0_0_win)
        self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f(
            256,  #size
            48000,  #samp_rate
            "",  #name
            2  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0.set_update_time(0.0001)
        self.qtgui_time_sink_x_0_0_0.set_y_axis(-4, 4)

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

        self.qtgui_time_sink_x_0_0_0.enable_tags(-1, False)
        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)

        if not True:
            self.qtgui_time_sink_x_0_0_0.disable_legend()

        labels = [
            'Original Byte', 'C4FM Waveform', 'Output Block Dibit', '', '', '',
            '', '', '', ''
        ]
        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_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.tab1_layout_1.addWidget(self._qtgui_time_sink_x_0_0_0_win)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            128,  #size
            48000,  #samp_rate
            "",  #name
            2  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.0001)
        self.qtgui_time_sink_x_0_0.set_y_axis(-4, 4)

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

        self.qtgui_time_sink_x_0_0.enable_tags(-1, False)
        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)

        if not True:
            self.qtgui_time_sink_x_0_0.disable_legend()

        labels = [
            'Original Byte', 'Converted Dibit', 'Output Block Dibit', '', '',
            '', '', '', '', ''
        ]
        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_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.tab1_layout_0.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.pam_pam_slicer_fb_0 = pam.pam_slicer_fb(slice_levels=([-2, 0, 2]),
                                                     dibits=([-3, -1, 1, 3]))
        self.p25_rx_shaping_filter_ff_0 = p25.rx_shaping_filter_ff(
            filter_gain=3,
            sample_rate=48000,
            symbol_rate=4800,
            span=11,
            verbose=False,
            log=False)
        self.p25_freq_mod_fc_0 = p25.freq_mod_fc(sample_rate=48000,
                                                 max_amplitude=4.38895,
                                                 max_deviation=2827,
                                                 sensitivity_adjust=1,
                                                 verbose=False,
                                                 log=False)
        self.p25_freq_demod_cf_0 = p25.freq_demod_cf(sample_rate=48000,
                                                     max_amplitude=4.38895,
                                                     max_deviation=2827,
                                                     gain_adjust=1.0,
                                                     verbose=False,
                                                     log=False)
        self.p25_dibit_mapper_bf_0 = p25.dibit_mapper_bf(
            dibit_map=([1, 3, -1, -3]), log_level=logging.NOTSET, filename='')
        self.p25_c4fm_modulator_bf_0 = p25.c4fm_modulator_bf(
            filter_gain=1,
            dibit_map=([1.0 / 3.0, 1.0, -(1.0 / 3.0), -1.0]),
            sample_rate=48000,
            symbol_rate=4800,
            span=11,
            verbose=False,
            log=False)
        self.interp_fir_filter_xxx_0_0_1 = filter.interp_fir_filter_fff(
            10, ((1, )))
        self.interp_fir_filter_xxx_0_0_1.declare_sample_delay(0)
        self.interp_fir_filter_xxx_0_0_0_0 = filter.interp_fir_filter_fff(
            10, ((1, )))
        self.interp_fir_filter_xxx_0_0_0_0.declare_sample_delay(0)
        self.interp_fir_filter_xxx_0_0_0 = filter.interp_fir_filter_fff(
            10, ((1, )))
        self.interp_fir_filter_xxx_0_0_0.declare_sample_delay(0)
        self.interp_fir_filter_xxx_0_0 = filter.interp_fir_filter_fff(
            10, ((1, )))
        self.interp_fir_filter_xxx_0_0.declare_sample_delay(0)
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff(
            10, ((1, )))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.fir_filter_xxx_0 = filter.fir_filter_fff(10, ((
            0,
            0,
            0,
            0,
            0,
            1,
        )))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.blocks_vector_source_x_0 = blocks.vector_source_i((1, 1, 3, 3),
                                                               True, 1, [])
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_int * 1, 240000,
                                                 True)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vii(
            (1 if input_chooser == 1 else 0, ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vii(
            (1 if input_chooser == 0 else 0, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((3, ))
        self.blocks_int_to_float_0 = blocks.int_to_float(1, 1)
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_delay_0_0_0_1 = blocks.delay(gr.sizeof_float * 1,
                                                 int(dibits_delay))
        self.blocks_delay_0_0_0_0 = blocks.delay(gr.sizeof_float * 1,
                                                 int(wave_delay))
        self.blocks_delay_0_0_0 = blocks.delay(gr.sizeof_float * 1,
                                               int(dibits_delay))
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1,
                                           int(dibit_delay))
        self.blocks_char_to_float_1 = blocks.char_to_float(1, 1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_add_xx_0 = blocks.add_vii(1)
        self.analog_random_uniform_source_x_0 = analog.random_uniform_source_i(
            0, 4, 0)
        self._adjustment_range = Range(0, 10, 0.01, 0.051533333 * 48000 / 4800,
                                       200)
        self._adjustment_win = RangeWidget(self._adjustment_range,
                                           self.set_adjustment, 'Sensitivity',
                                           "counter_slider", float)
        self.top_grid_layout.addWidget(self._adjustment_win, 1, 0, 1, 5)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_uniform_source_x_0, 0),
                     (self.blocks_multiply_const_vxx_2, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.interp_fir_filter_xxx_0_0_1, 0))
        self.connect((self.blocks_char_to_float_1, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.blocks_delay_0, 0),
                     (self.interp_fir_filter_xxx_0, 0))
        self.connect((self.blocks_delay_0_0_0, 0),
                     (self.interp_fir_filter_xxx_0_0_0, 0))
        self.connect((self.blocks_delay_0_0_0_0, 0),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 1))
        self.connect((self.blocks_delay_0_0_0_1, 0),
                     (self.interp_fir_filter_xxx_0_0_0_0, 0))
        self.connect((self.blocks_float_to_char_0, 0),
                     (self.blocks_char_to_float_1, 0))
        self.connect((self.blocks_float_to_char_0, 0),
                     (self.p25_c4fm_modulator_bf_0, 0))
        self.connect((self.blocks_float_to_char_0, 0),
                     (self.p25_dibit_mapper_bf_0, 0))
        self.connect((self.blocks_int_to_float_0, 0),
                     (self.blocks_float_to_char_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.qtgui_time_sink_x_0_0_0, 1))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_sub_xx_0, 0),
                     (self.qtgui_time_sink_x_0_0_0_0_0_0, 2))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_int_to_float_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.fir_filter_xxx_0, 0),
                     (self.interp_fir_filter_xxx_0_0, 0))
        self.connect((self.fir_filter_xxx_0, 0), (self.pam_pam_slicer_fb_0, 0))
        self.connect((self.interp_fir_filter_xxx_0, 0),
                     (self.qtgui_time_sink_x_0_0_0, 0))
        self.connect((self.interp_fir_filter_xxx_0_0, 0),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 2))
        self.connect((self.interp_fir_filter_xxx_0_0_0, 0),
                     (self.qtgui_time_sink_x_0_0_0_0_0, 0))
        self.connect((self.interp_fir_filter_xxx_0_0_0_0, 0),
                     (self.blocks_sub_xx_0, 0))
        self.connect((self.interp_fir_filter_xxx_0_0_0_0, 0),
                     (self.qtgui_time_sink_x_0_0_0_0_0_0, 0))
        self.connect((self.interp_fir_filter_xxx_0_0_1, 0),
                     (self.blocks_sub_xx_0, 1))
        self.connect((self.interp_fir_filter_xxx_0_0_1, 0),
                     (self.qtgui_time_sink_x_0_0_0_0_0_0, 1))
        self.connect((self.p25_c4fm_modulator_bf_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.p25_c4fm_modulator_bf_0, 0),
                     (self.p25_freq_mod_fc_0, 0))
        self.connect((self.p25_dibit_mapper_bf_0, 0), (self.blocks_delay_0, 0))
        self.connect((self.p25_dibit_mapper_bf_0, 0),
                     (self.blocks_delay_0_0_0, 0))
        self.connect((self.p25_dibit_mapper_bf_0, 0),
                     (self.blocks_delay_0_0_0_1, 0))
        self.connect((self.p25_dibit_mapper_bf_0, 0),
                     (self.qtgui_time_sink_x_0_0, 1))
        self.connect((self.p25_freq_demod_cf_0, 0),
                     (self.p25_rx_shaping_filter_ff_0, 0))
        self.connect((self.p25_freq_mod_fc_0, 0),
                     (self.p25_freq_demod_cf_0, 0))
        self.connect((self.p25_rx_shaping_filter_ff_0, 0),
                     (self.blocks_delay_0_0_0_0, 0))
        self.connect((self.p25_rx_shaping_filter_ff_0, 0),
                     (self.fir_filter_xxx_0, 0))
        self.connect((self.pam_pam_slicer_fb_0, 0),
                     (self.blocks_char_to_float_0, 0))
示例#6
0
    def __init__(self):
        gr.top_block.__init__(self, "Minimal Working Example")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Minimal Working Example")
        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", "minimal_working_example")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

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

        ##################################################
        # Blocks
        ##################################################
        self.root_raised_cosine_filter_0 = filter.interp_fir_filter_fff(
            1,
            firdes.root_raised_cosine(1, samp_rate, 4800, 0.35,
                                      11 * samp_rate))
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #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(-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)

        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_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vii((2, ))
        self.blocks_int_to_float_0 = blocks.int_to_float(1, 1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vii((-3, ))
        self.analog_random_source_x_0 = blocks.vector_source_i(
            map(int, numpy.random.randint(0, 4, 1000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_int_to_float_0, 0))
        self.connect((self.blocks_int_to_float_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_int_to_float_0, 0),
                     (self.root_raised_cosine_filter_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.root_raised_cosine_filter_0, 0),
                     (self.qtgui_time_sink_x_0, 1))
 def test_multiply_const_vii_one(self):
     src_data = (2, )
     op = blocks.multiply_const_vii((3, ))
     exp_data = (6, )
     self.help_const_ii(src_data, exp_data, op)
示例#8
0
    def test_multiply_const_vii_five(self):
	src_data = (1, 2, 3, 4, 5)
	op = blocks.multiply_const_vii((6, 7, 8, 9, 10))
	exp_data = (6, 14, 24, 36, 50)
	self.help_const_ii(src_data, exp_data, op)
示例#9
0
    def test_multiply_const_vii_one(self):
	src_data = (2,)
	op = blocks.multiply_const_vii((3,))
	exp_data = (6,)
	self.help_const_ii(src_data, exp_data, op)
    def __init__(self):
        gr.top_block.__init__(self, "Fourpam Demod Example")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Fourpam Demod Example")
        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", "fourpam_demod_example")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.variable_qtgui_range_0 = variable_qtgui_range_0 = 5
        self.samp_rate = samp_rate = 48000
        self.noise_amp = noise_amp = 0

        ##################################################
        # Blocks
        ##################################################
        self._variable_qtgui_range_0_range = Range(0, 200, 1, 5, 200)
        self._variable_qtgui_range_0_win = RangeWidget(
            self._variable_qtgui_range_0_range,
            self.set_variable_qtgui_range_0, 'Delay', "counter_slider", float)
        self.top_layout.addWidget(self._variable_qtgui_range_0_win)
        self._noise_amp_range = Range(0, 1, 0.01, 0, 200)
        self._noise_amp_win = RangeWidget(self._noise_amp_range,
                                          self.set_noise_amp, 'Noise Amp',
                                          "counter_slider", float)
        self.top_layout.addWidget(self._noise_amp_win)
        self.root_raised_cosine_filter_0 = filter.interp_fir_filter_fff(
            10, firdes.root_raised_cosine(10, 10, 1, 0.35, 11 * 10))
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=1,
            decimation=1,
            taps=([
                1,
            ]),
            fractional_bw=None,
        )
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            256,  #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(-4, 4)

        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(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)

        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_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            128,  #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(-4, 4)

        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)

        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_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.pam_fourpam_demod_ff_0 = pam.fourpam_demod_ff(gr.msg_queue(2),
                                                           sample_rate=48000,
                                                           symbol_rate=4800)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vii((2, ))
        self.blocks_int_to_float_0 = blocks.int_to_float(1, 1)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1,
                                           int(variable_qtgui_range_0))
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vii((-3, ))
        self.analog_random_source_x_0 = blocks.vector_source_i(
            map(int, numpy.random.randint(0, 4, 1000)), True)
        self.analog_noise_source_x_0 = analog.noise_source_f(
            analog.GR_GAUSSIAN, noise_amp, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.analog_random_source_x_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_int_to_float_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.root_raised_cosine_filter_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_int_to_float_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_int_to_float_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.pam_fourpam_demod_ff_0, 0),
                     (self.qtgui_time_sink_x_0, 1))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_delay_0, 0))
        self.connect((self.root_raised_cosine_filter_0, 0),
                     (self.pam_fourpam_demod_ff_0, 0))
        self.connect((self.root_raised_cosine_filter_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))