def __init__(self): gr.top_block.__init__(self, "Ornl 1") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_magphase_to_complex_1 = blocks.magphase_to_complex(1) self.blocks_magphase_to_complex_0 = blocks.magphase_to_complex(1) self.blocks_head_0 = blocks.head(gr.sizeof_gr_complex * 1, 50 * samp_rate) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1, 'ornl_1.bin', False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_complex_to_magphase_0 = blocks.complex_to_magphase(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1) self.analog_noise_source_x_0 = analog.noise_source_c( analog.GR_GAUSSIAN, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_magphase_to_complex_1, 1)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_magphase_to_complex_1, 0)) self.connect((self.blocks_complex_to_magphase_0, 1), (self.blocks_magphase_to_complex_0, 1)) self.connect((self.blocks_complex_to_magphase_0, 0), (self.blocks_magphase_to_complex_0, 0)) self.connect((self.blocks_head_0, 0), (self.blocks_complex_to_magphase_0, 0)) self.connect((self.blocks_magphase_to_complex_0, 0), (self.blocks_complex_to_arg_0, 0)) self.connect((self.blocks_magphase_to_complex_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.blocks_magphase_to_complex_1, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_head_0, 0))
def __init__(self): gr.top_block.__init__(self, "twodimension_simulation") Qt.QWidget.__init__(self) self.setWindowTitle("twodimension_simulation") 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", "twodimension_simulation") 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.maxtheta = maxtheta = 120 self.columns = columns = 100 self.shiftarrL = shiftarrL = np.radians( np.linspace(start=maxtheta, stop=0, num=int(columns / 2), endpoint=False)) self.left = left = np.pad(shiftarrL, (0, int(columns / 2)), 'constant') self.right = right = np.flip(left, axis=0) self.degreesTXT = degreesTXT = 0 self.degreesTXR = degreesTXR = 0 self.degreesTXL = degreesTXL = 0 self.degreesTXB = degreesTXB = 0 self.variable_qtgui_label_0_0 = variable_qtgui_label_0_0 = left self.variable_qtgui_label_0 = variable_qtgui_label_0 = right self.scale = scale = 15 self.samp_rate = samp_rate = 32000 self.keep = keep = 32 self.displayscale = displayscale = 8 self.angle_radiansStartT = angle_radiansStartT = (math.pi / 180) * degreesTXT self.angle_radiansStartR = angle_radiansStartR = (math.pi / 180) * degreesTXR self.angle_radiansStartL = angle_radiansStartL = (math.pi / 180) * degreesTXL self.angle_radiansStartB = angle_radiansStartB = (math.pi / 180) * degreesTXB ################################################## # 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, 'Time rasters') 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, 'Steering vectors') self.top_grid_layout.addWidget(self.tab) self._scale_range = Range(0, 100, 5, 15, 200) self._scale_win = RangeWidget(self._scale_range, self.set_scale, 'scale', "counter_slider", float) self.top_grid_layout.addWidget(self._scale_win) self.video_sdl_sink_1_1_0 = video_sdl.sink_s(0, columns, columns, 0, columns * displayscale, columns * displayscale) self._variable_qtgui_label_0_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_0_formatter = None else: self._variable_qtgui_label_0_0_formatter = lambda x: repr(x) self._variable_qtgui_label_0_0_tool_bar.addWidget( Qt.QLabel('Left' + ": ")) self._variable_qtgui_label_0_0_label = Qt.QLabel( str( self._variable_qtgui_label_0_0_formatter( self.variable_qtgui_label_0_0))) self._variable_qtgui_label_0_0_tool_bar.addWidget( self._variable_qtgui_label_0_0_label) self.tab_layout_1.addWidget(self._variable_qtgui_label_0_0_tool_bar) self._variable_qtgui_label_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_formatter = None else: self._variable_qtgui_label_0_formatter = lambda x: repr(x) self._variable_qtgui_label_0_tool_bar.addWidget( Qt.QLabel('Right' + ": ")) self._variable_qtgui_label_0_label = Qt.QLabel( str( self._variable_qtgui_label_0_formatter( self.variable_qtgui_label_0))) self._variable_qtgui_label_0_tool_bar.addWidget( self._variable_qtgui_label_0_label) self.tab_layout_1.addWidget(self._variable_qtgui_label_0_tool_bar) self.qtgui_time_raster_sink_x_0_0 = qtgui.time_raster_sink_f( samp_rate / keep, columns, columns, [], [], "Elevation", 1) self.qtgui_time_raster_sink_x_0_0.set_update_time(0.01) self.qtgui_time_raster_sink_x_0_0.set_intensity_range(0, 5) self.qtgui_time_raster_sink_x_0_0.enable_grid(False) self.qtgui_time_raster_sink_x_0_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [1, 1, 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_time_raster_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_raster_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_raster_sink_x_0_0.set_color_map(i, colors[i]) self.qtgui_time_raster_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_raster_sink_x_0_0_win = sip.wrapinstance( self.qtgui_time_raster_sink_x_0_0.pyqwidget(), Qt.QWidget) self.tab_layout_0.addWidget(self._qtgui_time_raster_sink_x_0_0_win) self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f( samp_rate / keep, columns, columns, [], [], "Azimuth", 1) self.qtgui_time_raster_sink_x_0.set_update_time(0.01) self.qtgui_time_raster_sink_x_0.set_intensity_range(0, 5) self.qtgui_time_raster_sink_x_0.enable_grid(False) self.qtgui_time_raster_sink_x_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [1, 1, 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_time_raster_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i]) self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance( self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget) self.tab_layout_0.addWidget(self._qtgui_time_raster_sink_x_0_win) self._degreesTXT_range = Range(0, maxtheta, 5, 0, 200) self._degreesTXT_win = RangeWidget(self._degreesTXT_range, self.set_degreesTXT, 'degreesTXT', "counter_slider", float) self.top_grid_layout.addWidget(self._degreesTXT_win) self._degreesTXR_range = Range(0, maxtheta, 5, 0, 200) self._degreesTXR_win = RangeWidget(self._degreesTXR_range, self.set_degreesTXR, 'degreesTXR', "counter_slider", float) self.top_grid_layout.addWidget(self._degreesTXR_win) self._degreesTXL_range = Range(0, maxtheta, 5, 0, 200) self._degreesTXL_win = RangeWidget(self._degreesTXL_range, self.set_degreesTXL, 'degreesTXL', "counter_slider", float) self.top_grid_layout.addWidget(self._degreesTXL_win) self._degreesTXB_range = Range(0, maxtheta, 5, 0, 200) self._degreesTXB_win = RangeWidget(self._degreesTXB_range, self.set_degreesTXB, 'degreesTXB', "counter_slider", float) self.top_grid_layout.addWidget(self._degreesTXB_win) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, columns) self.blocks_vector_source_x_0_0_0_1 = blocks.vector_source_f( left, True, 1, []) self.blocks_vector_source_x_0_0_0_0_0 = blocks.vector_source_f( right, True, 1, []) self.blocks_vector_source_x_0_0_0_0 = blocks.vector_source_f( right, True, 1, []) self.blocks_vector_source_x_0_0_0 = blocks.vector_source_f( left, True, 1, []) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_sub_xx_0_0_1 = blocks.sub_ff(1) self.blocks_sub_xx_0_0_0_0 = blocks.sub_ff(1) self.blocks_sub_xx_0_0_0 = blocks.sub_ff(1) self.blocks_sub_xx_0_0 = blocks.sub_ff(1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, columns) self.blocks_repeat_0_0_0_0_2 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0_1_0 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0_1 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0_0_1_0 = blocks.repeat( gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0_0_1 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0_0_0 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0_0 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0 = blocks.repeat(gr.sizeof_gr_complex * columns, columns) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1, columns) self.blocks_multiply_const_vxx_0_0_1_0 = blocks.multiply_const_cc( complex(math.cos(angle_radiansStartT), math.sin(angle_radiansStartT))) self.blocks_multiply_const_vxx_0_0_1 = blocks.multiply_const_cc( complex(math.cos(angle_radiansStartR), math.sin(angle_radiansStartR))) self.blocks_multiply_const_vxx_0_0_0_0_0 = blocks.multiply_const_cc( complex(math.cos(angle_radiansStartB), math.sin(angle_radiansStartB))) self.blocks_multiply_const_vxx_0_0_0_0 = blocks.multiply_const_cc( complex(math.cos(angle_radiansStartL), math.sin(angle_radiansStartL))) self.blocks_magphase_to_complex_0_0_0_0_1 = blocks.magphase_to_complex( 1) self.blocks_magphase_to_complex_0_0_0_0_0_0 = blocks.magphase_to_complex( 1) self.blocks_magphase_to_complex_0_0_0_0_0 = blocks.magphase_to_complex( 1) self.blocks_magphase_to_complex_0_0_0_0 = blocks.magphase_to_complex(1) self.blocks_keep_one_in_n_0_2 = blocks.keep_one_in_n( gr.sizeof_gr_complex * 1, keep) self.blocks_keep_one_in_n_0_1 = blocks.keep_one_in_n( gr.sizeof_gr_complex * 1, keep) self.blocks_keep_one_in_n_0_0 = blocks.keep_one_in_n( gr.sizeof_gr_complex * 1, keep) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n( gr.sizeof_gr_complex * 1, keep) self.blocks_float_to_short_0_1_0 = blocks.float_to_short(1, scale) self.blocks_complex_to_magphase_0_0_0_1 = blocks.complex_to_magphase(1) self.blocks_complex_to_magphase_0_0_0_0_0 = blocks.complex_to_magphase( 1) self.blocks_complex_to_magphase_0_0_0_0 = blocks.complex_to_magphase(1) self.blocks_complex_to_magphase_0_0_0 = blocks.complex_to_magphase(1) self.blocks_complex_to_mag_squared_0_1_0 = blocks.complex_to_mag_squared( 1) self.blocks_complex_to_mag_squared_0_0 = blocks.complex_to_mag_squared( 1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_add_xx_1 = blocks.add_vcc(1) self.blocks_add_xx_0_0 = blocks.add_vcc(1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_sig_source_x_0_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 400, 1, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_add_xx_0_0, 0), (self.blocks_complex_to_mag_squared_0_0, 0)) self.connect((self.blocks_add_xx_0_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.blocks_add_xx_1, 0), (self.blocks_complex_to_mag_squared_0_1_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.qtgui_time_raster_sink_x_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_0, 0), (self.qtgui_time_raster_sink_x_0_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_1_0, 0), (self.blocks_float_to_short_0_1_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0, 0), (self.blocks_repeat_0_0_0_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0, 1), (self.blocks_repeat_0_0_0_0_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_0, 1), (self.blocks_repeat_0_0_0_0_0_1, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_0, 0), (self.blocks_repeat_0_0_0_0_1, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_0_0, 1), (self.blocks_repeat_0_0_0_0_0_1_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_0_0, 0), (self.blocks_repeat_0_0_0_0_1_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_1, 1), (self.blocks_repeat_0_0_0_0_0_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_1, 0), (self.blocks_repeat_0_0_0_0_2, 0)) self.connect((self.blocks_float_to_short_0_1_0, 0), (self.video_sdl_sink_1_1_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_multiply_const_vxx_0_0_1, 0)) self.connect((self.blocks_keep_one_in_n_0_0, 0), (self.blocks_multiply_const_vxx_0_0_0_0, 0)) self.connect((self.blocks_keep_one_in_n_0_1, 0), (self.blocks_multiply_const_vxx_0_0_1_0, 0)) self.connect((self.blocks_keep_one_in_n_0_2, 0), (self.blocks_multiply_const_vxx_0_0_0_0_0, 0)) self.connect((self.blocks_magphase_to_complex_0_0_0_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_magphase_to_complex_0_0_0_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_magphase_to_complex_0_0_0_0_0_0, 0), (self.blocks_add_xx_0_0, 1)) self.connect((self.blocks_magphase_to_complex_0_0_0_0_1, 0), (self.blocks_add_xx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0_0_0, 0), (self.blocks_complex_to_magphase_0_0_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0_0_0_0, 0), (self.blocks_complex_to_magphase_0_0_0_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0_1, 0), (self.blocks_complex_to_magphase_0_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0_1_0, 0), (self.blocks_complex_to_magphase_0_0_0_1, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_add_xx_1, 1)) self.connect((self.blocks_repeat_0_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_repeat_0_0_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_0, 0), (self.blocks_sub_xx_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_0_0, 0), (self.blocks_sub_xx_0_0_1, 0)) self.connect((self.blocks_repeat_0_0_0_0_0_1, 0), (self.blocks_sub_xx_0_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_0_1_0, 0), (self.blocks_sub_xx_0_0_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_1, 0), (self.blocks_magphase_to_complex_0_0_0_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_1_0, 0), (self.blocks_magphase_to_complex_0_0_0_0_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_2, 0), (self.blocks_magphase_to_complex_0_0_0_0_1, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_repeat_0_0, 0)) self.connect((self.blocks_sub_xx_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0, 1)) self.connect((self.blocks_sub_xx_0_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0_0, 1)) self.connect((self.blocks_sub_xx_0_0_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0_0_0, 1)) self.connect((self.blocks_sub_xx_0_0_1, 0), (self.blocks_magphase_to_complex_0_0_0_0_1, 1)) self.connect((self.blocks_throttle_0, 0), (self.blocks_keep_one_in_n_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_keep_one_in_n_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_keep_one_in_n_0_1, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_keep_one_in_n_0_2, 0)) self.connect((self.blocks_vector_source_x_0_0_0, 0), (self.blocks_sub_xx_0_0, 1)) self.connect((self.blocks_vector_source_x_0_0_0_0, 0), (self.blocks_sub_xx_0_0_0, 1)) self.connect((self.blocks_vector_source_x_0_0_0_0_0, 0), (self.blocks_sub_xx_0_0_0_0, 1)) self.connect((self.blocks_vector_source_x_0_0_0_1, 0), (self.blocks_sub_xx_0_0_1, 1)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_add_xx_1, 0))
def __init__(self, options, filename): gr.top_block.__init__(self, "Top Block") ################################################## # Blocks ################################################## self.dc_blocker_xx_0_0 = filter.dc_blocker_cc(32, True) self.dc_blocker_xx_0 = filter.dc_blocker_cc(32, True) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, 20000000, True) self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_gr_complex * 1, options.skip) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1) self.blocks_magphase_to_complex_0 = blocks.magphase_to_complex(1) self.blocks_head_0 = blocks.head(gr.sizeof_gr_complex * 1, options.maxsamp) self.blocks_file_source_0_0 = blocks.file_source( gr.sizeof_gr_complex * 1, filename[0], True) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, filename[1], True) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1, filename[2], False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_complex_to_magphase_0 = blocks.complex_to_magphase(1) self.blocks_add_xx_0 = blocks.add_vcc(1) #self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.blocks_threshold_ff_0 = blocks.threshold_ff(0.01, 0.04, 0) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.blocks_file_source_0_0, 0), (self.dc_blocker_xx_0_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.dc_blocker_xx_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_skiphead_0, 0)) self.connect((self.blocks_skiphead_0, 0), (self.blocks_head_0, 0)) self.connect((self.blocks_head_0, 0), (self.blocks_complex_to_magphase_0, 0)) # tap for power analysis self.connect((self.blocks_head_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_complex_to_magphase_0, 1), (self.blocks_magphase_to_complex_0, 1)) self.connect((self.blocks_complex_to_magphase_0, 0), (self.blocks_null_sink_0, 0)) #self.connect((self.analog_const_source_x_0, 0), (self.blocks_magphase_to_complex_0, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_magphase_to_complex_0, 0)) # in case you want to just add #self.connect((self.blocks_complex_to_magphase_0, 0), (self.blocks_magphase_to_complex_0, 0)) self.connect((self.blocks_magphase_to_complex_0, 0), (self.blocks_file_sink_0, 0))
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 = 6000000 ################################################## # Blocks ################################################## self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(1090000000, 0) self.uhd_usrp_sink_0.set_gain(50, 0) self.uhd_usrp_sink_0.set_antenna("TX/RX", 0) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_float * 1, samp_rate / 2000000) self.blocks_magphase_to_complex_0 = blocks.magphase_to_complex(1) self.analog_const_source_x_0 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, 0) self.adsb_send_adsbgen_0 = adsb_send.adsbgen( "/home/paultpt/Dropbox/Polymtl/Recherche DDS/usrp/ADS-B.log", 0.5, 1000) ################################################## # Connections ################################################## self.connect((self.adsb_send_adsbgen_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.analog_const_source_x_0, 0), (self.blocks_magphase_to_complex_0, 1)) self.connect((self.blocks_magphase_to_complex_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_magphase_to_complex_0, 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.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.qtgui_time_sink_x_1_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "CPU Workflow", #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(2): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_1_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_1_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) 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_grid_layout.addWidget(self._qtgui_time_sink_x_1_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "OpenACC Workflow", #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(2): if len(labels[i]) == 0: if (i % 2 == 0): self.qtgui_time_sink_x_0.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_0.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) 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.openacc_accMagPhaseToComplex_1_0 = openacc.accMagPhaseToComplex( 1, 0, 1, 0, 1) self.openacc_accMagPhaseToComplex_1 = openacc.accMagPhaseToComplex( 1, 0, 1, 0, 0) self.openacc_accMagPhaseToComplex_0_0 = openacc.accMagPhaseToComplex( 1, 0, 1, 0, 0) self.openacc_accMagPhaseToComplex_0 = openacc.accMagPhaseToComplex( 1, 0, 1, 0, 0) self.openacc_accComplexToMag_0_0 = openacc.accComplexToMag( 1, 0, 1, 0, 0) self.openacc_accComplexToMag_0 = openacc.accComplexToMag(1, 0, 1, 0, 0) self.openacc_accComplexToMagPhase_0_0 = openacc.accComplexToMagPhase( 1, 0, 1, 0, 0) self.openacc_accComplexToMagPhase_0 = openacc.accComplexToMagPhase( 1, 0, 1, 1, 0) self.openacc_accComplexToArg_0_0 = openacc.accComplexToArg( 1, 0, 1, 0, 0) self.openacc_accComplexToArg_0 = openacc.accComplexToArg(1, 0, 1, 0, 0) self.blocks_magphase_to_complex_1_0 = blocks.magphase_to_complex(1) self.blocks_magphase_to_complex_1 = blocks.magphase_to_complex(1) self.blocks_magphase_to_complex_0_0 = blocks.magphase_to_complex(1) self.blocks_magphase_to_complex_0 = blocks.magphase_to_complex(1) self.blocks_ctrlport_monitor_performance_0 = not True or monitor( "gr-perf-monitorx") self.blocks_complex_to_magphase_0_0 = blocks.complex_to_magphase(1) self.blocks_complex_to_magphase_0 = blocks.complex_to_magphase(1) self.blocks_complex_to_mag_0_0 = blocks.complex_to_mag(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.blocks_complex_to_arg_0_0 = blocks.complex_to_arg(1) self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1) self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 1000, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 1000, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.openacc_accComplexToMagPhase_0, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_complex_to_magphase_0, 0)) self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_magphase_to_complex_1, 1)) self.connect((self.blocks_complex_to_arg_0_0, 0), (self.blocks_magphase_to_complex_1_0, 1)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_magphase_to_complex_1, 0)) self.connect((self.blocks_complex_to_mag_0_0, 0), (self.blocks_magphase_to_complex_1_0, 0)) self.connect((self.blocks_complex_to_magphase_0, 0), (self.blocks_magphase_to_complex_0, 0)) self.connect((self.blocks_complex_to_magphase_0, 1), (self.blocks_magphase_to_complex_0, 1)) self.connect((self.blocks_complex_to_magphase_0_0, 0), (self.blocks_magphase_to_complex_0_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0, 1), (self.blocks_magphase_to_complex_0_0, 1)) self.connect((self.blocks_magphase_to_complex_0, 0), (self.blocks_complex_to_arg_0, 0)) self.connect((self.blocks_magphase_to_complex_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.blocks_magphase_to_complex_0_0, 0), (self.blocks_complex_to_arg_0_0, 0)) self.connect((self.blocks_magphase_to_complex_0_0, 0), (self.blocks_complex_to_mag_0_0, 0)) self.connect((self.blocks_magphase_to_complex_1, 0), (self.blocks_complex_to_magphase_0_0, 0)) self.connect((self.blocks_magphase_to_complex_1_0, 0), (self.qtgui_time_sink_x_1_0, 0)) self.connect((self.openacc_accComplexToArg_0, 0), (self.openacc_accMagPhaseToComplex_1, 1)) self.connect((self.openacc_accComplexToArg_0_0, 0), (self.openacc_accMagPhaseToComplex_1_0, 1)) self.connect((self.openacc_accComplexToMagPhase_0, 0), (self.openacc_accMagPhaseToComplex_0, 0)) self.connect((self.openacc_accComplexToMagPhase_0, 1), (self.openacc_accMagPhaseToComplex_0, 1)) self.connect((self.openacc_accComplexToMagPhase_0_0, 0), (self.openacc_accMagPhaseToComplex_0_0, 0)) self.connect((self.openacc_accComplexToMagPhase_0_0, 1), (self.openacc_accMagPhaseToComplex_0_0, 1)) self.connect((self.openacc_accComplexToMag_0, 0), (self.openacc_accMagPhaseToComplex_1, 0)) self.connect((self.openacc_accComplexToMag_0_0, 0), (self.openacc_accMagPhaseToComplex_1_0, 0)) self.connect((self.openacc_accMagPhaseToComplex_0, 0), (self.openacc_accComplexToArg_0, 0)) self.connect((self.openacc_accMagPhaseToComplex_0, 0), (self.openacc_accComplexToMag_0, 0)) self.connect((self.openacc_accMagPhaseToComplex_0_0, 0), (self.openacc_accComplexToArg_0_0, 0)) self.connect((self.openacc_accMagPhaseToComplex_0_0, 0), (self.openacc_accComplexToMag_0_0, 0)) self.connect((self.openacc_accMagPhaseToComplex_1, 0), (self.openacc_accComplexToMagPhase_0_0, 0)) self.connect((self.openacc_accMagPhaseToComplex_1_0, 0), (self.qtgui_time_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "Not titled yet") ################################################## # Variables ################################################## self.samp_rate = samp_rate = int(2.2e6) self.f = f = int(700e6) self.N = N = 140000 self.plutopow = plutopow = 30.0 ################################################## # Blocks ################################################## self.zeromq_pub_sink_0 = zeromq.pub_sink(gr.sizeof_gr_complex, N, 'tcp://192.168.0.165:5555', 100, False, -1) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0, 2)), ), ) self.uhd_usrp_source_0.set_center_freq(f, 0) self.uhd_usrp_source_0.set_gain(70, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.uhd_usrp_source_0.set_center_freq(f, 1) self.uhd_usrp_source_0.set_gain(40, 1) self.uhd_usrp_source_0.set_antenna('RX2', 1) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_time_unknown_pps(uhd.time_spec()) self.iio_pluto_sink_0 = iio.pluto_sink('', f, samp_rate, 20000000, 32768, False, plutopow, '', True) self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, N) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(3.1415) self.blocks_magphase_to_complex_0 = blocks.magphase_to_complex(1) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n( gr.sizeof_gr_complex * N, 1) self.blocks_interleave_0 = blocks.interleave(gr.sizeof_gr_complex * 1, 1) self.blocks_int_to_float_0 = blocks.int_to_float(1, 1) self.analog_random_source_x_0 = blocks.vector_source_i( list(map(int, numpy.random.randint(0, 2, N))), True) 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_magphase_to_complex_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.blocks_int_to_float_0, 0)) self.connect((self.blocks_int_to_float_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.blocks_interleave_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.zeromq_pub_sink_0, 0)) self.connect((self.blocks_magphase_to_complex_0, 0), (self.iio_pluto_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_magphase_to_complex_0, 1)) self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_keep_one_in_n_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.uhd_usrp_source_0, 1), (self.blocks_interleave_0, 1)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_interleave_0, 0))
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 = 5000000 self.rf_gain = rf_gain = 10 self.phase_offset3 = phase_offset3 = 0 self.phase_offset2 = phase_offset2 = 0 self.phase_offset1 = phase_offset1 = 0 self.fft_size = fft_size = 4096 self.const = const = 0.2 self.cent_freq = cent_freq = 2100000000 self.bandwidth = bandwidth = samp_rate ################################################## # Blocks ################################################## self._phase_offset3_range = Range(-1.5, 1.5, 0.02, 0, 200) self._phase_offset3_win = RangeWidget(self._phase_offset3_range, self.set_phase_offset3, "phase_offset3", "counter_slider", float) self.top_layout.addWidget(self._phase_offset3_win) self._phase_offset2_range = Range(-1.5, 1.5, 0.02, 0, 200) self._phase_offset2_win = RangeWidget(self._phase_offset2_range, self.set_phase_offset2, "phase_offset2", "counter_slider", float) self.top_layout.addWidget(self._phase_offset2_win) self._phase_offset1_range = Range(-1.5, 1.5, 0.02, 0, 200) self._phase_offset1_win = RangeWidget(self._phase_offset1_range, self.set_phase_offset1, "phase_offset1", "counter_slider", float) self.top_layout.addWidget(self._phase_offset1_win) self.uhd_usrp_source_0_0 = uhd.usrp_source( ",".join(("addr=192.168.1.185", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0_0.set_center_freq(cent_freq, 0) self.uhd_usrp_source_0_0.set_gain(28, 0) self.uhd_usrp_source_0_0.set_antenna("TX/RX", 0) self.uhd_usrp_source_0_0.set_bandwidth(bandwidth, 0) self.uhd_usrp_sink_0_0 = uhd.usrp_sink( ",".join(("addr0=192.168.1.175, addr1=192.168.1.176,addr2=192.168.1.177,addr3=192.168.1.178", "")), uhd.stream_args( cpu_format="fc32", channels=range(4), ), ) self.uhd_usrp_sink_0_0.set_clock_source("external", 0) self.uhd_usrp_sink_0_0.set_time_source("external", 0) self.uhd_usrp_sink_0_0.set_clock_source("external", 1) self.uhd_usrp_sink_0_0.set_time_source("external", 1) self.uhd_usrp_sink_0_0.set_clock_source("external", 2) self.uhd_usrp_sink_0_0.set_time_source("external", 2) self.uhd_usrp_sink_0_0.set_clock_source("external", 3) self.uhd_usrp_sink_0_0.set_time_source("external", 3) self.uhd_usrp_sink_0_0.set_time_unknown_pps(uhd.time_spec()) self.uhd_usrp_sink_0_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0_0.set_center_freq(cent_freq, 0) self.uhd_usrp_sink_0_0.set_gain(rf_gain, 0) self.uhd_usrp_sink_0_0.set_antenna("TX/RX", 0) self.uhd_usrp_sink_0_0.set_bandwidth(bandwidth, 0) self.uhd_usrp_sink_0_0.set_center_freq(cent_freq, 1) self.uhd_usrp_sink_0_0.set_gain(rf_gain, 1) self.uhd_usrp_sink_0_0.set_antenna("TX/RX", 1) self.uhd_usrp_sink_0_0.set_bandwidth(bandwidth, 1) self.uhd_usrp_sink_0_0.set_center_freq(cent_freq, 2) self.uhd_usrp_sink_0_0.set_gain(rf_gain, 2) self.uhd_usrp_sink_0_0.set_antenna("TX/RX", 2) self.uhd_usrp_sink_0_0.set_bandwidth(bandwidth, 2) self.uhd_usrp_sink_0_0.set_center_freq(cent_freq, 3) self.uhd_usrp_sink_0_0.set_gain(rf_gain, 3) self.uhd_usrp_sink_0_0.set_bandwidth(bandwidth, 3) self.qtgui_sink_x_0_0_0 = qtgui.sink_c( fft_size, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype cent_freq, #fc samp_rate, #bw "177", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0_0_0.set_update_time(1.0/10) self._qtgui_sink_x_0_0_0_win = sip.wrapinstance(self.qtgui_sink_x_0_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_0_0_win) self.qtgui_sink_x_0_0_0.enable_rf_freq(False) self.blocks_skiphead_0_0_0 = blocks.skiphead(gr.sizeof_gr_complex*1, 1*samp_rate) self.blocks_multiply_xx_0_0_0_1 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0_0_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0_0_0_0_0_1 = blocks.multiply_const_vcc((const, )) self.blocks_multiply_const_vxx_0_0_0_0_0_0 = blocks.multiply_const_vcc((const, )) self.blocks_multiply_const_vxx_0_0_0_0_0 = blocks.multiply_const_vcc((const, )) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc((const, )) self.blocks_magphase_to_complex_0_0_0_1 = blocks.magphase_to_complex(1) self.blocks_magphase_to_complex_0_0_0_0 = blocks.magphase_to_complex(1) self.blocks_magphase_to_complex_0_0_0 = blocks.magphase_to_complex(1) self.blocks_file_source_0_1_0_0_0_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/sdr/Desktop/Pedram/D2D_wo_ext_clk/signals/nr_bf_tx_3.dat", True) self.blocks_file_source_0_1_0_0_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/sdr/Desktop/Pedram/D2D_wo_ext_clk/signals/nr_bf_tx_2.dat", True) self.blocks_file_source_0_1_0_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/sdr/Desktop/Pedram/D2D_wo_ext_clk/signals/nr_bf_tx_1.dat", True) self.blocks_file_source_0_1_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/sdr/Desktop/Pedram/D2D_wo_ext_clk/signals/nr_bf_tx_0.dat", True) self.analog_const_source_x_0_1_0_1 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1) self.analog_const_source_x_0_1_0_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1) self.analog_const_source_x_0_1_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1) self.analog_const_source_x_0_0_0_0_1 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, phase_offset1) self.analog_const_source_x_0_0_0_0_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, phase_offset2) self.analog_const_source_x_0_0_0_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, phase_offset3) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0_0_0_0, 0), (self.blocks_magphase_to_complex_0_0_0, 1)) self.connect((self.analog_const_source_x_0_0_0_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0, 1)) self.connect((self.analog_const_source_x_0_0_0_0_1, 0), (self.blocks_magphase_to_complex_0_0_0_1, 1)) self.connect((self.analog_const_source_x_0_1_0, 0), (self.blocks_magphase_to_complex_0_0_0, 0)) self.connect((self.analog_const_source_x_0_1_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0, 0)) self.connect((self.analog_const_source_x_0_1_0_1, 0), (self.blocks_magphase_to_complex_0_0_0_1, 0)) self.connect((self.blocks_file_source_0_1_0_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.blocks_file_source_0_1_0_0_0, 0), (self.blocks_multiply_xx_0_0_0_1, 0)) self.connect((self.blocks_file_source_0_1_0_0_0_0, 0), (self.blocks_multiply_xx_0_0_0_0, 0)) self.connect((self.blocks_file_source_0_1_0_0_0_0_0, 0), (self.blocks_multiply_xx_0_0_0, 0)) self.connect((self.blocks_magphase_to_complex_0_0_0, 0), (self.blocks_multiply_xx_0_0_0, 1)) self.connect((self.blocks_magphase_to_complex_0_0_0_0, 0), (self.blocks_multiply_xx_0_0_0_0, 1)) self.connect((self.blocks_magphase_to_complex_0_0_0_1, 0), (self.blocks_multiply_xx_0_0_0_1, 1)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.uhd_usrp_sink_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0_0_0_0, 0), (self.uhd_usrp_sink_0_0, 3)) self.connect((self.blocks_multiply_const_vxx_0_0_0_0_0_0, 0), (self.uhd_usrp_sink_0_0, 2)) self.connect((self.blocks_multiply_const_vxx_0_0_0_0_0_1, 0), (self.uhd_usrp_sink_0_0, 1)) self.connect((self.blocks_multiply_xx_0_0_0, 0), (self.blocks_multiply_const_vxx_0_0_0_0_0, 0)) self.connect((self.blocks_multiply_xx_0_0_0_0, 0), (self.blocks_multiply_const_vxx_0_0_0_0_0_0, 0)) self.connect((self.blocks_multiply_xx_0_0_0_1, 0), (self.blocks_multiply_const_vxx_0_0_0_0_0_1, 0)) self.connect((self.blocks_skiphead_0_0_0, 0), (self.qtgui_sink_x_0_0_0, 0)) self.connect((self.uhd_usrp_source_0_0, 0), (self.blocks_skiphead_0_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "onedimension_simulation") Qt.QWidget.__init__(self) self.setWindowTitle("onedimension_simulation") 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", "onedimension_simulation") 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.maxtheta = maxtheta = 150 self.columns = columns = 100 self.shiftarrL = shiftarrL = np.radians(np.linspace(start=maxtheta, stop=0, num=int(columns/2), endpoint=False)) self.variable_function_probe_0_0 = variable_function_probe_0_0 = 0 self.variable_function_probe_0 = variable_function_probe_0 = 1 self.left = left = np.pad(shiftarrL, (0, int(columns/2)), 'constant') self.degreesTXR = degreesTXR = 0 self.degreesTXL = degreesTXL = 0 self.variable_qtgui_label_0_0_0 = variable_qtgui_label_0_0_0 = variable_function_probe_0_0 self.variable_qtgui_label_0_0 = variable_qtgui_label_0_0 = variable_function_probe_0 self.scale = scale = 55 self.samp_rate = samp_rate = 64000 self.rows = rows = 100 self.right = right = np.flip(left, axis=0) self.angle_radiansStartR = angle_radiansStartR = (math.pi/180) * degreesTXR self.angle_radiansStartL = angle_radiansStartL = (math.pi/180) * degreesTXL ################################################## # Blocks ################################################## self._scale_range = Range(0, 100, 5, 55, 200) self._scale_win = RangeWidget(self._scale_range, self.set_scale, 'scale', "counter_slider", float) self.top_grid_layout.addWidget(self._scale_win) self.blocks_probe_signal_x_0_0 = blocks.probe_signal_f() self.blocks_probe_signal_x_0 = blocks.probe_signal_f() self.video_sdl_sink_1 = video_sdl.sink_s(0, columns, rows, 0, columns*6, rows*6) self._variable_qtgui_label_0_0_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_0_0_formatter = None else: self._variable_qtgui_label_0_0_0_formatter = lambda x: str(x) self._variable_qtgui_label_0_0_0_tool_bar.addWidget(Qt.QLabel('Probe Signal Min' + ": ")) self._variable_qtgui_label_0_0_0_label = Qt.QLabel(str(self._variable_qtgui_label_0_0_0_formatter(self.variable_qtgui_label_0_0_0))) self._variable_qtgui_label_0_0_0_tool_bar.addWidget(self._variable_qtgui_label_0_0_0_label) self.top_grid_layout.addWidget(self._variable_qtgui_label_0_0_0_tool_bar) self._variable_qtgui_label_0_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_0_formatter = None else: self._variable_qtgui_label_0_0_formatter = lambda x: str(x) self._variable_qtgui_label_0_0_tool_bar.addWidget(Qt.QLabel('Probe Signal Max' + ": ")) self._variable_qtgui_label_0_0_label = Qt.QLabel(str(self._variable_qtgui_label_0_0_formatter(self.variable_qtgui_label_0_0))) self._variable_qtgui_label_0_0_tool_bar.addWidget(self._variable_qtgui_label_0_0_label) self.top_grid_layout.addWidget(self._variable_qtgui_label_0_0_tool_bar) def _variable_function_probe_0_0_probe(): while True: val = self.blocks_probe_signal_x_0_0.level() try: self.set_variable_function_probe_0_0(val) except AttributeError: pass time.sleep(1.0 / (1)) _variable_function_probe_0_0_thread = threading.Thread(target=_variable_function_probe_0_0_probe) _variable_function_probe_0_0_thread.daemon = True _variable_function_probe_0_0_thread.start() def _variable_function_probe_0_probe(): while True: val = self.blocks_probe_signal_x_0.level() try: self.set_variable_function_probe_0(val) except AttributeError: pass time.sleep(1.0 / (1)) _variable_function_probe_0_thread = threading.Thread(target=_variable_function_probe_0_probe) _variable_function_probe_0_thread.daemon = True _variable_function_probe_0_thread.start() self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f( samp_rate, columns, rows, [], [], "", 1 ) self.qtgui_time_raster_sink_x_0.set_update_time(0.01) self.qtgui_time_raster_sink_x_0.set_intensity_range(0, 5) self.qtgui_time_raster_sink_x_0.enable_grid(False) self.qtgui_time_raster_sink_x_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [1, 1, 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_time_raster_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i]) self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance(self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_raster_sink_x_0_win) self._degreesTXR_range = Range(0, maxtheta/2, 5, 0, 200) self._degreesTXR_win = RangeWidget(self._degreesTXR_range, self.set_degreesTXR, 'degreesTXR', "counter_slider", float) self.top_grid_layout.addWidget(self._degreesTXR_win) self._degreesTXL_range = Range(0, maxtheta/2, 5, 0, 200) self._degreesTXL_win = RangeWidget(self._degreesTXL_range, self.set_degreesTXL, 'degreesTXL', "counter_slider", float) self.top_grid_layout.addWidget(self._degreesTXL_win) self.blocks_vector_source_x_0_0_0_0 = blocks.vector_source_f(right, True, 1, []) self.blocks_vector_source_x_0_0_0 = blocks.vector_source_f(left, True, 1, []) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_sub_xx_0_0_0 = blocks.sub_ff(1) self.blocks_sub_xx_0_0 = blocks.sub_ff(1) self.blocks_stream_to_vector_0_1 = blocks.stream_to_vector(gr.sizeof_float*1, samp_rate) self.blocks_repeat_0_0_0_0_1 = blocks.repeat(gr.sizeof_float*1, columns) self.blocks_repeat_0_0_0_0_0_1 = blocks.repeat(gr.sizeof_float*1, columns) self.blocks_repeat_0_0_0_0_0 = blocks.repeat(gr.sizeof_float*1, columns) self.blocks_repeat_0_0_0_0 = blocks.repeat(gr.sizeof_float*1, columns) self.blocks_multiply_const_vxx_0_0_1 = blocks.multiply_const_cc(complex(math.cos(angle_radiansStartR),math.sin(angle_radiansStartR))) self.blocks_multiply_const_vxx_0_0_0_0 = blocks.multiply_const_cc(complex(math.cos(angle_radiansStartL),math.sin(angle_radiansStartL))) self.blocks_min_xx_0 = blocks.min_ff(samp_rate,1) self.blocks_max_xx_0 = blocks.max_ff(samp_rate, 1) self.blocks_magphase_to_complex_0_0_0_0_0 = blocks.magphase_to_complex(1) self.blocks_magphase_to_complex_0_0_0_0 = blocks.magphase_to_complex(1) self.blocks_float_to_short_0 = blocks.float_to_short(1, scale) self.blocks_complex_to_magphase_0_0_0_0 = blocks.complex_to_magphase(1) self.blocks_complex_to_magphase_0_0_0 = blocks.complex_to_magphase(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 1e3, 1, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_throttle_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_float_to_short_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_stream_to_vector_0_1, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.qtgui_time_raster_sink_x_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0, 0), (self.blocks_repeat_0_0_0_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0, 1), (self.blocks_repeat_0_0_0_0_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_0, 1), (self.blocks_repeat_0_0_0_0_0_1, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_0, 0), (self.blocks_repeat_0_0_0_0_1, 0)) self.connect((self.blocks_float_to_short_0, 0), (self.video_sdl_sink_1, 0)) self.connect((self.blocks_magphase_to_complex_0_0_0_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_magphase_to_complex_0_0_0_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_max_xx_0, 0), (self.blocks_probe_signal_x_0, 0)) self.connect((self.blocks_min_xx_0, 0), (self.blocks_probe_signal_x_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0_0_0, 0), (self.blocks_complex_to_magphase_0_0_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0_1, 0), (self.blocks_complex_to_magphase_0_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_0, 0), (self.blocks_sub_xx_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_0_1, 0), (self.blocks_sub_xx_0_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_1, 0), (self.blocks_magphase_to_complex_0_0_0_0_0, 0)) self.connect((self.blocks_stream_to_vector_0_1, 0), (self.blocks_max_xx_0, 0)) self.connect((self.blocks_stream_to_vector_0_1, 0), (self.blocks_min_xx_0, 0)) self.connect((self.blocks_sub_xx_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0, 1)) self.connect((self.blocks_sub_xx_0_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0_0, 1)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_0_0_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_0_0_1, 0)) self.connect((self.blocks_vector_source_x_0_0_0, 0), (self.blocks_sub_xx_0_0, 1)) self.connect((self.blocks_vector_source_x_0_0_0_0, 0), (self.blocks_sub_xx_0_0_0, 1))
def __init__(self): gr.top_block.__init__(self, "twodimension_usrp_b210s") Qt.QWidget.__init__(self) self.setWindowTitle("twodimension_usrp_b210s") 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", "twodimension_usrp_b210s") 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.maxtheta = maxtheta = 150 self.columns = columns = 100 self.shiftarrL = shiftarrL = np.radians( np.linspace(start=maxtheta, stop=0, num=int(columns / 2), endpoint=False)) self.left = left = np.pad(shiftarrL, (0, int(columns / 2)), 'constant') self.variable_function_probe_0_0 = variable_function_probe_0_0 = 0 self.variable_function_probe_0 = variable_function_probe_0 = 1 self.right = right = np.flip(left, axis=0) self.variable_qtgui_label_0_0_0_0 = variable_qtgui_label_0_0_0_0 = variable_function_probe_0_0 self.variable_qtgui_label_0_0_0 = variable_qtgui_label_0_0_0 = variable_function_probe_0 self.variable_qtgui_label_0_0 = variable_qtgui_label_0_0 = left self.variable_qtgui_label_0 = variable_qtgui_label_0 = right self.threshold = threshold = -60 self.scale = scale = 20000 self.samp_rate = samp_rate = 100e3 self.minmag = minmag = 0 self.maxmag = maxmag = .0035 self.keep = keep = 50 self.gain = gain = 20 self.freq = freq = 422e6 self.displayscale = displayscale = 5 ################################################## # 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, 'Time rasters') 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, 'Steering vectors') self.top_grid_layout.addWidget(self.tab) self._scale_range = Range(0, 60000, 1000, 20000, 200) self._scale_win = RangeWidget(self._scale_range, self.set_scale, 'scale', "counter_slider", float) self.top_grid_layout.addWidget(self._scale_win) self.blocks_probe_signal_x_0_0 = blocks.probe_signal_f() self.blocks_probe_signal_x_0 = blocks.probe_signal_f() self.video_sdl_sink_1_1_0 = video_sdl.sink_s(0, columns, columns, 0, columns * displayscale, columns * displayscale) self._variable_qtgui_label_0_0_0_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_0_0_0_formatter = None else: self._variable_qtgui_label_0_0_0_0_formatter = lambda x: str(x) self._variable_qtgui_label_0_0_0_0_tool_bar.addWidget( Qt.QLabel('Probe Signal Min' + ": ")) self._variable_qtgui_label_0_0_0_0_label = Qt.QLabel( str( self._variable_qtgui_label_0_0_0_0_formatter( self.variable_qtgui_label_0_0_0_0))) self._variable_qtgui_label_0_0_0_0_tool_bar.addWidget( self._variable_qtgui_label_0_0_0_0_label) self.top_grid_layout.addWidget( self._variable_qtgui_label_0_0_0_0_tool_bar) self._variable_qtgui_label_0_0_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_0_0_formatter = None else: self._variable_qtgui_label_0_0_0_formatter = lambda x: str(x) self._variable_qtgui_label_0_0_0_tool_bar.addWidget( Qt.QLabel('Probe Signal Max' + ": ")) self._variable_qtgui_label_0_0_0_label = Qt.QLabel( str( self._variable_qtgui_label_0_0_0_formatter( self.variable_qtgui_label_0_0_0))) self._variable_qtgui_label_0_0_0_tool_bar.addWidget( self._variable_qtgui_label_0_0_0_label) self.top_grid_layout.addWidget( self._variable_qtgui_label_0_0_0_tool_bar) self._variable_qtgui_label_0_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_0_formatter = None else: self._variable_qtgui_label_0_0_formatter = lambda x: repr(x) self._variable_qtgui_label_0_0_tool_bar.addWidget( Qt.QLabel('variable_qtgui_label_0_0' + ": ")) self._variable_qtgui_label_0_0_label = Qt.QLabel( str( self._variable_qtgui_label_0_0_formatter( self.variable_qtgui_label_0_0))) self._variable_qtgui_label_0_0_tool_bar.addWidget( self._variable_qtgui_label_0_0_label) self.tab_layout_1.addWidget(self._variable_qtgui_label_0_0_tool_bar) self._variable_qtgui_label_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_formatter = None else: self._variable_qtgui_label_0_formatter = lambda x: repr(x) self._variable_qtgui_label_0_tool_bar.addWidget( Qt.QLabel('variable_qtgui_label_0' + ": ")) self._variable_qtgui_label_0_label = Qt.QLabel( str( self._variable_qtgui_label_0_formatter( self.variable_qtgui_label_0))) self._variable_qtgui_label_0_tool_bar.addWidget( self._variable_qtgui_label_0_label) self.tab_layout_1.addWidget(self._variable_qtgui_label_0_tool_bar) def _variable_function_probe_0_0_probe(): while True: val = self.blocks_probe_signal_x_0_0.level() try: self.set_variable_function_probe_0_0(val) except AttributeError: pass time.sleep(1.0 / (1)) _variable_function_probe_0_0_thread = threading.Thread( target=_variable_function_probe_0_0_probe) _variable_function_probe_0_0_thread.daemon = True _variable_function_probe_0_0_thread.start() def _variable_function_probe_0_probe(): while True: val = self.blocks_probe_signal_x_0.level() try: self.set_variable_function_probe_0(val) except AttributeError: pass time.sleep(1.0 / (1)) _variable_function_probe_0_thread = threading.Thread( target=_variable_function_probe_0_probe) _variable_function_probe_0_thread.daemon = True _variable_function_probe_0_thread.start() self.uhd_usrp_source_0_0 = uhd.usrp_source( ",".join(("", "type=b200, name=origb210")), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0, 2)), ), ) self.uhd_usrp_source_0_0.set_center_freq(freq, 0) self.uhd_usrp_source_0_0.set_gain(gain, 0) self.uhd_usrp_source_0_0.set_antenna('RX2', 0) self.uhd_usrp_source_0_0.set_center_freq(freq, 1) self.uhd_usrp_source_0_0.set_gain(gain, 1) self.uhd_usrp_source_0_0.set_antenna('RX2', 1) self.uhd_usrp_source_0_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0_0.set_time_unknown_pps(uhd.time_spec()) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "type=b200, name=newb210")), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0, 2)), ), ) self.uhd_usrp_source_0.set_center_freq(freq, 0) self.uhd_usrp_source_0.set_gain(gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.uhd_usrp_source_0.set_center_freq(freq, 1) self.uhd_usrp_source_0.set_gain(gain, 1) self.uhd_usrp_source_0.set_antenna('RX2', 1) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_time_unknown_pps(uhd.time_spec()) self._threshold_range = Range(-160, -10, 5, -60, 200) self._threshold_win = RangeWidget(self._threshold_range, self.set_threshold, 'squelch threshold', "counter_slider", int) self.top_grid_layout.addWidget(self._threshold_win) self.qtgui_time_raster_sink_x_0_0 = qtgui.time_raster_sink_f( samp_rate / keep, columns, columns, [], [], "Elevation", 1) self.qtgui_time_raster_sink_x_0_0.set_update_time(0.01) self.qtgui_time_raster_sink_x_0_0.set_intensity_range(minmag, maxmag) self.qtgui_time_raster_sink_x_0_0.enable_grid(False) self.qtgui_time_raster_sink_x_0_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 1, 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_time_raster_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_raster_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_raster_sink_x_0_0.set_color_map(i, colors[i]) self.qtgui_time_raster_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_raster_sink_x_0_0_win = sip.wrapinstance( self.qtgui_time_raster_sink_x_0_0.pyqwidget(), Qt.QWidget) self.tab_layout_0.addWidget(self._qtgui_time_raster_sink_x_0_0_win) self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f( samp_rate / keep, columns, columns, [], [], "Azimuth", 1) self.qtgui_time_raster_sink_x_0.set_update_time(0.01) self.qtgui_time_raster_sink_x_0.set_intensity_range(minmag, maxmag) self.qtgui_time_raster_sink_x_0.enable_grid(False) self.qtgui_time_raster_sink_x_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 1, 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_time_raster_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i]) self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance( self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget) self.tab_layout_0.addWidget(self._qtgui_time_raster_sink_x_0_win) self.blocks_vector_to_stream_0 = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, columns) self.blocks_vector_source_x_0_0_0_1 = blocks.vector_source_f( left, True, 1, []) self.blocks_vector_source_x_0_0_0_0_0 = blocks.vector_source_f( right, True, 1, []) self.blocks_vector_source_x_0_0_0_0 = blocks.vector_source_f( right, True, 1, []) self.blocks_vector_source_x_0_0_0 = blocks.vector_source_f( left, True, 1, []) self.blocks_sub_xx_0_0_1 = blocks.sub_ff(1) self.blocks_sub_xx_0_0_0_0 = blocks.sub_ff(1) self.blocks_sub_xx_0_0_0 = blocks.sub_ff(1) self.blocks_sub_xx_0_0 = blocks.sub_ff(1) self.blocks_stream_to_vector_0_1 = blocks.stream_to_vector( gr.sizeof_float * 1, int(samp_rate / keep)) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, columns) self.blocks_repeat_0_0_0_0_2 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0_1_0 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0_1 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0_0_1_0 = blocks.repeat( gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0_0_1 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0_0_0 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0_0 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0_0_0 = blocks.repeat(gr.sizeof_float * 1, columns) self.blocks_repeat_0_0 = blocks.repeat(gr.sizeof_gr_complex * columns, columns) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1, columns) self.blocks_min_xx_0 = blocks.min_ff(int(samp_rate / keep), 1) self.blocks_max_xx_0 = blocks.max_ff(int(samp_rate / keep), 1) self.blocks_magphase_to_complex_0_0_0_0_1 = blocks.magphase_to_complex( 1) self.blocks_magphase_to_complex_0_0_0_0_0_0 = blocks.magphase_to_complex( 1) self.blocks_magphase_to_complex_0_0_0_0_0 = blocks.magphase_to_complex( 1) self.blocks_magphase_to_complex_0_0_0_0 = blocks.magphase_to_complex(1) self.blocks_keep_one_in_n_0_2 = blocks.keep_one_in_n( gr.sizeof_gr_complex * 1, keep) self.blocks_keep_one_in_n_0_1 = blocks.keep_one_in_n( gr.sizeof_gr_complex * 1, keep) self.blocks_keep_one_in_n_0_0 = blocks.keep_one_in_n( gr.sizeof_gr_complex * 1, keep) self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n( gr.sizeof_gr_complex * 1, keep) self.blocks_float_to_short_0_1_0 = blocks.float_to_short(1, scale) self.blocks_complex_to_magphase_0_0_0_1 = blocks.complex_to_magphase(1) self.blocks_complex_to_magphase_0_0_0_0_0 = blocks.complex_to_magphase( 1) self.blocks_complex_to_magphase_0_0_0_0 = blocks.complex_to_magphase(1) self.blocks_complex_to_magphase_0_0_0 = blocks.complex_to_magphase(1) self.blocks_complex_to_mag_squared_0_1 = blocks.complex_to_mag_squared( 1) self.blocks_complex_to_mag_squared_0_0 = blocks.complex_to_mag_squared( 1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_add_xx_1 = blocks.add_vcc(1) self.blocks_add_xx_0_0 = blocks.add_vcc(1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_pwr_squelch_xx_0_1 = analog.pwr_squelch_cc( -60, 1e-4, 0, False) self.analog_pwr_squelch_xx_0_0_0 = analog.pwr_squelch_cc( -60, 1e-4, 0, False) self.analog_pwr_squelch_xx_0_0 = analog.pwr_squelch_cc( -60, 1e-4, 0, False) self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc( -60, 1e-4, 0, False) ################################################## # Connections ################################################## self.connect((self.analog_pwr_squelch_xx_0, 0), (self.blocks_keep_one_in_n_0_0, 0)) self.connect((self.analog_pwr_squelch_xx_0_0, 0), (self.blocks_keep_one_in_n_0, 0)) self.connect((self.analog_pwr_squelch_xx_0_0_0, 0), (self.blocks_keep_one_in_n_0_1, 0)) self.connect((self.analog_pwr_squelch_xx_0_1, 0), (self.blocks_keep_one_in_n_0_2, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_add_xx_0_0, 0), (self.blocks_complex_to_mag_squared_0_0, 0)) self.connect((self.blocks_add_xx_0_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.blocks_add_xx_1, 0), (self.blocks_complex_to_mag_squared_0_1, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.qtgui_time_raster_sink_x_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_0, 0), (self.qtgui_time_raster_sink_x_0_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_1, 0), (self.blocks_float_to_short_0_1_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0_1, 0), (self.blocks_stream_to_vector_0_1, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0, 0), (self.blocks_repeat_0_0_0_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0, 1), (self.blocks_repeat_0_0_0_0_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_0, 1), (self.blocks_repeat_0_0_0_0_0_1, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_0, 0), (self.blocks_repeat_0_0_0_0_1, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_0_0, 1), (self.blocks_repeat_0_0_0_0_0_1_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_0_0, 0), (self.blocks_repeat_0_0_0_0_1_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_1, 1), (self.blocks_repeat_0_0_0_0_0_0, 0)) self.connect((self.blocks_complex_to_magphase_0_0_0_1, 0), (self.blocks_repeat_0_0_0_0_2, 0)) self.connect((self.blocks_float_to_short_0_1_0, 0), (self.video_sdl_sink_1_1_0, 0)) self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_complex_to_magphase_0_0_0, 0)) self.connect((self.blocks_keep_one_in_n_0_0, 0), (self.blocks_complex_to_magphase_0_0_0_0, 0)) self.connect((self.blocks_keep_one_in_n_0_1, 0), (self.blocks_complex_to_magphase_0_0_0_1, 0)) self.connect((self.blocks_keep_one_in_n_0_2, 0), (self.blocks_complex_to_magphase_0_0_0_0_0, 0)) self.connect((self.blocks_magphase_to_complex_0_0_0_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_magphase_to_complex_0_0_0_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_magphase_to_complex_0_0_0_0_0_0, 0), (self.blocks_add_xx_0_0, 1)) self.connect((self.blocks_magphase_to_complex_0_0_0_0_1, 0), (self.blocks_add_xx_0_0, 0)) self.connect((self.blocks_max_xx_0, 0), (self.blocks_probe_signal_x_0, 0)) self.connect((self.blocks_min_xx_0, 0), (self.blocks_probe_signal_x_0_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_add_xx_1, 1)) self.connect((self.blocks_repeat_0_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.blocks_repeat_0_0_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_0, 0), (self.blocks_sub_xx_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_0_0, 0), (self.blocks_sub_xx_0_0_1, 0)) self.connect((self.blocks_repeat_0_0_0_0_0_1, 0), (self.blocks_sub_xx_0_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_0_1_0, 0), (self.blocks_sub_xx_0_0_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_1, 0), (self.blocks_magphase_to_complex_0_0_0_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_1_0, 0), (self.blocks_magphase_to_complex_0_0_0_0_0_0, 0)) self.connect((self.blocks_repeat_0_0_0_0_2, 0), (self.blocks_magphase_to_complex_0_0_0_0_1, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_repeat_0_0, 0)) self.connect((self.blocks_stream_to_vector_0_1, 0), (self.blocks_max_xx_0, 0)) self.connect((self.blocks_stream_to_vector_0_1, 0), (self.blocks_min_xx_0, 0)) self.connect((self.blocks_sub_xx_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0, 1)) self.connect((self.blocks_sub_xx_0_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0_0, 1)) self.connect((self.blocks_sub_xx_0_0_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0_0_0, 1)) self.connect((self.blocks_sub_xx_0_0_1, 0), (self.blocks_magphase_to_complex_0_0_0_0_1, 1)) self.connect((self.blocks_vector_source_x_0_0_0, 0), (self.blocks_sub_xx_0_0, 1)) self.connect((self.blocks_vector_source_x_0_0_0_0, 0), (self.blocks_sub_xx_0_0_0, 1)) self.connect((self.blocks_vector_source_x_0_0_0_0_0, 0), (self.blocks_sub_xx_0_0_0_0, 1)) self.connect((self.blocks_vector_source_x_0_0_0_1, 0), (self.blocks_sub_xx_0_0_1, 1)) self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_add_xx_1, 0)) self.connect((self.uhd_usrp_source_0, 1), (self.analog_pwr_squelch_xx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.analog_pwr_squelch_xx_0_0, 0)) self.connect((self.uhd_usrp_source_0_0, 0), (self.analog_pwr_squelch_xx_0_0_0, 0)) self.connect((self.uhd_usrp_source_0_0, 1), (self.analog_pwr_squelch_xx_0_1, 0))