Ejemplo n.º 1
0
 def test_add_const_vii_one(self):
     src_data = [
         1,
     ]
     op = blocks.add_const_vii((2, ))
     exp_data = [
         3,
     ]
     self.help_const_ii(src_data, exp_data, op)
Ejemplo n.º 2
0
     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,
 )
 self.blks2_selector_0_1_0_0_0_0 = grc_blks2.selector(
     item_size=gr.sizeof_gr_complex * 1,
     num_inputs=2,
     num_outputs=1,
     input_index=0 if (func_doppler_0 > 0) else 1,
     output_index=0,
 )
Ejemplo n.º 3
0
 def test_add_const_vii_five(self):
     src_data = [1, 2, 3, 4, 5]
     op = blocks.add_const_vii((6, 7, 8, 9, 10))
     exp_data = [7, 9, 11, 13, 15]
     self.help_const_ii(src_data, exp_data, op)
Ejemplo n.º 4
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))
Ejemplo n.º 5
0
 def test_add_const_vii_one(self):
     src_data = (1, )
     op = blocks.add_const_vii((2, ))
     exp_data = (3, )
     self.help_const_ii(src_data, exp_data, op)
Ejemplo n.º 6
0
    def test_add_const_vii_five(self):
	src_data = (1, 2, 3, 4, 5)
	op = blocks.add_const_vii((6, 7, 8, 9, 10))
	exp_data = (7, 9, 11, 13, 15)
	self.help_const_ii(src_data, exp_data, op)
Ejemplo n.º 7
0
    def test_add_const_vii_one(self):
	src_data = (1,)
	op = blocks.add_const_vii((2,))
	exp_data = (3,)
	self.help_const_ii(src_data, exp_data, op)
Ejemplo n.º 8
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.threshold = threshold = -40
        self.samp_rate = samp_rate = 2000000
        self.freq = freq = 446093750

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_numbersink2_0_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_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=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.wxgui_fftsink2_2 = 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=samp_rate,
        	fft_size=1024,
        	fft_rate=30,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_2.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(2, 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(42, 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.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=48,
                decimation=200,
                taps=None,
                fractional_bw=None,
        )
        self.blocks_threshold_ff_0 = blocks.threshold_ff(threshold-1, threshold, 0)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((100, ))
        self.blocks_float_to_int_0 = blocks.float_to_int(1, 1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vii((40, ))
        self.blks2_tcp_sink_0 = grc_blks2.tcp_sink(
        	itemsize=gr.sizeof_int*1,
        	addr="127.0.0.1",
        	port=50000,
        	server=False,
        )
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
        	channel_rate=200e3,
        	audio_decim=1,
        	audio_pass=5000,
        	audio_stop=5500,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_tcp_sink_0, 0))
        self.connect((self.blocks_float_to_int_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_int_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0), (self.wxgui_numbersink2_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_threshold_ff_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.analog_am_demod_cf_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_numbersink2_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_2, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
    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))