def __init__(self): gr.top_block.__init__(self, "tutorial_three_1") Qt.QWidget.__init__(self) self.setWindowTitle("tutorial_three_1") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "tutorial_three_1") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry( self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.samp_rate = samp_rate = 107300 ################################################## # Blocks ################################################## self.audio_sink_0 = audio.sink(samp_rate, '', True) self.analog_sig_source_x_1 = analog.sig_source_f( samp_rate, analog.GR_COS_WAVE, 350, 0.1, 0, 0) self.analog_sig_source_x_0 = analog.sig_source_f( samp_rate, analog.GR_COS_WAVE, 440, 0.1, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.audio_sink_0, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.audio_sink_0, 1))
def __init__(self): gr.top_block.__init__(self, "Osmocom Source") Qt.QWidget.__init__(self) self.setWindowTitle("Osmocom Source") 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", "osmocom_source") if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.zwave_freq = zwave_freq = 908.42e6 self.samp_rate = samp_rate = 3e6 self.antenna_0 = antenna_0 = 2.5 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1, decimation=12, taps=None, fractional_bw=None, ) self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + 'airspy=0') self.osmosdr_source_0.set_time_source('gpsdo', 0) self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(zwave_freq, 0) self.osmosdr_source_0.set_freq_corr(0, 0) self.osmosdr_source_0.set_dc_offset_mode(2, 0) self.osmosdr_source_0.set_iq_balance_mode(2, 0) self.osmosdr_source_0.set_gain_mode(True, 0) self.osmosdr_source_0.set_gain(0, 0) self.osmosdr_source_0.set_if_gain(0, 0) self.osmosdr_source_0.set_bb_gain(0, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(20e4, 0) self.comparison_comparison_py_f_0 = comparison.comparison_py_f(0, 0) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_float * 1, 1250000) self.blocks_rms_xx_0 = blocks.rms_cf(0.0001) self.blocks_nlog10_ff_0_0 = blocks.nlog10_ff(20, 1, -14) ################################################## # Connections ################################################## self.connect((self.blocks_nlog10_ff_0_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_rms_xx_0, 0), (self.blocks_nlog10_ff_0_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.comparison_comparison_py_f_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_rms_xx_0, 0))
def __init__(self, address='serial=307B618', freq=2.45e9, freq_offset=0, gain=0, samp_rate=1e6): gr.top_block.__init__(self, "UHD RX DPSK") Qt.QWidget.__init__(self) self.setWindowTitle("UHD RX DPSK") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "uhd_rx_dpsk") if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Parameters ################################################## self.address = address self.freq = freq self.freq_offset = freq_offset self.gain = gain self.samp_rate = samp_rate ################################################## # Variables ################################################## self.tun_gain = tun_gain = 0 self.tun_freq = tun_freq = 2.45e9 self.samps_per_sym = samps_per_sym = 4 self.rx_freq_off = rx_freq_off = 0 self.rolloff = rolloff = .35 self.nfilts = nfilts = 32 ################################################## # Blocks ################################################## self._tun_gain_range = Range(0, 20, 1, 0, 200) self._tun_gain_win = RangeWidget(self._tun_gain_range, self.set_tun_gain, 'UHD Tx Gain', "counter_slider", float) self.top_layout.addWidget(self._tun_gain_win) self._tun_freq_range = Range(2.4e9, 2.5e9, 1, 2.45e9, 200) self._tun_freq_win = RangeWidget(self._tun_freq_range, self.set_tun_freq, 'UHD Freq (Hz)', "counter_slider", float) self.top_layout.addWidget(self._tun_freq_win) self._rx_freq_off_range = Range(-100e3, 100e3, 1, 0, 200) self._rx_freq_off_win = RangeWidget(self._rx_freq_off_range, self.set_rx_freq_off, 'Rx Freq Offset (Hz)', "counter_slider", float) self.top_layout.addWidget(self._rx_freq_off_win) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join((address, "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(tun_freq+rx_freq_off, 0) self.uhd_usrp_source_0.set_gain(tun_gain, 0) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype tun_freq, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.digital_dxpsk_demod_0 = digital.dqpsk_demod( samples_per_symbol=samps_per_sym, excess_bw=0.35, freq_bw=6.28/100.0, phase_bw=6.28/100.0, timing_bw=6.28/100.0, mod_code="gray", verbose=False, log=False ) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char*1) ################################################## # Connections ################################################## self.connect((self.digital_dxpsk_demod_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.digital_dxpsk_demod_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_freq_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "Not titled yet") Qt.QWidget.__init__(self) self.setWindowTitle("Not titled yet") 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", "send") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry( self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.samp_rate = samp_rate = 25e5 self.payload = payload = np.load("payload.npy") self.padding = padding = list(np.zeros(32)) self.carrier = carrier = 915552 ################################################## # Blocks ################################################## self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 433e6, #fc samp_rate, #bw "", #name True, #plotfreq True, #plotwaterfall True, #plottime True #plotconst ) self.qtgui_sink_x_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_win = sip.wrapinstance( self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) self.qtgui_sink_x_0.enable_rf_freq(False) self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win) self.blocks_vector_source_x_0 = blocks.vector_source_c( payload, True, 1, []) self.blocks_vector_insert_x_0 = blocks.vector_insert_c( padding, len(payload) + len(padding), 0) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1, 1250) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, carrier, 1, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_vector_insert_x_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_vector_insert_x_0, 0))
def initUI(self): self.qgroupbox_MUX_vco = Qt.QGroupBox('Select connection to VCO') self.qgroupbox_MUX_vco.setAutoFillBackground(True) MUX_vco = Qt.QGridLayout() self.qradio_VCO_to_DAC0 = Qt.QRadioButton('VCO connected to DAC A') self.qradio_VCO_to_DAC1 = Qt.QRadioButton('VCO connected to DAC B') self.qradio_no_VCO = Qt.QRadioButton('No VCO connected') self.qradio_no_VCO.setChecked(True) self.qradio_VCO_to_DAC0.clicked.connect(self.mux_vco_Action) self.qradio_VCO_to_DAC1.clicked.connect(self.mux_vco_Action) self.qradio_no_VCO.clicked.connect(self.mux_vco_Action) self.qlabel_int_vco_amplitude = Qt.QLabel( 'Internal VCO Amplitude [0-1]') self.qedit_int_vco_amplitude = user_friendly_QLineEdit('0.5') self.qedit_int_vco_amplitude.returnPressed.connect( self.setInternalVCO_amplitude) self.qedit_int_vco_amplitude.setMaximumWidth(60) self.qlabel_int_vco_offset = Qt.QLabel('Internal VCO offset [0-1]') self.qedit_int_vco_offset = user_friendly_QLineEdit('0.0') self.qedit_int_vco_offset.returnPressed.connect( self.setInternalVCO_offset) self.qedit_int_vco_offset.setMaximumWidth(60) MUX_vco.addWidget(self.qradio_VCO_to_DAC0, 0, 0) MUX_vco.addWidget(self.qradio_VCO_to_DAC1, 1, 0) MUX_vco.addWidget(self.qradio_no_VCO, 2, 0) MUX_vco.addWidget(self.qlabel_int_vco_offset, 1, 1) MUX_vco.addWidget(self.qedit_int_vco_offset, 1, 2) MUX_vco.addWidget(self.qlabel_int_vco_amplitude, 2, 1) MUX_vco.addWidget(self.qedit_int_vco_amplitude, 2, 2) MUX_vco.addItem( Qt.QSpacerItem(0, 0, Qt.QSizePolicy.MinimumExpanding, Qt.QSizePolicy.Minimum), 2, 0) MUX_vco.setRowStretch(2, 2) self.qgroupbox_MUX_vco.setLayout(MUX_vco) ################################################################################### self.qgroupbox_MUX_pll2 = Qt.QGroupBox('Select connection to PLL 2') self.qgroupbox_MUX_pll2.setAutoFillBackground(True) MUX_pll2 = Qt.QGridLayout() self.qradio_ddc1_to_pll2 = Qt.QRadioButton( 'DDC_a output to PLL_b input') self.qradio_pll1_to_pll2 = Qt.QRadioButton( 'PLL_a output to PLL_b input') self.qradio_ddc2_to_pll2 = Qt.QRadioButton( 'DDC_b output to PLL_b input') self.qradio_ddc2_to_pll2.setChecked(True) self.qradio_pll1_to_pll2.clicked.connect(self.mux_pll2_Action) self.qradio_ddc1_to_pll2.clicked.connect(self.mux_pll2_Action) self.qradio_ddc2_to_pll2.clicked.connect(self.mux_pll2_Action) MUX_pll2.addWidget(self.qradio_ddc1_to_pll2, 0, 0) MUX_pll2.addWidget(self.qradio_pll1_to_pll2, 1, 0) MUX_pll2.addWidget(self.qradio_ddc2_to_pll2, 2, 0) MUX_pll2.setRowStretch(2, 0) self.qgroupbox_MUX_pll2.setLayout(MUX_pll2) ################################################################################### self.qgroupbox_read_data = Qt.QGroupBox( 'Read data from dpll (channel 2)') self.qgroupbox_read_data.setAutoFillBackground(True) read_data = Qt.QGridLayout() self.qlabel_addr = Qt.QLabel('Address: 0x') self.qedit_addr = user_friendly_QLineEdit('9000') self.qedit_addr.setMaximumWidth(100) self.qlabel_data = Qt.QLabel('Data:') self.qedit_data = user_friendly_QLineEdit('0') self.qedit_data.setMaximumWidth(300) self.qbtn_1 = QtGui.QPushButton('Read data') self.qbtn_1.clicked.connect(self.read_RP) read_data.addWidget(self.qlabel_addr, 0, 0) read_data.addWidget(self.qedit_addr, 0, 1) read_data.addWidget(self.qlabel_data, 1, 0) read_data.addWidget(self.qedit_data, 1, 1, 1, 2) read_data.addWidget(self.qbtn_1, 0, 2) read_data.setRowStretch(1, 2) self.qgroupbox_read_data.setLayout(read_data) ################################################################################### self.qgroupbox_fanUI = Qt.QGroupBox('Turn on/off fan') self.qgroupbox_fanUI.setAutoFillBackground(True) fanUI = Qt.QGridLayout() self.qradio_fan_on = Qt.QRadioButton('Fan on') self.qradio_fan_off = Qt.QRadioButton('Fan off') self.qradio_fan_on.setChecked(True) self.qradio_fan_on.clicked.connect(self.setFan) self.qradio_fan_off.clicked.connect(self.setFan) fanUI.addWidget(self.qradio_fan_on, 0, 0) fanUI.addWidget(self.qradio_fan_off, 1, 0) #fanUI.setRowStretch(2, 2) self.qgroupbox_fanUI.setLayout(fanUI) ################################################################################### self.qbtn_reconnect = QtGui.QPushButton('Open communication menu') self.qbtn_reconnect.clicked.connect(self.communication_menu) ################################################################################### self.group = Qt.QGroupBox('RP configuration') self.group.setAutoFillBackground(True) group = Qt.QGridLayout() group.addWidget(self.qgroupbox_MUX_vco, 0, 0, 2, 4) group.addWidget(self.qgroupbox_MUX_pll2, 3, 0, 2, 4) group.addWidget(self.qgroupbox_read_data, 6, 0, 2, 4) group.addWidget(self.qgroupbox_fanUI, 8, 0, 1, 1) group.addWidget(self.qbtn_reconnect, 8, 1, 1, 2) #vbox = Qt.QVBoxLayout() #vbox.addStretch(1) self.group.setLayout(group) grid = Qt.QGridLayout() grid.addWidget(self.group) self.setLayout(grid) #self.center() self.setWindowTitle(self.custom_shorthand + ': RP Configuration')
def __init__(self): gr.top_block.__init__(self, "NSF Watch SDR") Qt.QWidget.__init__(self) self.setWindowTitle("NSF Watch SDR") 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", "NsfWatch24") self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.ObsName = ObsName = "Integrate24" self.ConfigFile = ConfigFile = ObsName + ".conf" self._Frequencys_config = ConfigParser.ConfigParser() self._Frequencys_config.read(ConfigFile) try: Frequencys = self._Frequencys_config.getfloat('main', 'Frequency') except: Frequencys = 1420.4e6 self.Frequencys = Frequencys self._Bandwidths_config = ConfigParser.ConfigParser() self._Bandwidths_config.read(ConfigFile) try: Bandwidths = self._Bandwidths_config.getfloat('main', 'Bandwidth') except: Bandwidths = 2.4e6 self.Bandwidths = Bandwidths self._telescope_save_config = ConfigParser.ConfigParser() self._telescope_save_config.read(ConfigFile) try: telescope_save = self._telescope_save_config.get( 'main', 'telescope') except: telescope_save = 'Bubble Wrap Horn' self.telescope_save = telescope_save self._observers_save_config = ConfigParser.ConfigParser() self._observers_save_config.read(ConfigFile) try: observers_save = self._observers_save_config.get( 'main', 'observers') except: observers_save = 'Science Aficionado' self.observers_save = observers_save self._nAves_config = ConfigParser.ConfigParser() self._nAves_config.read(ConfigFile) try: nAves = self._nAves_config.getint('main', 'nave') except: nAves = 20 self.nAves = nAves self._fftsize_save_config = ConfigParser.ConfigParser() self._fftsize_save_config.read(ConfigFile) try: fftsize_save = self._fftsize_save_config.getint('main', 'fftsize') except: fftsize_save = 1024 self.fftsize_save = fftsize_save self._device_save_config = ConfigParser.ConfigParser() self._device_save_config.read(ConfigFile) try: device_save = self._device_save_config.get('main', 'device') except: device_save = 'airspy,bias=1,pack=1' self.device_save = device_save self._Gain3s_config = ConfigParser.ConfigParser() self._Gain3s_config.read(ConfigFile) try: Gain3s = self._Gain3s_config.getfloat('main', 'gain3') except: Gain3s = 14. self.Gain3s = Gain3s self._Gain2s_config = ConfigParser.ConfigParser() self._Gain2s_config.read(ConfigFile) try: Gain2s = self._Gain2s_config.getfloat('main', 'gain2') except: Gain2s = 14. self.Gain2s = Gain2s self._Gain1s_config = ConfigParser.ConfigParser() self._Gain1s_config.read(ConfigFile) try: Gain1s = self._Gain1s_config.getfloat('main', 'gain1') except: Gain1s = 49. self.Gain1s = Gain1s self.Frequency = Frequency = Frequencys self._Elevation_save_config = ConfigParser.ConfigParser() self._Elevation_save_config.read(ConfigFile) try: Elevation_save = self._Elevation_save_config.getfloat( 'main', 'elevation') except: Elevation_save = 90. self.Elevation_save = Elevation_save self.Bandwidth = Bandwidth = Bandwidths self._Azimuth_save_config = ConfigParser.ConfigParser() self._Azimuth_save_config.read(ConfigFile) try: Azimuth_save = self._Azimuth_save_config.getfloat( 'main', 'azimuth') except: Azimuth_save = 90. self.Azimuth_save = Azimuth_save self.observer = observer = observers_save self.numin = numin = (Frequency - (Bandwidth / 2.)) self.nsigma = nsigma = 5.0 self.nAve = nAve = nAves self.fftsize = fftsize = fftsize_save self.Telescope = Telescope = telescope_save self.Record = Record = 0 self.H1 = H1 = 1420.406E6 self.Gain3 = Gain3 = Gain3s self.Gain2 = Gain2 = Gain2s self.Gain1 = Gain1 = Gain1s self.EventMode = EventMode = False self.Elevation = Elevation = Elevation_save self.Device = Device = device_save self.Azimuth = Azimuth = Azimuth_save ################################################## # Blocks ################################################## self._observer_tool_bar = Qt.QToolBar(self) self._observer_tool_bar.addWidget(Qt.QLabel('Who' + ": ")) self._observer_line_edit = Qt.QLineEdit(str(self.observer)) self._observer_tool_bar.addWidget(self._observer_line_edit) self._observer_line_edit.returnPressed.connect( lambda: self.set_observer(str(str(self._observer_line_edit.text())) )) self.top_grid_layout.addWidget(self._observer_tool_bar, 0, 0, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._nsigma_range = Range(0., 10., .1, 5.0, 100) self._nsigma_win = RangeWidget(self._nsigma_range, self.set_nsigma, 'N Sigma', "counter", float) self.top_grid_layout.addWidget(self._nsigma_win, 4, 5, 1, 3) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 8): self.top_grid_layout.setColumnStretch(c, 1) self._nAve_tool_bar = Qt.QToolBar(self) self._nAve_tool_bar.addWidget(Qt.QLabel('N_Ave.' + ": ")) self._nAve_line_edit = Qt.QLineEdit(str(self.nAve)) self._nAve_tool_bar.addWidget(self._nAve_line_edit) self._nAve_line_edit.returnPressed.connect( lambda: self.set_nAve(int(str(self._nAve_line_edit.text())))) self.top_grid_layout.addWidget(self._nAve_tool_bar, 0, 2, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._fftsize_tool_bar = Qt.QToolBar(self) self._fftsize_tool_bar.addWidget(Qt.QLabel('FFT_size' + ": ")) self._fftsize_line_edit = Qt.QLineEdit(str(self.fftsize)) self._fftsize_tool_bar.addWidget(self._fftsize_line_edit) self._fftsize_line_edit.returnPressed.connect( lambda: self.set_fftsize(int(str(self._fftsize_line_edit.text())))) self.top_grid_layout.addWidget(self._fftsize_tool_bar, 1, 2, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._Telescope_tool_bar = Qt.QToolBar(self) self._Telescope_tool_bar.addWidget(Qt.QLabel('Tel' + ": ")) self._Telescope_line_edit = Qt.QLineEdit(str(self.Telescope)) self._Telescope_tool_bar.addWidget(self._Telescope_line_edit) self._Telescope_line_edit.returnPressed.connect( lambda: self.set_Telescope( str(str(self._Telescope_line_edit.text())))) self.top_grid_layout.addWidget(self._Telescope_tool_bar, 1, 0, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) _Record_check_box = Qt.QCheckBox('Write Spectra') self._Record_choices = {True: 1, False: 0} self._Record_choices_inv = dict( (v, k) for k, v in self._Record_choices.iteritems()) self._Record_callback = lambda i: Qt.QMetaObject.invokeMethod( _Record_check_box, "setChecked", Qt.Q_ARG("bool", self._Record_choices_inv[i])) self._Record_callback(self.Record) _Record_check_box.stateChanged.connect( lambda i: self.set_Record(self._Record_choices[bool(i)])) self.top_grid_layout.addWidget(_Record_check_box, 3, 2, 1, 2) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._Gain3_tool_bar = Qt.QToolBar(self) self._Gain3_tool_bar.addWidget(Qt.QLabel('Gain3' + ": ")) self._Gain3_line_edit = Qt.QLineEdit(str(self.Gain3)) self._Gain3_tool_bar.addWidget(self._Gain3_line_edit) self._Gain3_line_edit.returnPressed.connect(lambda: self.set_Gain3( eng_notation.str_to_num(str(self._Gain3_line_edit.text())))) self.top_grid_layout.addWidget(self._Gain3_tool_bar, 2, 6, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self._Gain2_tool_bar = Qt.QToolBar(self) self._Gain2_tool_bar.addWidget(Qt.QLabel('Gain2' + ": ")) self._Gain2_line_edit = Qt.QLineEdit(str(self.Gain2)) self._Gain2_tool_bar.addWidget(self._Gain2_line_edit) self._Gain2_line_edit.returnPressed.connect(lambda: self.set_Gain2( eng_notation.str_to_num(str(self._Gain2_line_edit.text())))) self.top_grid_layout.addWidget(self._Gain2_tool_bar, 2, 4, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._Gain1_tool_bar = Qt.QToolBar(self) self._Gain1_tool_bar.addWidget(Qt.QLabel('Gain1' + ": ")) self._Gain1_line_edit = Qt.QLineEdit(str(self.Gain1)) self._Gain1_tool_bar.addWidget(self._Gain1_line_edit) self._Gain1_line_edit.returnPressed.connect(lambda: self.set_Gain1( eng_notation.str_to_num(str(self._Gain1_line_edit.text())))) self.top_grid_layout.addWidget(self._Gain1_tool_bar, 2, 2, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._Frequency_tool_bar = Qt.QToolBar(self) self._Frequency_tool_bar.addWidget(Qt.QLabel('Freq. Hz' + ": ")) self._Frequency_line_edit = Qt.QLineEdit(str(self.Frequency)) self._Frequency_tool_bar.addWidget(self._Frequency_line_edit) self._Frequency_line_edit.returnPressed.connect( lambda: self.set_Frequency( eng_notation.str_to_num(str(self._Frequency_line_edit.text())) )) self.top_grid_layout.addWidget(self._Frequency_tool_bar, 0, 4, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) _EventMode_check_box = Qt.QCheckBox('Write Events') self._EventMode_choices = {True: True, False: False} self._EventMode_choices_inv = dict( (v, k) for k, v in self._EventMode_choices.iteritems()) self._EventMode_callback = lambda i: Qt.QMetaObject.invokeMethod( _EventMode_check_box, "setChecked", Qt.Q_ARG("bool", self._EventMode_choices_inv[i])) self._EventMode_callback(self.EventMode) _EventMode_check_box.stateChanged.connect( lambda i: self.set_EventMode(self._EventMode_choices[bool(i)])) self.top_grid_layout.addWidget(_EventMode_check_box, 3, 0, 1, 2) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Elevation_tool_bar = Qt.QToolBar(self) self._Elevation_tool_bar.addWidget(Qt.QLabel('Elevation' + ": ")) self._Elevation_line_edit = Qt.QLineEdit(str(self.Elevation)) self._Elevation_tool_bar.addWidget(self._Elevation_line_edit) self._Elevation_line_edit.returnPressed.connect( lambda: self.set_Elevation( eng_notation.str_to_num(str(self._Elevation_line_edit.text())) )) self.top_grid_layout.addWidget(self._Elevation_tool_bar, 1, 6, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self._Device_tool_bar = Qt.QToolBar(self) self._Device_tool_bar.addWidget(Qt.QLabel('Dev' + ": ")) self._Device_line_edit = Qt.QLineEdit(str(self.Device)) self._Device_tool_bar.addWidget(self._Device_line_edit) self._Device_line_edit.returnPressed.connect( lambda: self.set_Device(str(str(self._Device_line_edit.text())))) self.top_grid_layout.addWidget(self._Device_tool_bar, 2, 0, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Bandwidth_tool_bar = Qt.QToolBar(self) self._Bandwidth_tool_bar.addWidget(Qt.QLabel('Bandwidth' + ": ")) self._Bandwidth_line_edit = Qt.QLineEdit(str(self.Bandwidth)) self._Bandwidth_tool_bar.addWidget(self._Bandwidth_line_edit) self._Bandwidth_line_edit.returnPressed.connect( lambda: self.set_Bandwidth( eng_notation.str_to_num(str(self._Bandwidth_line_edit.text())) )) self.top_grid_layout.addWidget(self._Bandwidth_tool_bar, 1, 4, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._Azimuth_tool_bar = Qt.QToolBar(self) self._Azimuth_tool_bar.addWidget(Qt.QLabel('Azimuth' + ": ")) self._Azimuth_line_edit = Qt.QLineEdit(str(self.Azimuth)) self._Azimuth_tool_bar.addWidget(self._Azimuth_line_edit) self._Azimuth_line_edit.returnPressed.connect(lambda: self.set_Azimuth( eng_notation.str_to_num(str(self._Azimuth_line_edit.text())))) self.top_grid_layout.addWidget(self._Azimuth_tool_bar, 0, 6, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + Device) self.rtlsdr_source_0.set_sample_rate(float(Bandwidth)) self.rtlsdr_source_0.set_center_freq(float(Frequency), 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(float(Gain1), 0) self.rtlsdr_source_0.set_if_gain(float(Gain2), 0) self.rtlsdr_source_0.set_bb_gain(float(Gain3), 0) self.rtlsdr_source_0.set_antenna('', 0) self.rtlsdr_source_0.set_bandwidth(float(Bandwidth * 1e6), 0) (self.rtlsdr_source_0).set_processor_affinity([3]) self.radio_astro_vmedian_0_0_1_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_1 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_vmedian_0 = radio_astro.vmedian(fftsize, 4) self.radio_astro_ra_event_sink_0 = radio_astro.ra_event_sink( ObsName + "Event.not", 2 * fftsize, Frequency * 1.E-6, Bandwidth * 1.E-6, EventMode, 'Event Detection', 'Observer', Telescope, Device, float(Gain1), Azimuth, Elevation) self.radio_astro_ra_event_log_0 = radio_astro.ra_event_log( '', 'Event Detection', 2 * fftsize, Bandwidth * 1.e-6) self.radio_astro_ra_ascii_sink_0 = radio_astro.ra_ascii_sink( ObsName + ".not", observer, fftsize, Frequency, Bandwidth, Azimuth, Elevation, Record, 0, 4**5, nAve, telescope_save, device_save, float(Gain1), float(Gain2), float(Gain3)) self.radio_astro_detect_0 = radio_astro.detect( 2 * fftsize, nsigma, Frequency, Bandwidth, fftsize * 1.e-6 / Bandwidth, EventMode) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 1) self.qtgui_number_sink_0.set_update_time(1.) self.qtgui_number_sink_0.set_title("") labels = ['T Remains:', '', '', '', '', '', '', '', '', ''] units = ['(s)', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, 0.) self.qtgui_number_sink_0.set_max( i, nAve * fftsize * 1024. / Bandwidth) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance( self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win, 3, 5, 1, 3) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_histogram_sink_x_0 = qtgui.histogram_sink_f( fftsize, 100, -.4, .4, "", 2) self.qtgui_histogram_sink_x_0.set_update_time(1.) self.qtgui_histogram_sink_x_0.enable_autoscale(True) self.qtgui_histogram_sink_x_0.enable_accumulate(False) self.qtgui_histogram_sink_x_0.enable_grid(False) self.qtgui_histogram_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_histogram_sink_x_0.disable_legend() labels = ['I', 'Q', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] 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_histogram_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_histogram_sink_x_0.set_line_label(i, labels[i]) self.qtgui_histogram_sink_x_0.set_line_width(i, widths[i]) self.qtgui_histogram_sink_x_0.set_line_color(i, colors[i]) self.qtgui_histogram_sink_x_0.set_line_style(i, styles[i]) self.qtgui_histogram_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_histogram_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_histogram_sink_x_0_win = sip.wrapinstance( self.qtgui_histogram_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_histogram_sink_x_0_win, 4, 0, 1, 5) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 5): self.top_grid_layout.setColumnStretch(c, 1) self.fft_vxx_0 = fft.fft_vcc(fftsize, True, (window.hamming(fftsize)), True, 1) self.blocks_stream_to_vector_0_0_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 2 * fftsize) self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, fftsize) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared( fftsize) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_float_0, 1), (self.qtgui_histogram_sink_x_0, 1)) self.connect((self.blocks_complex_to_float_0, 0), (self.qtgui_histogram_sink_x_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.radio_astro_vmedian_0_0_1, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.fft_vxx_0, 0)) self.connect((self.blocks_stream_to_vector_0_0_0, 0), (self.radio_astro_detect_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.radio_astro_detect_0, 0), (self.radio_astro_ra_event_log_0, 0)) self.connect((self.radio_astro_detect_0, 0), (self.radio_astro_ra_event_sink_0, 0)) self.connect((self.radio_astro_ra_ascii_sink_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.radio_astro_vmedian_0, 0), (self.radio_astro_ra_ascii_sink_0, 0)) self.connect((self.radio_astro_vmedian_0_0, 0), (self.radio_astro_vmedian_0, 0)) self.connect((self.radio_astro_vmedian_0_0_0, 0), (self.radio_astro_vmedian_0_0, 0)) self.connect((self.radio_astro_vmedian_0_0_1, 0), (self.radio_astro_vmedian_0_0_1_0, 0)) self.connect((self.radio_astro_vmedian_0_0_1_0, 0), (self.radio_astro_vmedian_0_0_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_stream_to_vector_0_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_stream_to_vector_0_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Example5 Rx") Qt.QWidget.__init__(self) self.setWindowTitle("Example5 Rx") 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", "example5_rx") if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.time_preamble = time_preamble = [ 0.125000 + 0.000000j, 0.522104 - 0.148216j, -0.495528 + 0.114832j, -0.267916 + 0.091700j, 0.236544 - 0.138456j, -0.098500 + 0.473800j, 0.476480 - 0.225344j, -0.187516 + 0.035372j, 0.051776 - 0.353552j, -0.104936 + 0.059916j, 0.228684 + 0.117504j, -0.530912 + 0.560756j, 0.359128 + 0.015872j, -0.132852 + 0.632840j, -0.105164 - 0.368872j, 0.368272 - 0.032412j, 0.125000 + 0.750000j, 0.463968 + 0.457792j, 0.151476 - 0.430948j, 0.685052 + 0.238524j, 0.494428 + 0.119428j, -0.557540 - 0.050056j, 0.416348 + 0.017368j, 0.104256 - 0.568836j, -0.301776 - 0.353552j, 0.079812 + 0.451516j, 0.439152 + 0.528072j, 0.642060 + 0.178484j, -0.090096 + 0.465096j, -0.446492 + 0.305776j, -0.111440 - 0.093688j, -0.538848 - 0.320228j, 0.125000 + 0.000000j, -0.538848 + 0.320228j, -0.111440 + 0.093688j, -0.446492 - 0.305776j, -0.090096 - 0.465096j, 0.642060 - 0.178484j, 0.439152 - 0.528072j, 0.079812 - 0.451516j, -0.301776 + 0.353552j, 0.104256 + 0.568836j, 0.416348 - 0.017368j, -0.557540 + 0.050056j, 0.494428 - 0.119428j, 0.685052 - 0.238524j, 0.151476 + 0.430948j, 0.463968 - 0.457792j, 0.125000 - 0.750000j, 0.368272 + 0.032412j, -0.105164 + 0.368872j, -0.132852 - 0.632840j, 0.359128 - 0.015872j, -0.530912 - 0.560756j, 0.228684 - 0.117504j, -0.104936 - 0.059916j, 0.051776 + 0.353552j, -0.187516 - 0.035372j, 0.476480 + 0.225344j, -0.098500 - 0.473800j, 0.236544 + 0.138456j, -0.267916 - 0.091700j, -0.495528 - 0.114832j, 0.522104 + 0.148216j ] self.threshold = threshold = 1 self.samp_rate = samp_rate = 500000 self.preamble_len = preamble_len = 64 self.packet_len = packet_len = 1024 self.length = length = 96 ################################################## # Blocks ################################################## self._threshold_range = Range(0, 2, 0.01, 1, 200) self._threshold_win = RangeWidget(self._threshold_range, self.set_threshold, 'Threshold', "counter_slider", float) self.top_grid_layout.addWidget(self._threshold_win, 0, 0, 1, 2) [self.top_grid_layout.setRowStretch(r, 1) for r in range(0, 1)] [self.top_grid_layout.setColumnStretch(c, 1) for c in range(0, 2)] self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=1, decimation=1, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1, decimation=2, taps=None, fractional_bw=None, ) self.qtgui_time_sink_x_1 = qtgui.time_sink_f( preamble_len + packet_len, #size samp_rate, #samp_rate "Synchronization", #name 2 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-0.2, 2) self.qtgui_time_sink_x_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1.enable_tags(-1, False) self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_1.enable_autoscale(False) self.qtgui_time_sink_x_1.enable_grid(False) self.qtgui_time_sink_x_1.enable_axis_labels(True) self.qtgui_time_sink_x_1.enable_control_panel(False) self.qtgui_time_sink_x_1.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_1.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_time_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_1_win, 1, 0, 1, 2) [self.top_grid_layout.setRowStretch(r, 1) for r in range(1, 2)] [self.top_grid_layout.setColumnStretch(c, 1) for c in range(0, 2)] self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( 512, #size samp_rate, #samp_rate "Demodulated OFDM Data", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0.enable_tags(-1, 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(True) self.qtgui_time_sink_x_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(False) self.qtgui_time_sink_x_0_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0_0.disable_legend() labels = ['Bytes', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 2, 1, 1, 1) [self.top_grid_layout.setRowStretch(r, 1) for r in range(2, 3)] [self.top_grid_layout.setColumnStretch(c, 1) for c in range(1, 2)] self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 512, #size samp_rate, #samp_rate "Demodulated GMSK Data", #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(True) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['Bytes', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 2, 0, 1, 1) [self.top_grid_layout.setRowStretch(r, 1) for r in range(2, 3)] [self.top_grid_layout.setColumnStretch(c, 1) for c in range(0, 1)] self.mysvl_triggered_demux_0 = mysvl.triggered_demux( gr.sizeof_gr_complex * 1, gr.sizeof_float, (preamble_len, packet_len), 1, True) self.mysvl_svl_0_0 = mysvl.svl( gr.sizeof_gr_complex * 1, 1, './inputs/spectrum_maps/example1b_rx.txt', './inputs/parameters/example1a-c_rx.txt') self.digital_ofdm_rx_0 = digital.ofdm_rx( fft_len=64, cp_len=16, frame_length_tag_key='frame_' + "length", packet_length_tag_key="length", bps_header=1, bps_payload=2, debug_log=False, scramble_bits=False) self.digital_gmsk_demod_0 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0.0, verbose=False, log=False, ) self.digital_corr_est_cc_0 = digital.corr_est_cc((time_preamble), 1, 0, 0.99) self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_gr_complex * 1, '127.0.0.1', 4000, 1472 * 32, True) (self.blocks_udp_source_0).set_min_output_buffer(1000000) self.blocks_threshold_ff_0 = blocks.threshold_ff( threshold, threshold, 0) self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_file_sink_0_0 = blocks.file_sink( gr.sizeof_char * 1, './outputs/output_audio1.mp3', False) self.blocks_file_sink_0_0.set_unbuffered(False) self.blocks_file_sink_0 = blocks.file_sink( gr.sizeof_char * 1, './outputs/output_audio2.mp3', False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.blocks_abs_xx_1 = blocks.abs_ff(1) self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b( grc_blks2.packet_decoder( access_code='', threshold=-1, callback=lambda ok, payload: self.blks2_packet_decoder_0. recv_pkt(ok, payload), ), ) self.analog_const_source_x_0 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, threshold) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.qtgui_time_sink_x_1, 1)) self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_file_sink_0_0, 0)) self.connect((self.blocks_abs_xx_1, 0), (self.blocks_threshold_ff_0, 0)) self.connect((self.blocks_abs_xx_1, 0), (self.qtgui_time_sink_x_1, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_char_to_float_0_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_abs_xx_1, 0)) self.connect((self.blocks_threshold_ff_0, 0), (self.mysvl_triggered_demux_0, 1)) self.connect((self.blocks_udp_source_0, 0), (self.digital_corr_est_cc_0, 0)) self.connect((self.digital_corr_est_cc_0, 1), (self.blocks_complex_to_float_0, 0)) self.connect((self.digital_corr_est_cc_0, 0), (self.mysvl_triggered_demux_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_0, 0)) self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_char_to_float_0_0, 0)) self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.mysvl_svl_0_0, 1), (self.rational_resampler_xxx_0, 0)) self.connect((self.mysvl_svl_0_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.mysvl_triggered_demux_0, 0), (self.blocks_null_sink_1, 0)) self.connect((self.mysvl_triggered_demux_0, 1), (self.mysvl_svl_0_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.digital_gmsk_demod_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.digital_ofdm_rx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Morse Code Generator") Qt.QWidget.__init__(self) self.setWindowTitle("Morse Code Generator") 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", "MorseGen") 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.speed = speed = 12 self.repeat = repeat = 1200 self.baud = baud = speed / 1.2 self.samp_rate = samp_rate = baud * repeat self.freq = freq = 800 ################################################## # Blocks ################################################## self._freq_range = Range(300, 20000, 100, 800, 200) self._freq_win = RangeWidget(self._freq_range, self.set_freq, 'freq', "dial", float) self.top_grid_layout.addWidget(self._freq_win) self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff( 0.25, 1) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=(int)(48000 / samp_rate), decimation=1, taps=None, fractional_bw=None) self.qtgui_edit_box_msg_0 = qtgui.edit_box_msg(qtgui.STRING, "", 'Input', False, False, "text") self._qtgui_edit_box_msg_0_win = sip.wrapinstance( self.qtgui_edit_box_msg_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_edit_box_msg_0_win) self.epy_block_0_0 = epy_block_0_0.mc_sync_block() self.blocks_uchar_to_float_0 = blocks.uchar_to_float() self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char * 1, repeat) self.blocks_multiply_xx_0 = blocks.multiply_vff(1) self.audio_sink_0 = audio.sink(48000, 'hw:CARD=Device,DEV=0', True) self.analog_sig_source_x_0_0 = analog.sig_source_f( samp_rate, analog.GR_COS_WAVE, freq, 0.5, 0, 0) ################################################## # Connections ################################################## self.msg_connect((self.epy_block_0_0, 'clear_input'), (self.qtgui_edit_box_msg_0, 'val')) self.msg_connect((self.qtgui_edit_box_msg_0, 'msg'), (self.epy_block_0_0, 'msg_in')) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_repeat_0, 0), (self.blocks_uchar_to_float_0, 0)) self.connect((self.blocks_uchar_to_float_0, 0), (self.single_pole_iir_filter_xx_0, 0)) self.connect((self.epy_block_0_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.single_pole_iir_filter_xx_0, 0), (self.blocks_multiply_xx_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") if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 3000000 self.min_freq = min_freq = 0e3 * (2 * 3.14) / samp_rate self.max_freq = max_freq = 20e3 * (2 * 3.14) / samp_rate self.loop_bw = loop_bw = 1e3 * (2 * 3.14) / samp_rate self.fc = fc = 2.45e9 ################################################## # Blocks ################################################## self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_clock_source('internal', 0) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_0.set_center_freq(fc, 0) self.uhd_usrp_source_0.set_gain(30, 0) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) ################################################## # Connections ################################################## self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_freq_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "Mpsk Rrc Rolloff", catch_exceptions=True) Qt.QWidget.__init__(self) self.setWindowTitle("Mpsk Rrc Rolloff") 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", "mpsk_rrc_rolloff") 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.sps = sps = 4 self.samp_rate = samp_rate = 32000 self.qpsk_const = qpsk_const = digital.constellation_rect([-1-1j, -1+1j, 1+1j, 1-1j], [0, 1, 3, 2], 4, 2, 2, 1, 1).base() self.excess_bw = excess_bw = 0.35 self.arity = arity = 4 ################################################## # Blocks ################################################## self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size window.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw 'QT GUI Plot', #name 5, None # parent ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) self.qtgui_freq_sink_x_0.set_fft_window_normalized(False) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(5): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 1, 0, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.digital_constellation_modulator_0_1 = digital.generic_mod( constellation=qpsk_const, differential=True, samples_per_symbol=sps, pre_diff_code=True, excess_bw=0.35, verbose=False, log=False, truncate=False) self.digital_constellation_modulator_0_0_0_0 = digital.generic_mod( constellation=qpsk_const, differential=True, samples_per_symbol=sps, pre_diff_code=True, excess_bw=1.0, verbose=False, log=False, truncate=False) self.digital_constellation_modulator_0_0_0 = digital.generic_mod( constellation=qpsk_const, differential=True, samples_per_symbol=sps, pre_diff_code=True, excess_bw=0.5, verbose=False, log=False, truncate=False) self.digital_constellation_modulator_0_0 = digital.generic_mod( constellation=qpsk_const, differential=True, samples_per_symbol=sps, pre_diff_code=True, excess_bw=0.22, verbose=False, log=False, truncate=False) self.digital_constellation_modulator_0 = digital.generic_mod( constellation=qpsk_const, differential=True, samples_per_symbol=sps, pre_diff_code=True, excess_bw=0.1, verbose=False, log=False, truncate=False) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.analog_random_source_x_0 = blocks.vector_source_b(list(map(int, numpy.random.randint(0, 255, 1000))), True) ################################################## # Connections ################################################## self.connect((self.analog_random_source_x_0, 0), (self.digital_constellation_modulator_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.digital_constellation_modulator_0_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.digital_constellation_modulator_0_0_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.digital_constellation_modulator_0_0_0_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.digital_constellation_modulator_0_1, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.digital_constellation_modulator_0_0, 0), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.digital_constellation_modulator_0_0_0, 0), (self.qtgui_freq_sink_x_0, 3)) self.connect((self.digital_constellation_modulator_0_0_0_0, 0), (self.qtgui_freq_sink_x_0, 4)) self.connect((self.digital_constellation_modulator_0_1, 0), (self.qtgui_freq_sink_x_0, 2))
def __init__(self): gr.top_block.__init__(self, "Beamformer_Ex4") Qt.QWidget.__init__(self) self.setWindowTitle("Beamformer_Ex4") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.Center_freq = Center_freq = 10508.0 self.BW = BW = 0 self.variable_qtgui_label_0_0_0_0_0_0 = variable_qtgui_label_0_0_0_0_0_0 = ("%d" % (Center_freq)).rjust(16) self.variable_qtgui_label_0_0_0_0_0 = variable_qtgui_label_0_0_0_0_0 = ("%d" % ((Center_freq-BW))).rjust(10) self.variable_qtgui_label_0_0_0_0 = variable_qtgui_label_0_0_0_0 = ("%d" % (BW)).rjust(28) self.variable_qtgui_label_0_0_0 = variable_qtgui_label_0_0_0 = ("%d" % ((Center_freq - 5810))).rjust(27) self.variable_qtgui_label_0_0 = variable_qtgui_label_0_0 = ("%d" % (5810)).rjust(32) self.variable_qtgui_label_0 = variable_qtgui_label_0 = ("%d" % (Center_freq)).rjust(20) self.samp_rate = samp_rate = 40000000 self.Times_To_Average = Times_To_Average = 1 self.SymmetricTaper = SymmetricTaper = 0 self.Rx_gain = Rx_gain = 20 self.Rx4_Cal = Rx4_Cal = 0 self.Rx4Gain = Rx4Gain = 127 self.Rx3_Cal = Rx3_Cal = 0 self.Rx3Gain = Rx3Gain = 127 self.Rx2_Cal = Rx2_Cal = 0 self.Rx2Gain = Rx2Gain = 127 self.Rx1_Cal = Rx1_Cal = 0 self.Rx1Gain = Rx1Gain = 127 self.IgnorePhaseCals = IgnorePhaseCals = 0 self.BeamTaper = BeamTaper = 0 ################################################## # Blocks ################################################## self.ControlTab = Qt.QTabWidget() self.ControlTab_widget_0 = Qt.QWidget() self.ControlTab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.ControlTab_widget_0) self.ControlTab_grid_layout_0 = Qt.QGridLayout() self.ControlTab_layout_0.addLayout(self.ControlTab_grid_layout_0) self.ControlTab.addTab(self.ControlTab_widget_0, 'Pluto_Controls') self.ControlTab_widget_1 = Qt.QWidget() self.ControlTab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.ControlTab_widget_1) self.ControlTab_grid_layout_1 = Qt.QGridLayout() self.ControlTab_layout_1.addLayout(self.ControlTab_grid_layout_1) self.ControlTab.addTab(self.ControlTab_widget_1, 'Gain') self.ControlTab_widget_2 = Qt.QWidget() self.ControlTab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.ControlTab_widget_2) self.ControlTab_grid_layout_2 = Qt.QGridLayout() self.ControlTab_layout_2.addLayout(self.ControlTab_grid_layout_2) self.ControlTab.addTab(self.ControlTab_widget_2, 'Phase') self.ControlTab_widget_3 = Qt.QWidget() self.ControlTab_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.ControlTab_widget_3) self.ControlTab_grid_layout_3 = Qt.QGridLayout() self.ControlTab_layout_3.addLayout(self.ControlTab_grid_layout_3) self.ControlTab.addTab(self.ControlTab_widget_3, 'Bandwidth') self.top_grid_layout.addWidget(self.ControlTab, 0, 0, 6, 2) for r in range(0, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Times_To_Average_range = Range(1, 50, 1, 1, 10) self._Times_To_Average_win = RangeWidget(self._Times_To_Average_range, self.set_Times_To_Average, 'Times_To_Average', "counter_slider", int) self.ControlTab_grid_layout_0.addWidget(self._Times_To_Average_win, 2, 0, 1, 2) for r in range(2, 3): self.ControlTab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_0.setColumnStretch(c, 1) _SymmetricTaper_check_box = Qt.QCheckBox('Set Rx4Gain = Rx1Gain (Symmetric Taper)') self._SymmetricTaper_choices = {True: 1, False: 0} self._SymmetricTaper_choices_inv = dict((v,k) for k,v in self._SymmetricTaper_choices.items()) self._SymmetricTaper_callback = lambda i: Qt.QMetaObject.invokeMethod(_SymmetricTaper_check_box, "setChecked", Qt.Q_ARG("bool", self._SymmetricTaper_choices_inv[i])) self._SymmetricTaper_callback(self.SymmetricTaper) _SymmetricTaper_check_box.stateChanged.connect(lambda i: self.set_SymmetricTaper(self._SymmetricTaper_choices[bool(i)])) self.ControlTab_grid_layout_1.addWidget(_SymmetricTaper_check_box, 5, 0, 1, 1) for r in range(5, 6): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._Rx_gain_range = Range(0, 60, 1, 20, 10) self._Rx_gain_win = RangeWidget(self._Rx_gain_range, self.set_Rx_gain, 'Rx_gain', "counter_slider", int) self.ControlTab_grid_layout_0.addWidget(self._Rx_gain_win, 1, 0, 1, 2) for r in range(1, 2): self.ControlTab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_0.setColumnStretch(c, 1) self._Rx4_Cal_range = Range(-180, 180, 2.8125, 0, 10) self._Rx4_Cal_win = RangeWidget(self._Rx4_Cal_range, self.set_Rx4_Cal, 'Rx4_Cal', "counter_slider", float) self.ControlTab_grid_layout_2.addWidget(self._Rx4_Cal_win, 3, 0, 1, 2) for r in range(3, 4): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Rx4Gain_range = Range(0, 127, 1, 127, 20) self._Rx4Gain_win = RangeWidget(self._Rx4Gain_range, self.set_Rx4Gain, 'Rx4Gain', "counter_slider", int) self.ControlTab_grid_layout_1.addWidget(self._Rx4Gain_win, 3, 0, 1, 2) for r in range(3, 4): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._Rx3_Cal_range = Range(-180, 180, 2.8125, 0, 10) self._Rx3_Cal_win = RangeWidget(self._Rx3_Cal_range, self.set_Rx3_Cal, 'Rx3_Cal', "counter_slider", float) self.ControlTab_grid_layout_2.addWidget(self._Rx3_Cal_win, 2, 0, 1, 2) for r in range(2, 3): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Rx3Gain_range = Range(0, 127, 1, 127, 20) self._Rx3Gain_win = RangeWidget(self._Rx3Gain_range, self.set_Rx3Gain, 'Rx3Gain', "counter_slider", int) self.ControlTab_grid_layout_1.addWidget(self._Rx3Gain_win, 2, 0, 1, 2) for r in range(2, 3): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._Rx2_Cal_range = Range(-180, 180, 2.8125, 0, 10) self._Rx2_Cal_win = RangeWidget(self._Rx2_Cal_range, self.set_Rx2_Cal, 'Rx2_Cal', "counter_slider", float) self.ControlTab_grid_layout_2.addWidget(self._Rx2_Cal_win, 1, 0, 1, 2) for r in range(1, 2): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Rx2Gain_range = Range(0, 127, 1, 127, 20) self._Rx2Gain_win = RangeWidget(self._Rx2Gain_range, self.set_Rx2Gain, 'Rx2Gain', "counter_slider", int) self.ControlTab_grid_layout_1.addWidget(self._Rx2Gain_win, 1, 0, 1, 2) for r in range(1, 2): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._Rx1_Cal_range = Range(-180, 180, 2.8125, 0, 10) self._Rx1_Cal_win = RangeWidget(self._Rx1_Cal_range, self.set_Rx1_Cal, 'Rx1_Cal', "counter_slider", float) self.ControlTab_grid_layout_2.addWidget(self._Rx1_Cal_win, 0, 0, 1, 2) for r in range(0, 1): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Rx1Gain_range = Range(0, 127, 1, 127, 20) self._Rx1Gain_win = RangeWidget(self._Rx1Gain_range, self.set_Rx1Gain, 'Rx1Gain', "counter_slider", int) self.ControlTab_grid_layout_1.addWidget(self._Rx1Gain_win, 0, 0, 1, 2) for r in range(0, 1): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) _IgnorePhaseCals_check_box = Qt.QCheckBox('Set All Phase Cals to 0 deg') self._IgnorePhaseCals_choices = {True: 1, False: 0} self._IgnorePhaseCals_choices_inv = dict((v,k) for k,v in self._IgnorePhaseCals_choices.items()) self._IgnorePhaseCals_callback = lambda i: Qt.QMetaObject.invokeMethod(_IgnorePhaseCals_check_box, "setChecked", Qt.Q_ARG("bool", self._IgnorePhaseCals_choices_inv[i])) self._IgnorePhaseCals_callback(self.IgnorePhaseCals) _IgnorePhaseCals_check_box.stateChanged.connect(lambda i: self.set_IgnorePhaseCals(self._IgnorePhaseCals_choices[bool(i)])) self.ControlTab_grid_layout_2.addWidget(_IgnorePhaseCals_check_box, 4, 0, 1, 2) for r in range(4, 5): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Center_freq_range = Range(10000, 11000, 0.1, 10508.0, 10) self._Center_freq_win = RangeWidget(self._Center_freq_range, self.set_Center_freq, 'Signal Freq (MHz)', "counter_slider", float) self.ControlTab_grid_layout_0.addWidget(self._Center_freq_win, 0, 0, 1, 2) for r in range(0, 1): self.ControlTab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_0.setColumnStretch(c, 1) _BeamTaper_check_box = Qt.QCheckBox('Set All Element Gains to Max (127)') self._BeamTaper_choices = {True: 1, False: 0} self._BeamTaper_choices_inv = dict((v,k) for k,v in self._BeamTaper_choices.items()) self._BeamTaper_callback = lambda i: Qt.QMetaObject.invokeMethod(_BeamTaper_check_box, "setChecked", Qt.Q_ARG("bool", self._BeamTaper_choices_inv[i])) self._BeamTaper_callback(self.BeamTaper) _BeamTaper_check_box.stateChanged.connect(lambda i: self.set_BeamTaper(self._BeamTaper_choices[bool(i)])) self.ControlTab_grid_layout_1.addWidget(_BeamTaper_check_box, 4, 0, 1, 1) for r in range(4, 5): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._BW_range = Range(0, 2000, 100, 0, 10) self._BW_win = RangeWidget(self._BW_range, self.set_BW, 'Signal BW (MHz)', "counter_slider", float) self.ControlTab_grid_layout_3.addWidget(self._BW_win, 0, 0, 1, 1) for r in range(0, 1): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) self._variable_qtgui_label_0_0_0_0_0_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_0_0_0_0_0_formatter = None else: self._variable_qtgui_label_0_0_0_0_0_0_formatter = lambda x: str(x) self._variable_qtgui_label_0_0_0_0_0_0_tool_bar.addWidget(Qt.QLabel('Angle Measured at (MHz)' + ": ")) self._variable_qtgui_label_0_0_0_0_0_0_label = Qt.QLabel(str(self._variable_qtgui_label_0_0_0_0_0_0_formatter(self.variable_qtgui_label_0_0_0_0_0_0))) self._variable_qtgui_label_0_0_0_0_0_0_tool_bar.addWidget(self._variable_qtgui_label_0_0_0_0_0_0_label) self.ControlTab_grid_layout_3.addWidget(self._variable_qtgui_label_0_0_0_0_0_0_tool_bar, 6, 0, 1, 1) for r in range(6, 7): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) self._variable_qtgui_label_0_0_0_0_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_0_0_0_0_formatter = None else: self._variable_qtgui_label_0_0_0_0_0_formatter = lambda x: str(x) self._variable_qtgui_label_0_0_0_0_0_tool_bar.addWidget(Qt.QLabel('Beam Weights Calc at (MHz)' + ": ")) self._variable_qtgui_label_0_0_0_0_0_label = Qt.QLabel(str(self._variable_qtgui_label_0_0_0_0_0_formatter(self.variable_qtgui_label_0_0_0_0_0))) self._variable_qtgui_label_0_0_0_0_0_tool_bar.addWidget(self._variable_qtgui_label_0_0_0_0_0_label) self.ControlTab_grid_layout_3.addWidget(self._variable_qtgui_label_0_0_0_0_0_tool_bar, 5, 0, 1, 1) for r in range(5, 6): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) 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('Signal BW (MHz)' + ": ")) 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.ControlTab_grid_layout_3.addWidget(self._variable_qtgui_label_0_0_0_0_tool_bar, 4, 0, 1, 1) for r in range(4, 5): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) 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('Pluto Rx LO (MHz)' + ": ")) 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.ControlTab_grid_layout_3.addWidget(self._variable_qtgui_label_0_0_0_tool_bar, 3, 0, 1, 1) for r in range(3, 4): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) 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('Mixer LO (MHz)' + ": ")) 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.ControlTab_grid_layout_3.addWidget(self._variable_qtgui_label_0_0_tool_bar, 2, 0, 1, 1) for r in range(2, 3): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) 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('Received Signal (MHz)' + ": ")) 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.ControlTab_grid_layout_3.addWidget(self._variable_qtgui_label_0_tool_bar, 1, 0, 1, 1) for r in range(1, 2): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) self.qtgui_number_sink_0 = qtgui.number_sink( gr.sizeof_float, 1, qtgui.NUM_GRAPH_HORIZ, 1 ) self.qtgui_number_sink_0.set_update_time(0.1) self.qtgui_number_sink_0.set_title('Elevation') labels = [' ', '', '', '', '', '', '', '', '', ''] units = ['deg', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in range(1): self.qtgui_number_sink_0.set_min(i, -80) self.qtgui_number_sink_0.set_max(i, 80) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance(self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win, 5, 2, 1, 1) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 140, #size "Peak Signal vs Steering Angle", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-50, 0) self.qtgui_const_sink_x_0.set_x_axis(-80, 80) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(True) self.qtgui_const_sink_x_0.enable_axis_labels(True) self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "red", "red", "red", "red", "red", "red", "red", "red"] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 0, 2, 5, 3) for r in range(0, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 5): self.top_grid_layout.setColumnStretch(c, 1) self.epy_block_0 = epy_block_0.blk(SDR_ip='ip:192.168.2.1', LO_freq=int(Center_freq*1000000 - 5810000000), TX_freq=5810000000, SampleRate=int(samp_rate), Rx_gain=int(Rx_gain), Averages=int(Times_To_Average), Taper=int(BeamTaper), SymTaper=int(SymmetricTaper), PhaseCal=int(IgnorePhaseCals), SignalFreq=int((Center_freq-BW)*1000000), RxGain1=int(Rx1Gain), RxGain2=int(Rx2Gain), RxGain3=int(Rx3Gain), RxGain4=int(Rx4Gain), Rx1_cal=Rx1_Cal, Rx2_cal=Rx2_Cal, Rx3_cal=Rx3_Cal, Rx4_cal=Rx4_Cal) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True) self.blocks_moving_average_xx_0 = blocks.moving_average_ff(1000, 0.001, samp_rate, 1) ################################################## # Connections ################################################## self.connect((self.blocks_moving_average_xx_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.epy_block_0, 1), (self.blocks_throttle_0, 0)) self.connect((self.epy_block_0, 0), (self.qtgui_const_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "burst mode test") Qt.QWidget.__init__(self) self.setWindowTitle("burst mode 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", "burst_mode") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry( self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.samp_rate = samp_rate = 44100 self.rrc_taps = rrc_taps = firdes.root_raised_cosine( 32, 32, 1.0 / float(50), 0.7, 1 * 50 * 32) self.qpsk = qpsk = digital.constellation_rect( [-1 - 1j, -1 + 1j, 1 + 1j, 1 - 1j], [0, 1, 3, 2], 4, 2, 2, 1, 1).base() ################################################## # Blocks ################################################## self.qtgui_time_sink_x_1 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1.set_update_time(0.10) self.qtgui_time_sink_x_1.set_y_axis(-1, 1) self.qtgui_time_sink_x_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1.enable_tags(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(True) self.qtgui_time_sink_x_1.enable_grid(False) self.qtgui_time_sink_x_1.enable_axis_labels(True) self.qtgui_time_sink_x_1.enable_control_panel(False) self.qtgui_time_sink_x_1.enable_stem_plot(False) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ 'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue' ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(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_grid_layout.addWidget(self._qtgui_time_sink_x_1_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ 'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue' ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(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.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf( 50, 6.28e-3, rrc_taps, 32, 16, 1.5, 1) self.digital_corr_est_cc_0 = digital.corr_est_cc( (0xac, 0xdd), 50, 0, 0.9, digital.THRESHOLD_ABSOLUTE) self.digital_constellation_modulator_0 = digital.generic_mod( constellation=qpsk, differential=False, samples_per_symbol=50, pre_diff_code=True, excess_bw=0.7, verbose=False, log=False) self.channels_channel_model_0 = channels.channel_model( noise_voltage=0.3, frequency_offset=0.0, epsilon=1.0, taps=[1.0], noise_seed=0, block_tags=False) self.blocks_vector_source_x_0 = blocks.vector_source_b((0xac, 0xdd), True, 1, []) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_stream_mux_0 = blocks.stream_mux(gr.sizeof_char * 1, (1, 10)) self.analog_random_source_x_0 = blocks.vector_source_b( list(map(int, numpy.random.randint(0, 255, 10))), True) ################################################## # Connections ################################################## self.connect((self.analog_random_source_x_0, 0), (self.blocks_stream_mux_0, 1)) self.connect((self.blocks_stream_mux_0, 0), (self.digital_constellation_modulator_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_stream_mux_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.digital_corr_est_cc_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.digital_corr_est_cc_0, 1), (self.qtgui_time_sink_x_1, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_corr_est_cc_0, 0))
def __init__(self): gr.top_block.__init__(self, "Dvbs2 Tx") Qt.QWidget.__init__(self) self.setWindowTitle("Dvbs2 Tx") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "dvbs2_tx") if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.symbol_rate = symbol_rate = 5000000 self.tx_gain = tx_gain = 0 self.taps = taps = 100 self.samp_rate = samp_rate = symbol_rate * 2 self.rolloff = rolloff = 0.2 self.qtgui_variable = qtgui_variable = '"labul' self.pilots = pilots = 0 self.noise_type = noise_type = "Gaussian" self.noise = noise = 0.1 self.code_rate_qpsk = code_rate_qpsk = "9/10" self.code_rate_8psk = code_rate_8psk = "9/10" self.code_rate_32apsk = code_rate_32apsk = "9/10" self.code_rate_16apsk = code_rate_16apsk = "9/10" self.center_freq = center_freq = 1280e6 self.browse_button = browse_button = 0 self.FEC_Frame_size = FEC_Frame_size = 'Normal' ################################################## # Blocks ################################################## self._tx_gain_range = Range(0, 89, 1, 0, 200) self._tx_gain_win = RangeWidget(self._tx_gain_range, self.set_tx_gain, 'TX Gain (dB)', "counter_slider", float) self.top_grid_layout.addWidget(self._tx_gain_win, 1, 0, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._rolloff_options = (0.2, 0.25, 0.35, ) self._rolloff_labels = (str(self._rolloff_options[0]), str(self._rolloff_options[1]), str(self._rolloff_options[2]), ) self._rolloff_tool_bar = Qt.QToolBar(self) self._rolloff_tool_bar.addWidget(Qt.QLabel('Rolloff'+": ")) self._rolloff_combo_box = Qt.QComboBox() self._rolloff_tool_bar.addWidget(self._rolloff_combo_box) for label in self._rolloff_labels: self._rolloff_combo_box.addItem(label) self._rolloff_callback = lambda i: Qt.QMetaObject.invokeMethod(self._rolloff_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._rolloff_options.index(i))) self._rolloff_callback(self.rolloff) self._rolloff_combo_box.currentIndexChanged.connect( lambda i: self.set_rolloff(self._rolloff_options[i])) self.top_grid_layout.addWidget(self._rolloff_tool_bar, 0, 1, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.constellation_tab = Qt.QTabWidget() self.constellation_tab_widget_0 = Qt.QWidget() self.constellation_tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.constellation_tab_widget_0) self.constellation_tab_grid_layout_0 = Qt.QGridLayout() self.constellation_tab_layout_0.addLayout(self.constellation_tab_grid_layout_0) self.constellation_tab.addTab(self.constellation_tab_widget_0, 'QPSK') self.constellation_tab_widget_1 = Qt.QWidget() self.constellation_tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.constellation_tab_widget_1) self.constellation_tab_grid_layout_1 = Qt.QGridLayout() self.constellation_tab_layout_1.addLayout(self.constellation_tab_grid_layout_1) self.constellation_tab.addTab(self.constellation_tab_widget_1, '8PSK') self.constellation_tab_widget_2 = Qt.QWidget() self.constellation_tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.constellation_tab_widget_2) self.constellation_tab_grid_layout_2 = Qt.QGridLayout() self.constellation_tab_layout_2.addLayout(self.constellation_tab_grid_layout_2) self.constellation_tab.addTab(self.constellation_tab_widget_2, '16APSK') self.constellation_tab_widget_3 = Qt.QWidget() self.constellation_tab_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.constellation_tab_widget_3) self.constellation_tab_grid_layout_3 = Qt.QGridLayout() self.constellation_tab_layout_3.addLayout(self.constellation_tab_grid_layout_3) self.constellation_tab.addTab(self.constellation_tab_widget_3, '32APSK') self.top_grid_layout.addWidget(self.constellation_tab, 2, 0, 1, 1) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.uhd_usrp_sink = uhd.usrp_sink( ",".join(('', '')), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink.set_samp_rate(samp_rate) self.uhd_usrp_sink.set_center_freq(center_freq, 0) self.uhd_usrp_sink.set_gain(tx_gain, 0) self._qtgui_variable_tool_bar = Qt.QToolBar(self) if None: self._qtgui_variable_formatter = None else: self._qtgui_variable_formatter = lambda x: str(x) self._qtgui_variable_tool_bar.addWidget(Qt.QLabel('label'+": ")) self._qtgui_variable_label = Qt.QLabel(str(self._qtgui_variable_formatter(self.qtgui_variable))) self._qtgui_variable_tool_bar.addWidget(self._qtgui_variable_label) self.top_grid_layout.addWidget(self._qtgui_variable_tool_bar, 3, 0, 1, 1) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype center_freq, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink.set_update_time(0.10) self.qtgui_freq_sink.set_y_axis(-140, 10) self.qtgui_freq_sink.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink.enable_autoscale(False) self.qtgui_freq_sink.enable_grid(True) self.qtgui_freq_sink.set_fft_average(0.2) self.qtgui_freq_sink.enable_axis_labels(True) self.qtgui_freq_sink.enable_control_panel(False) if not True: self.qtgui_freq_sink.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink.set_plot_pos_half(not True) labels = ['DVB-S2', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink.set_line_label(i, labels[i]) self.qtgui_freq_sink.set_line_width(i, widths[i]) self.qtgui_freq_sink.set_line_color(i, colors[i]) self.qtgui_freq_sink.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_win = sip.wrapinstance(self.qtgui_freq_sink.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_win, 4, 0, 1, 1) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._pilots_options = (1, 0, ) self._pilots_labels = ("On", "Off", ) self._pilots_group_box = Qt.QGroupBox('Pilots') self._pilots_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._pilots_button_group = variable_chooser_button_group() self._pilots_group_box.setLayout(self._pilots_box) for i, label in enumerate(self._pilots_labels): radio_button = Qt.QRadioButton(label) self._pilots_box.addWidget(radio_button) self._pilots_button_group.addButton(radio_button, i) self._pilots_callback = lambda i: Qt.QMetaObject.invokeMethod(self._pilots_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._pilots_options.index(i))) self._pilots_callback(self.pilots) self._pilots_button_group.buttonClicked[int].connect( lambda i: self.set_pilots(self._pilots_options[i])) self.top_grid_layout.addWidget(self._pilots_group_box, 3, 1, 1, 1) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self._noise_type_options = ("Uniform", "Gaussian", "Laplacian", "Impulse", ) self._noise_type_labels = (str(self._noise_type_options[0]), str(self._noise_type_options[1]), str(self._noise_type_options[2]), str(self._noise_type_options[3]), ) self._noise_type_tool_bar = Qt.QToolBar(self) self._noise_type_tool_bar.addWidget(Qt.QLabel('Noise Type'+": ")) self._noise_type_combo_box = Qt.QComboBox() self._noise_type_tool_bar.addWidget(self._noise_type_combo_box) for label in self._noise_type_labels: self._noise_type_combo_box.addItem(label) self._noise_type_callback = lambda i: Qt.QMetaObject.invokeMethod(self._noise_type_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._noise_type_options.index(i))) self._noise_type_callback(self.noise_type) self._noise_type_combo_box.currentIndexChanged.connect( lambda i: self.set_noise_type(self._noise_type_options[i])) self.top_grid_layout.addWidget(self._noise_type_tool_bar, 1, 1, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.noise_source = analog.noise_source_c(analog.GR_GAUSSIAN, 0, 0) self._noise_range = Range(0, 1, 0.01, 0.1, 200) self._noise_win = RangeWidget(self._noise_range, self.set_noise, 'Noise', "counter", float) self.top_grid_layout.addWidget(self._noise_win, 2, 1, 1, 1) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.file_source = blocks.file_source(gr.sizeof_char*1, '/home/anisan/videos/The_Maker/900.ts', True) self.file_source.set_begin_tag(pmt.PMT_NIL) self.fft_filter = filter.fft_filter_ccc(1, (firdes.root_raised_cosine(1.0, samp_rate, samp_rate/2, rolloff, taps)), 1) self.fft_filter.declare_sample_delay(0) self.dvbs2_physical = dvbs2.physical_cc(dvbs2.FECFRAME_NORMAL, dvbs2.C9_10, dvbs2.MOD_16APSK, dvbs2.PILOTS_OFF, 0) self.dvbs2_modulator = dvbs2.modulator_bc(dvbs2.FECFRAME_NORMAL, dvbs2.C9_10, dvbs2.MOD_16APSK) self.dvbs2_ldpc = dvbs2.ldpc_bb(dvbs2.FECFRAME_NORMAL, dvbs2.C9_10, dvbs2.MOD_OTHER) self.dvbs2_interleaver = dvbs2.interleaver_bb(dvbs2.FECFRAME_NORMAL, dvbs2.C9_10, dvbs2.MOD_16APSK) self.dvbs2_bbscrambler = dvbs2.bbscrambler_bb(dvbs2.FECFRAME_NORMAL, dvbs2.C9_10) self.dvbs2_bbheader = dvbs2.bbheader_bb(dvbs2.FECFRAME_NORMAL, dvbs2.C9_10, dvbs2.RO_0_20) self.dvb_bch = dtv.dvb_bch_bb(dtv.STANDARD_DVBS2, dtv.FECFRAME_NORMAL, dtv.C9_10) self._code_rate_qpsk_options = ["1/4", "1/3", "2/5", "1/2", "3/5", "2/3", "3/4", "4/5", "5/6", "8/9", "9/10"] self._code_rate_qpsk_labels = map(str, self._code_rate_qpsk_options) self._code_rate_qpsk_group_box = Qt.QGroupBox('Code Rate') self._code_rate_qpsk_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._code_rate_qpsk_button_group = variable_chooser_button_group() self._code_rate_qpsk_group_box.setLayout(self._code_rate_qpsk_box) for i, label in enumerate(self._code_rate_qpsk_labels): radio_button = Qt.QRadioButton(label) self._code_rate_qpsk_box.addWidget(radio_button) self._code_rate_qpsk_button_group.addButton(radio_button, i) self._code_rate_qpsk_callback = lambda i: Qt.QMetaObject.invokeMethod(self._code_rate_qpsk_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._code_rate_qpsk_options.index(i))) self._code_rate_qpsk_callback(self.code_rate_qpsk) self._code_rate_qpsk_button_group.buttonClicked[int].connect( lambda i: self.set_code_rate_qpsk(self._code_rate_qpsk_options[i])) self.constellation_tab_layout_0.addWidget(self._code_rate_qpsk_group_box) self._code_rate_8psk_options = ["3/5", "2/3", "3/4", "4/5", "5/6", "8/9", "9/10"] self._code_rate_8psk_labels = map(str, self._code_rate_8psk_options) self._code_rate_8psk_group_box = Qt.QGroupBox('Code Rate') self._code_rate_8psk_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._code_rate_8psk_button_group = variable_chooser_button_group() self._code_rate_8psk_group_box.setLayout(self._code_rate_8psk_box) for i, label in enumerate(self._code_rate_8psk_labels): radio_button = Qt.QRadioButton(label) self._code_rate_8psk_box.addWidget(radio_button) self._code_rate_8psk_button_group.addButton(radio_button, i) self._code_rate_8psk_callback = lambda i: Qt.QMetaObject.invokeMethod(self._code_rate_8psk_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._code_rate_8psk_options.index(i))) self._code_rate_8psk_callback(self.code_rate_8psk) self._code_rate_8psk_button_group.buttonClicked[int].connect( lambda i: self.set_code_rate_8psk(self._code_rate_8psk_options[i])) self.constellation_tab_layout_1.addWidget(self._code_rate_8psk_group_box) self._code_rate_32apsk_options = ["3/4", "4/5", "5/6", "8/9", "9/10"] self._code_rate_32apsk_labels = map(str, self._code_rate_32apsk_options) self._code_rate_32apsk_group_box = Qt.QGroupBox('Code Rate') self._code_rate_32apsk_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._code_rate_32apsk_button_group = variable_chooser_button_group() self._code_rate_32apsk_group_box.setLayout(self._code_rate_32apsk_box) for i, label in enumerate(self._code_rate_32apsk_labels): radio_button = Qt.QRadioButton(label) self._code_rate_32apsk_box.addWidget(radio_button) self._code_rate_32apsk_button_group.addButton(radio_button, i) self._code_rate_32apsk_callback = lambda i: Qt.QMetaObject.invokeMethod(self._code_rate_32apsk_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._code_rate_32apsk_options.index(i))) self._code_rate_32apsk_callback(self.code_rate_32apsk) self._code_rate_32apsk_button_group.buttonClicked[int].connect( lambda i: self.set_code_rate_32apsk(self._code_rate_32apsk_options[i])) self.constellation_tab_layout_3.addWidget(self._code_rate_32apsk_group_box) self._code_rate_16apsk_options = [ "2/3", "3/4", "4/5", "5/6", "8/9", "9/10"] self._code_rate_16apsk_labels = map(str, self._code_rate_16apsk_options) self._code_rate_16apsk_group_box = Qt.QGroupBox('Code Rate') self._code_rate_16apsk_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._code_rate_16apsk_button_group = variable_chooser_button_group() self._code_rate_16apsk_group_box.setLayout(self._code_rate_16apsk_box) for i, label in enumerate(self._code_rate_16apsk_labels): radio_button = Qt.QRadioButton(label) self._code_rate_16apsk_box.addWidget(radio_button) self._code_rate_16apsk_button_group.addButton(radio_button, i) self._code_rate_16apsk_callback = lambda i: Qt.QMetaObject.invokeMethod(self._code_rate_16apsk_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._code_rate_16apsk_options.index(i))) self._code_rate_16apsk_callback(self.code_rate_16apsk) self._code_rate_16apsk_button_group.buttonClicked[int].connect( lambda i: self.set_code_rate_16apsk(self._code_rate_16apsk_options[i])) self.constellation_tab_grid_layout_2.addWidget(self._code_rate_16apsk_group_box) _browse_button_push_button = Qt.QPushButton('Browse') self._browse_button_choices = {'Pressed': 1, 'Released': 0} _browse_button_push_button.pressed.connect(lambda: self.set_browse_button(self._browse_button_choices['Pressed'])) _browse_button_push_button.released.connect(lambda: self.set_browse_button(self._browse_button_choices['Released'])) self.top_grid_layout.addWidget(_browse_button_push_button, 0, 0, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.add_bloc = blocks.add_vcc(1) self._FEC_Frame_size_options = ('Normal', 'Short', ) self._FEC_Frame_size_labels = (str(self._FEC_Frame_size_options[0]), str(self._FEC_Frame_size_options[1]), ) self._FEC_Frame_size_group_box = Qt.QGroupBox('FEC Frame Size') self._FEC_Frame_size_box = Qt.QVBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._FEC_Frame_size_button_group = variable_chooser_button_group() self._FEC_Frame_size_group_box.setLayout(self._FEC_Frame_size_box) for i, label in enumerate(self._FEC_Frame_size_labels): radio_button = Qt.QRadioButton(label) self._FEC_Frame_size_box.addWidget(radio_button) self._FEC_Frame_size_button_group.addButton(radio_button, i) self._FEC_Frame_size_callback = lambda i: Qt.QMetaObject.invokeMethod(self._FEC_Frame_size_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._FEC_Frame_size_options.index(i))) self._FEC_Frame_size_callback(self.FEC_Frame_size) self._FEC_Frame_size_button_group.buttonClicked[int].connect( lambda i: self.set_FEC_Frame_size(self._FEC_Frame_size_options[i])) self.top_grid_layout.addWidget(self._FEC_Frame_size_group_box, 4, 1, 1, 1) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) ################################################## # Connections ################################################## self.connect((self.add_bloc, 0), (self.qtgui_freq_sink, 0)) self.connect((self.dvb_bch, 0), (self.dvbs2_ldpc, 0)) self.connect((self.dvbs2_bbheader, 0), (self.dvbs2_bbscrambler, 0)) self.connect((self.dvbs2_bbscrambler, 0), (self.dvb_bch, 0)) self.connect((self.dvbs2_interleaver, 0), (self.dvbs2_modulator, 0)) self.connect((self.dvbs2_ldpc, 0), (self.dvbs2_interleaver, 0)) self.connect((self.dvbs2_modulator, 0), (self.dvbs2_physical, 0)) self.connect((self.dvbs2_physical, 0), (self.fft_filter, 0)) self.connect((self.fft_filter, 0), (self.add_bloc, 0)) self.connect((self.file_source, 0), (self.dvbs2_bbheader, 0)) self.connect((self.noise_source, 0), (self.add_bloc, 1))
def __init__(self): gr.top_block.__init__(self, "PSK Receiver") Qt.QWidget.__init__(self) self.setWindowTitle("PSK Receiver") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "psk_rx") 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.preamble_and_padding = preamble_and_padding = np.array( [255, 195, 204, 192], dtype=np.uint8) self.payload_size = payload_size = 28 self.frame_size = frame_size = len(preamble_and_padding) + payload_size self.modulation = modulation = sksdr.QPSK self.frame_size_bits = frame_size_bits = frame_size * 8 self.upsampling = upsampling = 4 self.frame_size_symbols = frame_size_symbols = frame_size_bits // modulation.bits_per_symbol self.frame_size_samples_before_downsampling = frame_size_samples_before_downsampling = frame_size_symbols * upsampling self.downsampling = downsampling = 2 self.samp_rate = samp_rate = 1.024e6 self.rx_filter_sps = rx_filter_sps = int(upsampling / downsampling) self.rrc_coeffs = rrc_coeffs = sksdr.rrc(upsampling, 0.5, 10) self.msg_size = msg_size = 11 + 4 self.mod_preamble = mod_preamble = np.array([ -0.7071067811865477 - 0.7071067811865475j, -0.7071067811865477 - 0.7071067811865475j, -0.7071067811865477 - 0.7071067811865475j, -0.7071067811865477 - 0.7071067811865475j, -0.7071067811865477 - 0.7071067811865475j, 0.7071067811865476 + 0.7071067811865475j, 0.7071067811865476 + 0.7071067811865475j, -0.7071067811865477 - 0.7071067811865475j, -0.7071067811865477 - 0.7071067811865475j, 0.7071067811865476 + 0.7071067811865475j, -0.7071067811865477 - 0.7071067811865475j, 0.7071067811865476 + 0.7071067811865475j, -0.7071067811865477 - 0.7071067811865475j, 0.7071067811865476 + 0.7071067811865475j, 0.7071067811865476 + 0.7071067811865475j, 0.7071067811865476 + 0.7071067811865475j ]) self.mod_phase_offset = mod_phase_offset = np.pi / 4 self.mod_labels = mod_labels = [0, 1, 3, 2] self.mod_amplitude = mod_amplitude = 1 self.freq_correction = freq_correction = 40 self.freq = freq = 220e6 self.frame_size_samples_after_downsampling = frame_size_samples_after_downsampling = frame_size_samples_before_downsampling // downsampling self.frac_resampling = frac_resampling = 5 ################################################## # Blocks ################################################## self.stream_demux_stream_demux_0 = stream_demux_swig.stream_demux( gr.sizeof_char * 1, [len(preamble_and_padding), payload_size]) self.grsksdr_symbol_sync_0 = grsksdr.symbol_sync( 'sksdr.QPSK', rx_filter_sps, 1, 0.01, 1, 1 / np.sqrt(2)) self.grsksdr_psk_demod_0 = grsksdr.psk_demod('sksdr.QPSK', mod_labels, mod_amplitude, mod_phase_offset) self.grsksdr_phase_offset_est_0 = grsksdr.phase_offset_est( mod_preamble, frame_size_symbols) self.grsksdr_freq_sync_0 = grsksdr.freq_sync('sksdr.QPSK', rx_filter_sps, 1, 0.01) self.grsksdr_frame_sync_0 = grsksdr.frame_sync(mod_preamble, 8.0, frame_size_symbols) self.grsksdr_fir_decimator_0 = grsksdr.fir_decimator( downsampling, rrc_coeffs) self.grsksdr_descrambler_0 = grsksdr.descrambler( [1, 0, 1, 1, 0, 1, 0, 1], [0, 3, 2, 2, 5, 1, 7]) self.grsksdr_coarse_freq_comp_0 = grsksdr.coarse_freq_comp( modulation.order, samp_rate / 2, 1, frame_size_samples_after_downsampling) self.grsksdr_agc_1 = grsksdr.agc( 0.25, 60, 0.01, frame_size_samples_before_downsampling) self.epy_block_0 = epy_block_0.blk(message_size=msg_size, payload_size=payload_size) self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb( modulation.bits_per_symbol, gr.GR_MSB_FIRST) self.blocks_throttle_1 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_null_sink_0_0_1 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_null_sink_0_0_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_char * 1) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char * 1) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, 'test.iq', True, 0, 0) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_1, 0)) self.connect((self.blocks_throttle_1, 0), (self.grsksdr_agc_1, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.stream_demux_stream_demux_0, 0)) self.connect((self.epy_block_0, 0), (self.blocks_null_sink_0_0, 0)) self.connect((self.grsksdr_agc_1, 0), (self.grsksdr_fir_decimator_0, 0)) self.connect((self.grsksdr_coarse_freq_comp_0, 0), (self.grsksdr_freq_sync_0, 0)) self.connect((self.grsksdr_descrambler_0, 0), (self.epy_block_0, 0)) self.connect((self.grsksdr_fir_decimator_0, 0), (self.grsksdr_coarse_freq_comp_0, 0)) self.connect((self.grsksdr_frame_sync_0, 0), (self.blocks_null_sink_0_0_0, 0)) self.connect((self.grsksdr_frame_sync_0, 0), (self.grsksdr_phase_offset_est_0, 0)) self.connect((self.grsksdr_freq_sync_0, 0), (self.grsksdr_symbol_sync_0, 0)) self.connect((self.grsksdr_phase_offset_est_0, 0), (self.grsksdr_psk_demod_0, 0)) self.connect((self.grsksdr_psk_demod_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0)) self.connect((self.grsksdr_symbol_sync_0, 0), (self.blocks_null_sink_0_0_1, 0)) self.connect((self.grsksdr_symbol_sync_0, 0), (self.grsksdr_frame_sync_0, 0)) self.connect((self.stream_demux_stream_demux_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.stream_demux_stream_demux_0, 1), (self.grsksdr_descrambler_0, 0))
def __init__(self): gr.top_block.__init__(self, "Novo") Qt.QWidget.__init__(self) self.setWindowTitle("Novo") 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", "novo") self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.sps = sps = 2 self.nfilts = nfilts = 32 self.eb = eb = 0.22 self.tx_rrc_taps = tx_rrc_taps = firdes.root_raised_cosine( nfilts, nfilts, 1.0, eb, 5 * sps * nfilts) self.Const_HDR = Const_HDR = digital.constellation_calcdist( (digital.psk_2()[0]), (digital.psk_2()[1]), 2, 1).base() self.Const_HDR.gen_soft_dec_lut(8) self.taps_per_filt = taps_per_filt = len(tx_rrc_taps) / nfilts self.rxmod = rxmod = digital.generic_mod(Const_HDR, False, sps, True, eb, False, False) self.preamble = preamble = [ 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc ] self.mark_delays = mark_delays = [0, 0, 34, 56, 87, 119] self.snc_threshold = snc_threshold = 0.9 self.samp_rate = samp_rate = 32000 self.rx_rrc_taps = rx_rrc_taps = firdes.root_raised_cosine( nfilts, sps * nfilts, 1.0, eb, 11 * sps * nfilts) self.packet_len_tag_key = packet_len_tag_key = "packet_length" self.packet_len = packet_len = 100 self.ntaps = ntaps = len(tx_rrc_taps) self.noise_voltage = noise_voltage = 1 self.modulated_sync_word = modulated_sync_word = digital.modulate_vector_bc( rxmod.to_basic_block(), (preamble), ([1])) self.mark_delay = mark_delay = mark_delays[sps] self.hdr_format = hdr_format = digital.header_format_default( digital.packet_utils.default_access_code, 1, 1) self.freq_offset = freq_offset = 0 self.filt_delay = filt_delay = 1 + (taps_per_filt - 1) / 2 self.enc_hdr = enc_hdr = fec.dummy_encoder_make(8000) self.enc = enc = fec.dummy_encoder_make(8000) self.dec_hdr = dec_hdr = fec.dummy_decoder.make(8000) self.Const_PLD = Const_PLD = digital.constellation_calcdist( (digital.psk_2()[0]), (digital.psk_2()[1]), 2, 1).base() self.Const_PLD.gen_soft_dec_lut(8) ################################################## # Blocks ################################################## self._noise_voltage_range = Range(0, 8, .05, 1, 200) self._noise_voltage_win = RangeWidget(self._noise_voltage_range, self.set_noise_voltage, 'Noise Amplitude', "counter_slider", float) self.top_grid_layout.addWidget(self._noise_voltage_win) self._freq_offset_range = Range(-30, 30, .1, 0, 200) self._freq_offset_win = RangeWidget( self._freq_offset_range, self.set_freq_offset, 'Frequency Offset (Multiples of Sub-carrier spacing)', "counter_slider", float) self.top_grid_layout.addWidget(self._freq_offset_win) self._snc_threshold_range = Range(0, 1, .05, 0.9, 200) self._snc_threshold_win = RangeWidget(self._snc_threshold_range, self.set_snc_threshold, 'S&C Threshold', "counter_slider", float) self.top_grid_layout.addWidget(self._snc_threshold_win) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( packet_len * 3, #size samp_rate, #samp_rate 'Tx Data', #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0.set_y_axis(-1, 256) 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(True) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(False) self.qtgui_time_sink_x_0_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( packet_len * 2, #size samp_rate, #samp_rate 'Rx Data', #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_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, 'packet_length_tag_key') self.qtgui_time_sink_x_0.enable_autoscale(True) self.qtgui_time_sink_x_0.enable_grid(True) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw 'Rx Spectrum', #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-60, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['Rx Spectrum', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.pfb_arb_resampler_xxx_0_0 = pfb.arb_resampler_ccf( sps, taps=(tx_rrc_taps), flt_size=nfilts) self.pfb_arb_resampler_xxx_0_0.declare_sample_delay(filt_delay) self.digital_protocol_parser_b_0 = digital.protocol_parser_b( hdr_format) self.digital_protocol_formatter_bb_0 = digital.protocol_formatter_bb( hdr_format, packet_len_tag_key) self.digital_pfb_clock_sync_xxx_0_1 = digital.pfb_clock_sync_ccf( sps, 6.28 / 400.0, (rx_rrc_taps), nfilts, nfilts / 2, 1.5, 1) self.digital_map_bb_1_0 = digital.map_bb((Const_PLD.pre_diff_code())) self.digital_map_bb_1 = digital.map_bb((Const_HDR.pre_diff_code())) self.digital_header_payload_demux_0 = digital.header_payload_demux( hdr_format.header_nbits() / Const_HDR.bits_per_symbol(), 1, 0, "payload symbols", "time_est", True, gr.sizeof_gr_complex, "rx_time", sps, "", 0, ) self.digital_corr_est_cc_0_0 = digital.corr_est_cc( (modulated_sync_word), 1, mark_delay, 0.999) self.digital_constellation_soft_decoder_cf_0_1 = digital.constellation_soft_decoder_cf( Const_PLD) self.digital_constellation_soft_decoder_cf_0_0 = digital.constellation_soft_decoder_cf( Const_HDR) self.digital_chunks_to_symbols_xx_0_0 = digital.chunks_to_symbols_bc( (Const_PLD.points()), 1) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc( (Const_HDR.points()), 1) self.digital_burst_shaper_xx_0_0 = digital.burst_shaper_cc( (firdes.window(firdes.WIN_HANN, 20, 0)), 0, filt_delay, True, packet_len_tag_key) (self.digital_burst_shaper_xx_0_0).set_block_alias("burst_shaper0") self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.channels_channel_model_0 = channels.channel_model( noise_voltage=0, frequency_offset=freq_offset * 1.0 / packet_len, epsilon=1.0, taps=(1.0 + 1.0j, ), noise_seed=0, block_tags=True) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux( gr.sizeof_gr_complex * 1, packet_len_tag_key, 0) self.blocks_tagged_stream_multiply_length_0_1 = blocks.tagged_stream_multiply_length( gr.sizeof_gr_complex * 1, packet_len_tag_key, sps) self.blocks_tag_debug_0_0_0 = blocks.tag_debug(gr.sizeof_char * 1, 'TAGGED', "") self.blocks_tag_debug_0_0_0.set_display(True) self.blocks_tag_debug_0_0 = blocks.tag_debug(gr.sizeof_gr_complex * 1, 'MUX', "") self.blocks_tag_debug_0_0.set_display(True) self.blocks_stream_to_tagged_stream_0_0 = blocks.stream_to_tagged_stream( gr.sizeof_char, 1, packet_len, packet_len_tag_key) self.blocks_repack_bits_bb_1_0 = blocks.repack_bits_bb( 1, 8, "", False, gr.GR_MSB_FIRST) self.blocks_repack_bits_bb_1 = blocks.repack_bits_bb( 1, 8, "", False, gr.GR_MSB_FIRST) self.blocks_repack_bits_bb_0_0 = blocks.repack_bits_bb( 8, Const_PLD.bits_per_symbol(), packet_len_tag_key, False, gr.GR_MSB_FIRST) self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb( 8, Const_HDR.bits_per_symbol(), packet_len_tag_key, False, gr.GR_MSB_FIRST) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_char * 1, '/home/andre/Desktop/trasmit_1_mb.txt', True) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.blocks_file_sink_0_0_0_0 = blocks.file_sink( gr.sizeof_char * 1, 'depois.txt', False) self.blocks_file_sink_0_0_0_0.set_unbuffered(False) self.blocks_char_to_float_1_0_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_1_0 = blocks.char_to_float(1, 1) ################################################## # Connections ################################################## self.msg_connect((self.digital_protocol_parser_b_0, 'info'), (self.digital_header_payload_demux_0, 'header_data')) self.connect((self.blocks_char_to_float_1_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_char_to_float_1_0_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_stream_to_tagged_stream_0_0, 0)) self.connect((self.blocks_repack_bits_bb_0, 0), (self.digital_map_bb_1, 0)) self.connect((self.blocks_repack_bits_bb_0_0, 0), (self.digital_map_bb_1_0, 0)) self.connect((self.blocks_repack_bits_bb_1, 0), (self.blocks_char_to_float_1_0, 0)) self.connect((self.blocks_repack_bits_bb_1, 0), (self.blocks_file_sink_0_0_0_0, 0)) self.connect((self.blocks_repack_bits_bb_1_0, 0), (self.digital_protocol_parser_b_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_0_0, 0), (self.blocks_char_to_float_1_0_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_0_0, 0), (self.blocks_repack_bits_bb_0_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_0_0, 0), (self.digital_protocol_formatter_bb_0, 0)) self.connect((self.blocks_tagged_stream_multiply_length_0_1, 0), (self.channels_channel_model_0, 0)) self.connect((self.blocks_tagged_stream_mux_0, 0), (self.blocks_tag_debug_0_0, 0)) self.connect((self.blocks_tagged_stream_mux_0, 0), (self.digital_burst_shaper_xx_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.digital_corr_est_cc_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_repack_bits_bb_1, 0)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.blocks_repack_bits_bb_1_0, 0)) self.connect((self.digital_burst_shaper_xx_0_0, 0), (self.pfb_arb_resampler_xxx_0_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_tagged_stream_mux_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0_0, 0), (self.blocks_tagged_stream_mux_0, 1)) self.connect((self.digital_constellation_soft_decoder_cf_0_0, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.digital_constellation_soft_decoder_cf_0_1, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_corr_est_cc_0_0, 0), (self.digital_pfb_clock_sync_xxx_0_1, 0)) self.connect((self.digital_header_payload_demux_0, 0), (self.digital_constellation_soft_decoder_cf_0_0, 0)) self.connect((self.digital_header_payload_demux_0, 1), (self.digital_constellation_soft_decoder_cf_0_1, 0)) self.connect((self.digital_map_bb_1, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.digital_map_bb_1_0, 0), (self.digital_chunks_to_symbols_xx_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_1, 0), (self.digital_header_payload_demux_0, 0)) self.connect((self.digital_protocol_formatter_bb_0, 0), (self.blocks_repack_bits_bb_0, 0)) self.connect((self.digital_protocol_formatter_bb_0, 0), (self.blocks_tag_debug_0_0_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0_0, 0), (self.blocks_tagged_stream_multiply_length_0_1, 0))
def __init__(self): gr.top_block.__init__(self, "Analyzing interference") Qt.QWidget.__init__(self) self.setWindowTitle("Analyzing interference") 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", "comb") 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.xlate_bandwidth = xlate_bandwidth = 12000 self.tuning_freq = tuning_freq = 3330000 self.samp_rate_2 = samp_rate_2 = 6000000 / 64 self.samp_rate = samp_rate = 6000000 self.freq_offset = freq_offset = 3318730 ################################################## # Blocks ################################################## self._tuning_freq_range = Range(0, 6000000, 100, 3330000, 200) self._tuning_freq_win = RangeWidget(self._tuning_freq_range, self.set_tuning_freq, 'tuning_freq', "counter_slider", float) self.top_grid_layout.addWidget(self._tuning_freq_win) self.qtgui_waterfall_sink_x_1 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 2681270, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_1.set_update_time(0.10) self.qtgui_waterfall_sink_x_1.enable_grid(False) self.qtgui_waterfall_sink_x_1.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_1.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_1.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_1.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_1.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_1_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_1.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_1_win) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate_2, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.001) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 1024, #size samp_rate_2, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.5, 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(True) self.qtgui_time_sink_x_0.enable_stem_plot(False) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ 'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue' ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(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.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 64, firdes.low_pass(1, samp_rate, xlate_bandwidth, 3000), tuning_freq + freq_offset, samp_rate) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(.3) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, '/home/mg/Documents/signals/SDRuno_20200912_190336Z_2681kHz.cf32', True, 0, 0) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.audio_sink_0 = audio.sink(48000, '', True) self.analog_am_demod_cf_0 = analog.am_demod_cf( channel_rate=samp_rate_2, audio_decim=2, audio_pass=5000, audio_stop=5500, ) self.analog_agc_xx_0 = analog.agc_cc(6.25e-4, 1.0, 1.0) self.analog_agc_xx_0.set_max_gain(128) ################################################## # Connections ################################################## self.connect((self.analog_agc_xx_0, 0), (self.analog_am_demod_cf_0, 0)) self.connect((self.analog_agc_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.analog_agc_xx_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.analog_am_demod_cf_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.qtgui_waterfall_sink_x_1, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_agc_xx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Nsf PlutoSdr Event Detect: 4.5MHz") Qt.QWidget.__init__(self) self.setWindowTitle("Nsf PlutoSdr Event Detect: 4.5MHz") 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", "NsfDetectHist45") self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.ObsName = ObsName = "Detect45" self.ConfigFile = ConfigFile = ObsName + ".conf" self._telescope_save_config = ConfigParser.ConfigParser() self._telescope_save_config.read(ConfigFile) try: telescope_save = self._telescope_save_config.get( 'main', 'telescope') except: telescope_save = 'My Horn' self.telescope_save = telescope_save self._observer_save_config = ConfigParser.ConfigParser() self._observer_save_config.read(ConfigFile) try: observer_save = self._observer_save_config.get('main', 'observer') except: observer_save = 'Science Aficionado' self.observer_save = observer_save self._fftsize_save_config = ConfigParser.ConfigParser() self._fftsize_save_config.read(ConfigFile) try: fftsize_save = self._fftsize_save_config.getint( 'main', 'samplesize') except: fftsize_save = 1024 self.fftsize_save = fftsize_save self._device_save_config = ConfigParser.ConfigParser() self._device_save_config.read(ConfigFile) try: device_save = self._device_save_config.get('main', 'device') except: device_save = '192.168.2.1' self.device_save = device_save self._Gain1s_config = ConfigParser.ConfigParser() self._Gain1s_config.read(ConfigFile) try: Gain1s = self._Gain1s_config.getfloat('main', 'gain1') except: Gain1s = 49. self.Gain1s = Gain1s self._Frequencys_config = ConfigParser.ConfigParser() self._Frequencys_config.read(ConfigFile) try: Frequencys = self._Frequencys_config.getfloat('main', 'frequency') except: Frequencys = 1420.4e6 self.Frequencys = Frequencys self._Elevation_save_config = ConfigParser.ConfigParser() self._Elevation_save_config.read(ConfigFile) try: Elevation_save = self._Elevation_save_config.getfloat( 'main', 'elevation') except: Elevation_save = 90. self.Elevation_save = Elevation_save self._Bandwidths_config = ConfigParser.ConfigParser() self._Bandwidths_config.read(ConfigFile) try: Bandwidths = self._Bandwidths_config.getfloat('main', 'bandwidth') except: Bandwidths = 4.5e6 self.Bandwidths = Bandwidths self._Azimuth_save_config = ConfigParser.ConfigParser() self._Azimuth_save_config.read(ConfigFile) try: Azimuth_save = self._Azimuth_save_config.getfloat( 'main', 'azimuth') except: Azimuth_save = 180. self.Azimuth_save = Azimuth_save self.nsigma = nsigma = 5.0 self.fftsize = fftsize = fftsize_save self.Telescope = Telescope = telescope_save self.Observer = Observer = observer_save self.Mode = Mode = 2 self.Gain1 = Gain1 = Gain1s self.Frequency = Frequency = Frequencys self.EventMode = EventMode = 0 self.Elevation = Elevation = Elevation_save self.Device = Device = device_save self.Bandwidth = Bandwidth = Bandwidths self.Azimuth = Azimuth = Azimuth_save ################################################## # Blocks ################################################## self._nsigma_range = Range(0., 10., .1, 5.0, 100) self._nsigma_win = RangeWidget(self._nsigma_range, self.set_nsigma, 'N Sigma', "counter", float) self.top_grid_layout.addWidget(self._nsigma_win, 2, 7, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 9): self.top_grid_layout.setColumnStretch(c, 1) self._fftsize_tool_bar = Qt.QToolBar(self) self._fftsize_tool_bar.addWidget(Qt.QLabel('Sample_Size' + ": ")) self._fftsize_line_edit = Qt.QLineEdit(str(self.fftsize)) self._fftsize_tool_bar.addWidget(self._fftsize_line_edit) self._fftsize_line_edit.returnPressed.connect( lambda: self.set_fftsize(int(str(self._fftsize_line_edit.text())))) self.top_grid_layout.addWidget(self._fftsize_tool_bar, 1, 2, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._Telescope_tool_bar = Qt.QToolBar(self) self._Telescope_tool_bar.addWidget(Qt.QLabel('Tel' + ": ")) self._Telescope_line_edit = Qt.QLineEdit(str(self.Telescope)) self._Telescope_tool_bar.addWidget(self._Telescope_line_edit) self._Telescope_line_edit.returnPressed.connect( lambda: self.set_Telescope( str(str(self._Telescope_line_edit.text())))) self.top_grid_layout.addWidget(self._Telescope_tool_bar, 1, 0, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Observer_tool_bar = Qt.QToolBar(self) self._Observer_tool_bar.addWidget(Qt.QLabel('Who' + ": ")) self._Observer_line_edit = Qt.QLineEdit(str(self.Observer)) self._Observer_tool_bar.addWidget(self._Observer_line_edit) self._Observer_line_edit.returnPressed.connect( lambda: self.set_Observer(str(str(self._Observer_line_edit.text())) )) self.top_grid_layout.addWidget(self._Observer_tool_bar, 0, 0, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Mode_options = ( 0, 2, ) self._Mode_labels = ( 'Monitor', 'Detect', ) self._Mode_tool_bar = Qt.QToolBar(self) self._Mode_tool_bar.addWidget(Qt.QLabel('Data Mode' + ": ")) self._Mode_combo_box = Qt.QComboBox() self._Mode_tool_bar.addWidget(self._Mode_combo_box) for label in self._Mode_labels: self._Mode_combo_box.addItem(label) self._Mode_callback = lambda i: Qt.QMetaObject.invokeMethod( self._Mode_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._Mode_options.index(i))) self._Mode_callback(self.Mode) self._Mode_combo_box.currentIndexChanged.connect( lambda i: self.set_Mode(self._Mode_options[i])) self.top_grid_layout.addWidget(self._Mode_tool_bar, 2, 5, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 7): self.top_grid_layout.setColumnStretch(c, 1) self._Gain1_tool_bar = Qt.QToolBar(self) self._Gain1_tool_bar.addWidget(Qt.QLabel('Gain1' + ": ")) self._Gain1_line_edit = Qt.QLineEdit(str(self.Gain1)) self._Gain1_tool_bar.addWidget(self._Gain1_line_edit) self._Gain1_line_edit.returnPressed.connect(lambda: self.set_Gain1( eng_notation.str_to_num(str(self._Gain1_line_edit.text())))) self.top_grid_layout.addWidget(self._Gain1_tool_bar, 0, 2, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._Frequency_tool_bar = Qt.QToolBar(self) self._Frequency_tool_bar.addWidget(Qt.QLabel('Freq. Hz' + ": ")) self._Frequency_line_edit = Qt.QLineEdit(str(self.Frequency)) self._Frequency_tool_bar.addWidget(self._Frequency_line_edit) self._Frequency_line_edit.returnPressed.connect( lambda: self.set_Frequency( eng_notation.str_to_num(str(self._Frequency_line_edit.text())) )) self.top_grid_layout.addWidget(self._Frequency_tool_bar, 0, 5, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 7): self.top_grid_layout.setColumnStretch(c, 1) self._EventMode_options = ( 0, 1, ) self._EventMode_labels = ( 'Wait', 'Write', ) self._EventMode_tool_bar = Qt.QToolBar(self) self._EventMode_tool_bar.addWidget(Qt.QLabel('Write Mode' + ": ")) self._EventMode_combo_box = Qt.QComboBox() self._EventMode_tool_bar.addWidget(self._EventMode_combo_box) for label in self._EventMode_labels: self._EventMode_combo_box.addItem(label) self._EventMode_callback = lambda i: Qt.QMetaObject.invokeMethod( self._EventMode_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._EventMode_options.index(i))) self._EventMode_callback(self.EventMode) self._EventMode_combo_box.currentIndexChanged.connect( lambda i: self.set_EventMode(self._EventMode_options[i])) self.top_grid_layout.addWidget(self._EventMode_tool_bar, 2, 2, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._Elevation_tool_bar = Qt.QToolBar(self) self._Elevation_tool_bar.addWidget(Qt.QLabel('Elevation' + ": ")) self._Elevation_line_edit = Qt.QLineEdit(str(self.Elevation)) self._Elevation_tool_bar.addWidget(self._Elevation_line_edit) self._Elevation_line_edit.returnPressed.connect( lambda: self.set_Elevation( eng_notation.str_to_num(str(self._Elevation_line_edit.text())) )) self.top_grid_layout.addWidget(self._Elevation_tool_bar, 1, 7, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 9): self.top_grid_layout.setColumnStretch(c, 1) self._Device_tool_bar = Qt.QToolBar(self) self._Device_tool_bar.addWidget(Qt.QLabel('Dev' + ": ")) self._Device_line_edit = Qt.QLineEdit(str(self.Device)) self._Device_tool_bar.addWidget(self._Device_line_edit) self._Device_line_edit.returnPressed.connect( lambda: self.set_Device(str(str(self._Device_line_edit.text())))) self.top_grid_layout.addWidget(self._Device_tool_bar, 2, 0, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Bandwidth_tool_bar = Qt.QToolBar(self) self._Bandwidth_tool_bar.addWidget(Qt.QLabel('Bandwidth' + ": ")) self._Bandwidth_line_edit = Qt.QLineEdit(str(self.Bandwidth)) self._Bandwidth_tool_bar.addWidget(self._Bandwidth_line_edit) self._Bandwidth_line_edit.returnPressed.connect( lambda: self.set_Bandwidth( eng_notation.str_to_num(str(self._Bandwidth_line_edit.text())) )) self.top_grid_layout.addWidget(self._Bandwidth_tool_bar, 1, 5, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 7): self.top_grid_layout.setColumnStretch(c, 1) self._Azimuth_tool_bar = Qt.QToolBar(self) self._Azimuth_tool_bar.addWidget(Qt.QLabel('Azimuth' + ": ")) self._Azimuth_line_edit = Qt.QLineEdit(str(self.Azimuth)) self._Azimuth_tool_bar.addWidget(self._Azimuth_line_edit) self._Azimuth_line_edit.returnPressed.connect(lambda: self.set_Azimuth( eng_notation.str_to_num(str(self._Azimuth_line_edit.text())))) self.top_grid_layout.addWidget(self._Azimuth_tool_bar, 0, 7, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 9): self.top_grid_layout.setColumnStretch(c, 1) self.radio_astro_ra_event_sink_0 = radio_astro.ra_event_sink( ObsName + ".not", fftsize, Frequency * 1.E-6, Bandwidth * 1.E-6, EventMode, 'Event Detection', Observer, Telescope, Device, float(Gain1), Azimuth, Elevation) self.radio_astro_detect_0 = radio_astro.detect( fftsize, nsigma, Frequency, Bandwidth, fftsize * 1.e-6 / Bandwidth, Mode) self.qtgui_histogram_sink_x_0 = qtgui.histogram_sink_f( fftsize, 100, -.5, .5, "", 2) self.qtgui_histogram_sink_x_0.set_update_time(1) self.qtgui_histogram_sink_x_0.enable_autoscale(True) self.qtgui_histogram_sink_x_0.enable_accumulate(False) self.qtgui_histogram_sink_x_0.enable_grid(False) self.qtgui_histogram_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_histogram_sink_x_0.disable_legend() labels = ['I', 'Q', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] 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_histogram_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_histogram_sink_x_0.set_line_label(i, labels[i]) self.qtgui_histogram_sink_x_0.set_line_width(i, widths[i]) self.qtgui_histogram_sink_x_0.set_line_color(i, colors[i]) self.qtgui_histogram_sink_x_0.set_line_style(i, styles[i]) self.qtgui_histogram_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_histogram_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_histogram_sink_x_0_win = sip.wrapinstance( self.qtgui_histogram_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_histogram_sink_x_0_win, 3, 0, 2, 5) for r in range(3, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 5): self.top_grid_layout.setColumnStretch(c, 1) self.pluto_source_0 = iio.pluto_source('192.168.2.1', int(int(Frequency)), int(int(Bandwidth)), int(20000000), 0x8000, False, False, True, "manual", float(Gain1), '', True) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, fftsize) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_float_0, 1), (self.qtgui_histogram_sink_x_0, 1)) self.connect((self.blocks_complex_to_float_0, 0), (self.qtgui_histogram_sink_x_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.radio_astro_detect_0, 0)) self.connect((self.pluto_source_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.pluto_source_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.radio_astro_detect_0, 0), (self.radio_astro_ra_event_sink_0, 0))
def __init__(self): gr.top_block.__init__(self, "Wifi Rx") Qt.QWidget.__init__(self) self.setWindowTitle("Wifi Rx") 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", "wifi_rx") self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.window_size = window_size = 48 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 10e6 self.lo_offset = lo_offset = 0 self.gain = gain = 0.75 self.freq = freq = 5890000000 self.chan_est = chan_est = 0 ################################################## # Blocks ################################################## self._samp_rate_options = [5e6, 10e6, 20e6] self._samp_rate_labels = ["5 MHz", "10 MHz", "20 MHz"] self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel("samp_rate" + ": ")) self._samp_rate_combo_box = Qt.QComboBox() self._samp_rate_tool_bar.addWidget(self._samp_rate_combo_box) for label in self._samp_rate_labels: self._samp_rate_combo_box.addItem(label) self._samp_rate_callback = lambda i: Qt.QMetaObject.invokeMethod( self._samp_rate_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._samp_rate_options.index(i))) self._samp_rate_callback(self.samp_rate) self._samp_rate_combo_box.currentIndexChanged.connect( lambda i: self.set_samp_rate(self._samp_rate_options[i])) self.top_grid_layout.addWidget(self._samp_rate_tool_bar) self._lo_offset_options = ( 0, 6e6, 11e6, ) self._lo_offset_labels = ( str(self._lo_offset_options[0]), str(self._lo_offset_options[1]), str(self._lo_offset_options[2]), ) self._lo_offset_tool_bar = Qt.QToolBar(self) self._lo_offset_tool_bar.addWidget(Qt.QLabel("lo_offset" + ": ")) self._lo_offset_combo_box = Qt.QComboBox() self._lo_offset_tool_bar.addWidget(self._lo_offset_combo_box) for label in self._lo_offset_labels: self._lo_offset_combo_box.addItem(label) self._lo_offset_callback = lambda i: Qt.QMetaObject.invokeMethod( self._lo_offset_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._lo_offset_options.index(i))) self._lo_offset_callback(self.lo_offset) self._lo_offset_combo_box.currentIndexChanged.connect( lambda i: self.set_lo_offset(self._lo_offset_options[i])) self.top_grid_layout.addWidget(self._lo_offset_tool_bar) self._gain_range = Range(0, 1, 0.01, 0.75, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain", "counter_slider", float) self.top_grid_layout.addWidget(self._gain_win) self._freq_options = [ 2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0, 2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0, 2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0, 2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0, 5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0, 5230000000.0, 5240000000.0, 5250000000.0, 5260000000.0, 5270000000.0, 5280000000.0, 5290000000.0, 5300000000.0, 5310000000.0, 5320000000.0, 5500000000.0, 5510000000.0, 5520000000.0, 5530000000.0, 5540000000.0, 5550000000.0, 5560000000.0, 5570000000.0, 5580000000.0, 5590000000.0, 5600000000.0, 5610000000.0, 5620000000.0, 5630000000.0, 5640000000.0, 5660000000.0, 5670000000.0, 5680000000.0, 5690000000.0, 5700000000.0, 5710000000.0, 5720000000.0, 5745000000.0, 5755000000.0, 5765000000.0, 5775000000.0, 5785000000.0, 5795000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0 ] self._freq_labels = [ ' 1 | 2412.0 | 11g', ' 2 | 2417.0 | 11g', ' 3 | 2422.0 | 11g', ' 4 | 2427.0 | 11g', ' 5 | 2432.0 | 11g', ' 6 | 2437.0 | 11g', ' 7 | 2442.0 | 11g', ' 8 | 2447.0 | 11g', ' 9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g', ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g', ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g', ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a', ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a', ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a', ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a', ' 50 | 5250.0 | 11a', ' 52 | 5260.0 | 11a', ' 54 | 5270.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5290.0 | 11a', ' 60 | 5300.0 | 11a', ' 62 | 5310.0 | 11a', ' 64 | 5320.0 | 11a', '100 | 5500.0 | 11a', '102 | 5510.0 | 11a', '104 | 5520.0 | 11a', '106 | 5530.0 | 11a', '108 | 5540.0 | 11a', '110 | 5550.0 | 11a', '112 | 5560.0 | 11a', '114 | 5570.0 | 11a', '116 | 5580.0 | 11a', '118 | 5590.0 | 11a', '120 | 5600.0 | 11a', '122 | 5610.0 | 11a', '124 | 5620.0 | 11a', '126 | 5630.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '134 | 5670.0 | 11a', '136 | 5680.0 | 11a', '138 | 5690.0 | 11a', '140 | 5700.0 | 11a', '142 | 5710.0 | 11a', '144 | 5720.0 | 11a', '149 | 5745.0 | 11a (SRD)', '151 | 5755.0 | 11a (SRD)', '153 | 5765.0 | 11a (SRD)', '155 | 5775.0 | 11a (SRD)', '157 | 5785.0 | 11a (SRD)', '159 | 5795.0 | 11a (SRD)', '161 | 5805.0 | 11a (SRD)', '165 | 5825.0 | 11a (SRD)', '172 | 5860.0 | 11p', '174 | 5870.0 | 11p', '176 | 5880.0 | 11p', '178 | 5890.0 | 11p', '180 | 5900.0 | 11p', '182 | 5910.0 | 11p', '184 | 5920.0 | 11p' ] self._freq_tool_bar = Qt.QToolBar(self) self._freq_tool_bar.addWidget(Qt.QLabel("freq" + ": ")) self._freq_combo_box = Qt.QComboBox() self._freq_tool_bar.addWidget(self._freq_combo_box) for label in self._freq_labels: self._freq_combo_box.addItem(label) self._freq_callback = lambda i: Qt.QMetaObject.invokeMethod( self._freq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._freq_options.index(i))) self._freq_callback(self.freq) self._freq_combo_box.currentIndexChanged.connect( lambda i: self.set_freq(self._freq_options[i])) self.top_grid_layout.addWidget(self._freq_tool_bar) self._chan_est_options = [ ieee802_11.LS, ieee802_11.LMS, ieee802_11.STA, ieee802_11.COMB ] self._chan_est_labels = ["LS", "LMS", "STA", "Linear Comb"] self._chan_est_group_box = Qt.QGroupBox("chan_est") self._chan_est_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._chan_est_button_group = variable_chooser_button_group() self._chan_est_group_box.setLayout(self._chan_est_box) for i, label in enumerate(self._chan_est_labels): radio_button = Qt.QRadioButton(label) self._chan_est_box.addWidget(radio_button) self._chan_est_button_group.addButton(radio_button, i) self._chan_est_callback = lambda i: Qt.QMetaObject.invokeMethod( self._chan_est_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._chan_est_options.index(i))) self._chan_est_callback(self.chan_est) self._chan_est_button_group.buttonClicked[int].connect( lambda i: self.set_chan_est(self._chan_est_options[i])) self.top_grid_layout.addWidget(self._chan_est_group_box) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("serial=F5EAC0", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq( uhd.tune_request(freq, rf_freq=freq - lo_offset, rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0) self.uhd_usrp_source_0.set_normalized_gain(gain, 0) self.uhd_usrp_source_0.set_antenna('RX2', 0) self.uhd_usrp_source_0.set_auto_dc_offset(False, 0) self.uhd_usrp_source_0.set_auto_iq_balance(False, 0) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 48 * 10, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win) self.ieee802_11_sync_short_0 = ieee802_11.sync_short( 0.56, 2, False, False) self.ieee802_11_sync_long_0 = ieee802_11.sync_long( sync_length, True, False) self.ieee802_11_parse_mac_0 = ieee802_11.parse_mac(True, True) self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff( window_size + 16) self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc( window_size) self.ieee802_11_frame_equalizer_0 = ieee802_11.frame_equalizer( chan_est, freq, samp_rate, False, False) self.ieee802_11_decode_mac_0 = ieee802_11.decode_mac(True, False) self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, 64) self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream( blocks.complex_t, 'packet_len') self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex * 1, 16) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, sync_length) self.blocks_conjugate_cc_0 = blocks.conjugate_cc() self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) ################################################## # Connections ################################################## self.msg_connect((self.ieee802_11_decode_mac_0, 'out'), (self.ieee802_11_parse_mac_0, 'in')) self.msg_connect((self.ieee802_11_frame_equalizer_0, 'symbols'), (self.blocks_pdu_to_tagged_stream_1, 'pdus')) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.ieee802_11_moving_average_xx_1, 0)) self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_delay_0, 0), (self.ieee802_11_sync_long_0, 1)) self.connect((self.blocks_delay_0_0, 0), (self.blocks_conjugate_cc_0, 0)) self.connect((self.blocks_delay_0_0, 0), (self.ieee802_11_sync_short_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.ieee802_11_sync_short_0, 2)) self.connect((self.blocks_divide_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.ieee802_11_moving_average_xx_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_frame_equalizer_0, 0)) self.connect((self.ieee802_11_frame_equalizer_0, 0), (self.ieee802_11_decode_mac_0, 0)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.ieee802_11_sync_short_0, 1)) self.connect((self.ieee802_11_moving_average_xx_1, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.ieee802_11_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.ieee802_11_sync_short_0, 0), (self.blocks_delay_0, 0)) self.connect((self.ieee802_11_sync_short_0, 0), (self.ieee802_11_sync_long_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Nsf Airspy Mini Event Detect: 6 MHz") Qt.QWidget.__init__(self) self.setWindowTitle("Nsf Airspy Mini Event Detect: 6 MHz") 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", "NsfDetectLog60") self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.ObsName = ObsName = "Detect60" self.ConfigFile = ConfigFile = ObsName+".conf" self._telescope_save_config = ConfigParser.ConfigParser() self._telescope_save_config.read(ConfigFile) try: telescope_save = self._telescope_save_config.get('main', 'telescope') except: telescope_save = 'My Horn' self.telescope_save = telescope_save self._observer_save_config = ConfigParser.ConfigParser() self._observer_save_config.read(ConfigFile) try: observer_save = self._observer_save_config.get('main', 'observer') except: observer_save = 'Science Aficionado' self.observer_save = observer_save self._fftsize_save_config = ConfigParser.ConfigParser() self._fftsize_save_config.read(ConfigFile) try: fftsize_save = self._fftsize_save_config.getint('main', 'samplesize') except: fftsize_save = 1024 self.fftsize_save = fftsize_save self._device_save_config = ConfigParser.ConfigParser() self._device_save_config.read(ConfigFile) try: device_save = self._device_save_config.get('main', 'device') except: device_save = 'airspy,bias=1,pack=1' self.device_save = device_save self._NsigmaS_config = ConfigParser.ConfigParser() self._NsigmaS_config.read(ConfigFile) try: NsigmaS = self._NsigmaS_config.getfloat('main', 'nsimga') except: NsigmaS = 5 self.NsigmaS = NsigmaS self._Gain3s_config = ConfigParser.ConfigParser() self._Gain3s_config.read(ConfigFile) try: Gain3s = self._Gain3s_config.getfloat('main', 'gain3') except: Gain3s = 14. self.Gain3s = Gain3s self._Gain2s_config = ConfigParser.ConfigParser() self._Gain2s_config.read(ConfigFile) try: Gain2s = self._Gain2s_config.getfloat('main', 'gain2') except: Gain2s = 14. self.Gain2s = Gain2s self._Gain1s_config = ConfigParser.ConfigParser() self._Gain1s_config.read(ConfigFile) try: Gain1s = self._Gain1s_config.getfloat('main', 'gain1') except: Gain1s = 49. self.Gain1s = Gain1s self._Frequencys_config = ConfigParser.ConfigParser() self._Frequencys_config.read(ConfigFile) try: Frequencys = self._Frequencys_config.getfloat('main', 'frequency') except: Frequencys = 1420.4e6 self.Frequencys = Frequencys self._Elevation_save_config = ConfigParser.ConfigParser() self._Elevation_save_config.read(ConfigFile) try: Elevation_save = self._Elevation_save_config.getfloat('main', 'elevation') except: Elevation_save = 90. self.Elevation_save = Elevation_save self._Bandwidths_config = ConfigParser.ConfigParser() self._Bandwidths_config.read(ConfigFile) try: Bandwidths = self._Bandwidths_config.getfloat('main', 'bandwidth') except: Bandwidths = 10e6 self.Bandwidths = Bandwidths self._Azimuth_save_config = ConfigParser.ConfigParser() self._Azimuth_save_config.read(ConfigFile) try: Azimuth_save = self._Azimuth_save_config.getfloat('main', 'azimuth') except: Azimuth_save = 180. self.Azimuth_save = Azimuth_save self.nsigma = nsigma = NsigmaS self.fftsize = fftsize = fftsize_save self.Telescope = Telescope = telescope_save self.Observer = Observer = observer_save self.Mode = Mode = 2 self.Gain3 = Gain3 = Gain3s self.Gain2 = Gain2 = Gain2s self.Gain1 = Gain1 = Gain1s self.Frequency = Frequency = Frequencys self.EventMode = EventMode = 0 self.Elevation = Elevation = Elevation_save self.Device = Device = device_save self.Bandwidth = Bandwidth = Bandwidths self.Azimuth = Azimuth = Azimuth_save ################################################## # Blocks ################################################## self._nsigma_range = Range(0., 10., .1, NsigmaS, 100) self._nsigma_win = RangeWidget(self._nsigma_range, self.set_nsigma, 'N Sigma', "counter", float) self.top_grid_layout.addWidget(self._nsigma_win, 7, 0, 1, 2) for r in range(7, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._fftsize_tool_bar = Qt.QToolBar(self) self._fftsize_tool_bar.addWidget(Qt.QLabel('Sample_Size'+": ")) self._fftsize_line_edit = Qt.QLineEdit(str(self.fftsize)) self._fftsize_tool_bar.addWidget(self._fftsize_line_edit) self._fftsize_line_edit.returnPressed.connect( lambda: self.set_fftsize(int(str(self._fftsize_line_edit.text())))) self.top_grid_layout.addWidget(self._fftsize_tool_bar, 1, 2, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._Telescope_tool_bar = Qt.QToolBar(self) self._Telescope_tool_bar.addWidget(Qt.QLabel('Tel'+": ")) self._Telescope_line_edit = Qt.QLineEdit(str(self.Telescope)) self._Telescope_tool_bar.addWidget(self._Telescope_line_edit) self._Telescope_line_edit.returnPressed.connect( lambda: self.set_Telescope(str(str(self._Telescope_line_edit.text())))) self.top_grid_layout.addWidget(self._Telescope_tool_bar, 1, 0, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Observer_tool_bar = Qt.QToolBar(self) self._Observer_tool_bar.addWidget(Qt.QLabel('Who'+": ")) self._Observer_line_edit = Qt.QLineEdit(str(self.Observer)) self._Observer_tool_bar.addWidget(self._Observer_line_edit) self._Observer_line_edit.returnPressed.connect( lambda: self.set_Observer(str(str(self._Observer_line_edit.text())))) self.top_grid_layout.addWidget(self._Observer_tool_bar, 0, 0, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Mode_options = (0, 2, ) self._Mode_labels = ('Monitor', 'Detect', ) self._Mode_tool_bar = Qt.QToolBar(self) self._Mode_tool_bar.addWidget(Qt.QLabel('Data Mode'+": ")) self._Mode_combo_box = Qt.QComboBox() self._Mode_tool_bar.addWidget(self._Mode_combo_box) for label in self._Mode_labels: self._Mode_combo_box.addItem(label) self._Mode_callback = lambda i: Qt.QMetaObject.invokeMethod(self._Mode_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._Mode_options.index(i))) self._Mode_callback(self.Mode) self._Mode_combo_box.currentIndexChanged.connect( lambda i: self.set_Mode(self._Mode_options[i])) self.top_grid_layout.addWidget(self._Mode_tool_bar, 6, 0, 1, 2) for r in range(6, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Gain3_tool_bar = Qt.QToolBar(self) self._Gain3_tool_bar.addWidget(Qt.QLabel('Gain3'+": ")) self._Gain3_line_edit = Qt.QLineEdit(str(self.Gain3)) self._Gain3_tool_bar.addWidget(self._Gain3_line_edit) self._Gain3_line_edit.returnPressed.connect( lambda: self.set_Gain3(eng_notation.str_to_num(str(self._Gain3_line_edit.text())))) self.top_grid_layout.addWidget(self._Gain3_tool_bar, 2, 6, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self._Gain2_tool_bar = Qt.QToolBar(self) self._Gain2_tool_bar.addWidget(Qt.QLabel('Gain2'+": ")) self._Gain2_line_edit = Qt.QLineEdit(str(self.Gain2)) self._Gain2_tool_bar.addWidget(self._Gain2_line_edit) self._Gain2_line_edit.returnPressed.connect( lambda: self.set_Gain2(eng_notation.str_to_num(str(self._Gain2_line_edit.text())))) self.top_grid_layout.addWidget(self._Gain2_tool_bar, 2, 4, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._Gain1_tool_bar = Qt.QToolBar(self) self._Gain1_tool_bar.addWidget(Qt.QLabel('Gain1'+": ")) self._Gain1_line_edit = Qt.QLineEdit(str(self.Gain1)) self._Gain1_tool_bar.addWidget(self._Gain1_line_edit) self._Gain1_line_edit.returnPressed.connect( lambda: self.set_Gain1(eng_notation.str_to_num(str(self._Gain1_line_edit.text())))) self.top_grid_layout.addWidget(self._Gain1_tool_bar, 2, 2, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 4): self.top_grid_layout.setColumnStretch(c, 1) self._Frequency_tool_bar = Qt.QToolBar(self) self._Frequency_tool_bar.addWidget(Qt.QLabel('Freq. Hz'+": ")) self._Frequency_line_edit = Qt.QLineEdit(str(self.Frequency)) self._Frequency_tool_bar.addWidget(self._Frequency_line_edit) self._Frequency_line_edit.returnPressed.connect( lambda: self.set_Frequency(eng_notation.str_to_num(str(self._Frequency_line_edit.text())))) self.top_grid_layout.addWidget(self._Frequency_tool_bar, 0, 4, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._EventMode_options = (0, 1, ) self._EventMode_labels = ('Wait', 'Write', ) self._EventMode_tool_bar = Qt.QToolBar(self) self._EventMode_tool_bar.addWidget(Qt.QLabel('Write Mode'+": ")) self._EventMode_combo_box = Qt.QComboBox() self._EventMode_tool_bar.addWidget(self._EventMode_combo_box) for label in self._EventMode_labels: self._EventMode_combo_box.addItem(label) self._EventMode_callback = lambda i: Qt.QMetaObject.invokeMethod(self._EventMode_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._EventMode_options.index(i))) self._EventMode_callback(self.EventMode) self._EventMode_combo_box.currentIndexChanged.connect( lambda i: self.set_EventMode(self._EventMode_options[i])) self.top_grid_layout.addWidget(self._EventMode_tool_bar, 5, 0, 1, 2) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Elevation_tool_bar = Qt.QToolBar(self) self._Elevation_tool_bar.addWidget(Qt.QLabel('Elevation'+": ")) self._Elevation_line_edit = Qt.QLineEdit(str(self.Elevation)) self._Elevation_tool_bar.addWidget(self._Elevation_line_edit) self._Elevation_line_edit.returnPressed.connect( lambda: self.set_Elevation(eng_notation.str_to_num(str(self._Elevation_line_edit.text())))) self.top_grid_layout.addWidget(self._Elevation_tool_bar, 1, 6, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self._Device_tool_bar = Qt.QToolBar(self) self._Device_tool_bar.addWidget(Qt.QLabel('Dev'+": ")) self._Device_line_edit = Qt.QLineEdit(str(self.Device)) self._Device_tool_bar.addWidget(self._Device_line_edit) self._Device_line_edit.returnPressed.connect( lambda: self.set_Device(str(str(self._Device_line_edit.text())))) self.top_grid_layout.addWidget(self._Device_tool_bar, 2, 0, 1, 2) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Bandwidth_tool_bar = Qt.QToolBar(self) self._Bandwidth_tool_bar.addWidget(Qt.QLabel('Bandwidth'+": ")) self._Bandwidth_line_edit = Qt.QLineEdit(str(self.Bandwidth)) self._Bandwidth_tool_bar.addWidget(self._Bandwidth_line_edit) self._Bandwidth_line_edit.returnPressed.connect( lambda: self.set_Bandwidth(eng_notation.str_to_num(str(self._Bandwidth_line_edit.text())))) self.top_grid_layout.addWidget(self._Bandwidth_tool_bar, 1, 4, 1, 2) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self._Azimuth_tool_bar = Qt.QToolBar(self) self._Azimuth_tool_bar.addWidget(Qt.QLabel('Azimuth'+": ")) self._Azimuth_line_edit = Qt.QLineEdit(str(self.Azimuth)) self._Azimuth_tool_bar.addWidget(self._Azimuth_line_edit) self._Azimuth_line_edit.returnPressed.connect( lambda: self.set_Azimuth(eng_notation.str_to_num(str(self._Azimuth_line_edit.text())))) self.top_grid_layout.addWidget(self._Azimuth_tool_bar, 0, 6, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + Device ) self.rtlsdr_source_0.set_sample_rate(Bandwidth) self.rtlsdr_source_0.set_center_freq(Frequency, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(float(Gain1), 0) self.rtlsdr_source_0.set_if_gain(float(Gain2), 0) self.rtlsdr_source_0.set_bb_gain(float(Gain3), 0) self.rtlsdr_source_0.set_antenna('', 0) self.rtlsdr_source_0.set_bandwidth(Bandwidth, 0) (self.rtlsdr_source_0).set_processor_affinity([3]) self.radio_astro_ra_event_sink_0 = radio_astro.ra_event_sink(ObsName+".not", fftsize, Frequency*1.E-6, Bandwidth*1.E-6, EventMode, 'Event Detection', Observer, Telescope, Device, float(Gain1), Azimuth, Elevation) self.radio_astro_ra_event_log_0 = radio_astro.ra_event_log('', 'Event Detection', fftsize, Bandwidth*1.e-6) self.radio_astro_detect_0 = radio_astro.detect(fftsize, nsigma, Frequency, Bandwidth, fftsize*1.e-6/Bandwidth, Mode) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c( fftsize, #size Bandwidth, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(1) self.qtgui_time_sink_x_0_0.set_y_axis(-.3, .3) self.qtgui_time_sink_x_0_0.set_y_label('Event', "") self.qtgui_time_sink_x_0_0.enable_tags(-1, True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0.enable_autoscale(True) self.qtgui_time_sink_x_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(False) self.qtgui_time_sink_x_0_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0_0.disable_legend() labels = ['I', 'Q', '', '', '', '', '', '', '', ''] 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_0.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 3, 2, 5, 6) for r in range(3, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_histogram_sink_x_0 = qtgui.histogram_sink_f( fftsize, 100, -.5, .5, "", 2 ) self.qtgui_histogram_sink_x_0.set_update_time(1) self.qtgui_histogram_sink_x_0.enable_autoscale(True) self.qtgui_histogram_sink_x_0.enable_accumulate(False) self.qtgui_histogram_sink_x_0.enable_grid(False) self.qtgui_histogram_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_histogram_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", "dark 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_histogram_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_histogram_sink_x_0.set_line_label(i, labels[i]) self.qtgui_histogram_sink_x_0.set_line_width(i, widths[i]) self.qtgui_histogram_sink_x_0.set_line_color(i, colors[i]) self.qtgui_histogram_sink_x_0.set_line_style(i, styles[i]) self.qtgui_histogram_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_histogram_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_histogram_sink_x_0_win = sip.wrapinstance(self.qtgui_histogram_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_histogram_sink_x_0_win, 3, 0, 2, 2) for r in range(3, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, fftsize) self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fftsize) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_float_0, 1), (self.qtgui_histogram_sink_x_0, 1)) self.connect((self.blocks_complex_to_float_0, 0), (self.qtgui_histogram_sink_x_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.radio_astro_detect_0, 0)) self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.radio_astro_detect_0, 0), (self.blocks_vector_to_stream_0, 0)) self.connect((self.radio_astro_detect_0, 0), (self.radio_astro_ra_event_log_0, 0)) self.connect((self.radio_astro_detect_0, 0), (self.radio_astro_ra_event_sink_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_stream_to_vector_0, 0))
def __init__(self): gr.top_block.__init__(self, "ELEKTRO-L2/L3 TLM Demodulator") Qt.QWidget.__init__(self) self.setWindowTitle("ELEKTRO-L2/L3 TLM Demodulator") 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", "elektro_tlm") 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.file_rate = file_rate = 1024000 self.sym_rate = sym_rate = 5000.0 self.samp_rate = samp_rate = file_rate / 4 self.sps = sps = samp_rate / sym_rate self.offset = offset = 0 ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1, decimation=4, taps=None, fractional_bw=None) self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_b( samp_rate, 100, 1792, [], [], "", 1) self.qtgui_time_raster_sink_x_0.set_update_time(0.10) self.qtgui_time_raster_sink_x_0.set_intensity_range(-1, 1) self.qtgui_time_raster_sink_x_0.enable_grid(False) self.qtgui_time_raster_sink_x_0.enable_axis_labels(False) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [2, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_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, 3, 0, 1, 2) for r in range(3, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1) self.qtgui_freq_sink_x_0_0.set_update_time(0.01) self.qtgui_freq_sink_x_0_0.set_y_axis(-65, -15) self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0.enable_grid(True) self.qtgui_freq_sink_x_0_0.set_fft_average(0.1) self.qtgui_freq_sink_x_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0_0.enable_control_panel(False) self.qtgui_freq_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", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 0, 0, 1, 2) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1) self.qtgui_freq_sink_x_0.set_update_time(0.01) self.qtgui_freq_sink_x_0.set_y_axis(-65, 0) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(0.05) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) self.qtgui_freq_sink_x_0.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", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 1, 0, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 256, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.01) self.qtgui_const_sink_x_0.set_y_axis(-0.5, 0.5) self.qtgui_const_sink_x_0.set_x_axis(-0.5, 0.5) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(True) self.qtgui_const_sink_x_0.enable_axis_labels(False) self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1, 1, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_0_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate, 4.5e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate, 10e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc( 1, firdes.low_pass(1, samp_rate, samp_rate / (2 * 1), 1000), offset, samp_rate) self.freq_xlating_fft_filter_ccc_0.set_nthreads(1) self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0) self.digital_costas_loop_cc_0 = digital.costas_loop_cc(3e-3, 2, False) self.digital_clock_recovery_mm_xx_1 = digital.clock_recovery_mm_cc( sps * (1 + 0.0), 0.625e-3, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.dc_blocker_xx_0 = filter.dc_blocker_cc(32, True) self.blocks_wavfile_source_0 = blocks.wavfile_source('', True) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_gr_complex * 28, '127.0.0.1', 52001, 1472, True) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, file_rate, True) self.blocks_stream_to_vector_0 = blocks.stream_to_vector( gr.sizeof_char * 1, 224) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_moving_average_xx_0 = blocks.moving_average_cc( 2, 0.5, 4000, 1) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_SIN_WAVE, -5000, 1, 0, 0) self.analog_agc_xx_0_0_0 = analog.agc_cc(10e-3, 500e-3, 0.5) self.analog_agc_xx_0_0_0.set_max_gain(4e3) self.analog_agc_xx_0_0 = analog.agc_cc(10e-3, 500e-3, 0.5) self.analog_agc_xx_0_0.set_max_gain(4e3) ################################################## # Connections ################################################## self.connect((self.analog_agc_xx_0_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.analog_agc_xx_0_0_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.digital_costas_loop_cc_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.analog_agc_xx_0_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_wavfile_source_0, 1), (self.blocks_float_to_complex_0, 1)) self.connect((self.dc_blocker_xx_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.qtgui_time_raster_sink_x_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_1, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_1, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_clock_recovery_mm_xx_1, 0)) self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.analog_agc_xx_0_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.freq_xlating_fft_filter_ccc_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_0_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") 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.LO_freq = LO_freq = 9500 self.Center_freq = Center_freq = 10109 self.BW = BW = 0 self.variable_qtgui_label_0_0_0_0_0_0 = variable_qtgui_label_0_0_0_0_0_0 = ("%d" % (Center_freq)).rjust(16) self.variable_qtgui_label_0_0_0_0_0 = variable_qtgui_label_0_0_0_0_0 = ("%d" % ((Center_freq-BW))).rjust(10) self.variable_qtgui_label_0_0_0_0 = variable_qtgui_label_0_0_0_0 = ("%d" % (BW)).rjust(28) self.variable_qtgui_label_0_0_0 = variable_qtgui_label_0_0_0 = ("%d" % ((Center_freq - LO_freq))).rjust(27) self.variable_qtgui_label_0_0 = variable_qtgui_label_0_0 = ("%d" % (LO_freq)).rjust(32) self.variable_qtgui_label_0 = variable_qtgui_label_0 = ("%d" % (Center_freq)).rjust(20) self.samp_rate = samp_rate = 40000000 self.Times_To_Average = Times_To_Average = 1 self.SymmetricTaper = SymmetricTaper = 0 self.Rx_gain = Rx_gain = 0 self.Rx8_Cal = Rx8_Cal = 0 self.Rx8Gain = Rx8Gain = 127 self.Rx7_Cal = Rx7_Cal = 0 self.Rx7Gain = Rx7Gain = 127 self.Rx6_Cal = Rx6_Cal = 0 self.Rx6Gain = Rx6Gain = 127 self.Rx5_Cal = Rx5_Cal = 0 self.Rx5Gain = Rx5Gain = 127 self.Rx4_Cal = Rx4_Cal = 0 self.Rx4Gain = Rx4Gain = 127 self.Rx3_Cal = Rx3_Cal = 0 self.Rx3Gain = Rx3Gain = 127 self.Rx2_Cal = Rx2_Cal = 0 self.Rx2Gain = Rx2Gain = 127 self.Rx1_to_Rx2_Offset = Rx1_to_Rx2_Offset = 0 self.Rx1_Cal = Rx1_Cal = 0 self.Rx1Gain = Rx1Gain = 127 self.IgnorePhaseCals = IgnorePhaseCals = 0 self.BeamTaper = BeamTaper = 0 ################################################## # Blocks ################################################## self.ControlTab = Qt.QTabWidget() self.ControlTab_widget_0 = Qt.QWidget() self.ControlTab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.ControlTab_widget_0) self.ControlTab_grid_layout_0 = Qt.QGridLayout() self.ControlTab_layout_0.addLayout(self.ControlTab_grid_layout_0) self.ControlTab.addTab(self.ControlTab_widget_0, 'Pluto_Controls') self.ControlTab_widget_1 = Qt.QWidget() self.ControlTab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.ControlTab_widget_1) self.ControlTab_grid_layout_1 = Qt.QGridLayout() self.ControlTab_layout_1.addLayout(self.ControlTab_grid_layout_1) self.ControlTab.addTab(self.ControlTab_widget_1, 'Gain') self.ControlTab_widget_2 = Qt.QWidget() self.ControlTab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.ControlTab_widget_2) self.ControlTab_grid_layout_2 = Qt.QGridLayout() self.ControlTab_layout_2.addLayout(self.ControlTab_grid_layout_2) self.ControlTab.addTab(self.ControlTab_widget_2, 'Phase') self.ControlTab_widget_3 = Qt.QWidget() self.ControlTab_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.ControlTab_widget_3) self.ControlTab_grid_layout_3 = Qt.QGridLayout() self.ControlTab_layout_3.addLayout(self.ControlTab_grid_layout_3) self.ControlTab.addTab(self.ControlTab_widget_3, 'Bandwidth') self.top_grid_layout.addWidget(self.ControlTab, 0, 0, 6, 2) for r in range(0, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._Times_To_Average_range = Range(1, 50, 1, 1, 10) self._Times_To_Average_win = RangeWidget(self._Times_To_Average_range, self.set_Times_To_Average, 'Times_To_Average', "counter_slider", int) self.ControlTab_grid_layout_0.addWidget(self._Times_To_Average_win, 2, 0, 1, 2) for r in range(2, 3): self.ControlTab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_0.setColumnStretch(c, 1) _SymmetricTaper_check_box = Qt.QCheckBox('SymmetricTaper') self._SymmetricTaper_choices = {True: 1, False: 0} self._SymmetricTaper_choices_inv = dict((v,k) for k,v in self._SymmetricTaper_choices.items()) self._SymmetricTaper_callback = lambda i: Qt.QMetaObject.invokeMethod(_SymmetricTaper_check_box, "setChecked", Qt.Q_ARG("bool", self._SymmetricTaper_choices_inv[i])) self._SymmetricTaper_callback(self.SymmetricTaper) _SymmetricTaper_check_box.stateChanged.connect(lambda i: self.set_SymmetricTaper(self._SymmetricTaper_choices[bool(i)])) self.ControlTab_grid_layout_1.addWidget(_SymmetricTaper_check_box, 9, 0, 1, 1) for r in range(9, 10): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._Rx_gain_range = Range(0, 60, 1, 0, 10) self._Rx_gain_win = RangeWidget(self._Rx_gain_range, self.set_Rx_gain, 'Rx_gain', "counter_slider", int) self.ControlTab_grid_layout_0.addWidget(self._Rx_gain_win, 1, 0, 1, 2) for r in range(1, 2): self.ControlTab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_0.setColumnStretch(c, 1) self._Rx8_Cal_range = Range(-180, 180, 2.8125, 0, 10) self._Rx8_Cal_win = RangeWidget(self._Rx8_Cal_range, self.set_Rx8_Cal, 'Rx8_Cal', "counter_slider", float) self.ControlTab_grid_layout_2.addWidget(self._Rx8_Cal_win, 7, 0, 1, 2) for r in range(7, 8): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Rx8Gain_range = Range(0, 127, 1, 127, 20) self._Rx8Gain_win = RangeWidget(self._Rx8Gain_range, self.set_Rx8Gain, 'Rx8Gain', "counter_slider", int) self.ControlTab_grid_layout_1.addWidget(self._Rx8Gain_win, 7, 0, 1, 2) for r in range(7, 8): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._Rx7_Cal_range = Range(-180, 180, 2.8125, 0, 10) self._Rx7_Cal_win = RangeWidget(self._Rx7_Cal_range, self.set_Rx7_Cal, 'Rx7_Cal', "counter_slider", float) self.ControlTab_grid_layout_2.addWidget(self._Rx7_Cal_win, 6, 0, 1, 2) for r in range(6, 7): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Rx7Gain_range = Range(0, 127, 1, 127, 20) self._Rx7Gain_win = RangeWidget(self._Rx7Gain_range, self.set_Rx7Gain, 'Rx7Gain', "counter_slider", int) self.ControlTab_grid_layout_1.addWidget(self._Rx7Gain_win, 6, 0, 1, 2) for r in range(6, 7): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._Rx6_Cal_range = Range(-180, 180, 2.8125, 0, 10) self._Rx6_Cal_win = RangeWidget(self._Rx6_Cal_range, self.set_Rx6_Cal, 'Rx6_Cal', "counter_slider", float) self.ControlTab_grid_layout_2.addWidget(self._Rx6_Cal_win, 5, 0, 1, 2) for r in range(5, 6): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Rx6Gain_range = Range(0, 127, 1, 127, 20) self._Rx6Gain_win = RangeWidget(self._Rx6Gain_range, self.set_Rx6Gain, 'Rx6Gain', "counter_slider", int) self.ControlTab_grid_layout_1.addWidget(self._Rx6Gain_win, 5, 0, 1, 2) for r in range(5, 6): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._Rx5_Cal_range = Range(-180, 180, 2.8125, 0, 10) self._Rx5_Cal_win = RangeWidget(self._Rx5_Cal_range, self.set_Rx5_Cal, 'Rx5_Cal', "counter_slider", float) self.ControlTab_grid_layout_2.addWidget(self._Rx5_Cal_win, 4, 0, 1, 2) for r in range(4, 5): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Rx5Gain_range = Range(0, 127, 1, 127, 20) self._Rx5Gain_win = RangeWidget(self._Rx5Gain_range, self.set_Rx5Gain, 'Rx5Gain', "counter_slider", int) self.ControlTab_grid_layout_1.addWidget(self._Rx5Gain_win, 4, 0, 1, 2) for r in range(4, 5): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._Rx4_Cal_range = Range(-180, 180, 2.8125, 0, 10) self._Rx4_Cal_win = RangeWidget(self._Rx4_Cal_range, self.set_Rx4_Cal, 'Rx4_Cal', "counter_slider", float) self.ControlTab_grid_layout_2.addWidget(self._Rx4_Cal_win, 3, 0, 1, 2) for r in range(3, 4): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Rx4Gain_range = Range(0, 127, 1, 127, 20) self._Rx4Gain_win = RangeWidget(self._Rx4Gain_range, self.set_Rx4Gain, 'Rx4Gain', "counter_slider", int) self.ControlTab_grid_layout_1.addWidget(self._Rx4Gain_win, 3, 0, 1, 2) for r in range(3, 4): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._Rx3_Cal_range = Range(-180, 180, 2.8125, 0, 10) self._Rx3_Cal_win = RangeWidget(self._Rx3_Cal_range, self.set_Rx3_Cal, 'Rx3_Cal', "counter_slider", float) self.ControlTab_grid_layout_2.addWidget(self._Rx3_Cal_win, 2, 0, 1, 2) for r in range(2, 3): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Rx3Gain_range = Range(0, 127, 1, 127, 20) self._Rx3Gain_win = RangeWidget(self._Rx3Gain_range, self.set_Rx3Gain, 'Rx3Gain', "counter_slider", int) self.ControlTab_grid_layout_1.addWidget(self._Rx3Gain_win, 2, 0, 1, 2) for r in range(2, 3): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._Rx2_Cal_range = Range(-180, 180, 2.8125, 0, 10) self._Rx2_Cal_win = RangeWidget(self._Rx2_Cal_range, self.set_Rx2_Cal, 'Rx2_Cal', "counter_slider", float) self.ControlTab_grid_layout_2.addWidget(self._Rx2_Cal_win, 1, 0, 1, 2) for r in range(1, 2): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Rx2Gain_range = Range(0, 127, 1, 127, 20) self._Rx2Gain_win = RangeWidget(self._Rx2Gain_range, self.set_Rx2Gain, 'Rx2Gain', "counter_slider", int) self.ControlTab_grid_layout_1.addWidget(self._Rx2Gain_win, 1, 0, 1, 2) for r in range(1, 2): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._Rx1_to_Rx2_Offset_range = Range(-180, 180, 2.8125, 0, 10) self._Rx1_to_Rx2_Offset_win = RangeWidget(self._Rx1_to_Rx2_Offset_range, self.set_Rx1_to_Rx2_Offset, 'Rx1_to_Rx2_Offset', "counter_slider", float) self.ControlTab_grid_layout_2.addWidget(self._Rx1_to_Rx2_Offset_win, 8, 0, 1, 2) for r in range(8, 9): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Rx1_Cal_range = Range(-180, 180, 2.8125, 0, 10) self._Rx1_Cal_win = RangeWidget(self._Rx1_Cal_range, self.set_Rx1_Cal, 'Rx1_Cal', "counter_slider", float) self.ControlTab_grid_layout_2.addWidget(self._Rx1_Cal_win, 0, 0, 1, 2) for r in range(0, 1): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Rx1Gain_range = Range(0, 127, 1, 127, 20) self._Rx1Gain_win = RangeWidget(self._Rx1Gain_range, self.set_Rx1Gain, 'Rx1Gain', "counter_slider", int) self.ControlTab_grid_layout_1.addWidget(self._Rx1Gain_win, 0, 0, 1, 2) for r in range(0, 1): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) _IgnorePhaseCals_check_box = Qt.QCheckBox('Set All Phase Cals to 0 deg') self._IgnorePhaseCals_choices = {True: 1, False: 0} self._IgnorePhaseCals_choices_inv = dict((v,k) for k,v in self._IgnorePhaseCals_choices.items()) self._IgnorePhaseCals_callback = lambda i: Qt.QMetaObject.invokeMethod(_IgnorePhaseCals_check_box, "setChecked", Qt.Q_ARG("bool", self._IgnorePhaseCals_choices_inv[i])) self._IgnorePhaseCals_callback(self.IgnorePhaseCals) _IgnorePhaseCals_check_box.stateChanged.connect(lambda i: self.set_IgnorePhaseCals(self._IgnorePhaseCals_choices[bool(i)])) self.ControlTab_grid_layout_2.addWidget(_IgnorePhaseCals_check_box, 9, 0, 1, 2) for r in range(9, 10): self.ControlTab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_2.setColumnStretch(c, 1) self._Center_freq_range = Range(10000, 11000, 0.1, 10109, 10) self._Center_freq_win = RangeWidget(self._Center_freq_range, self.set_Center_freq, 'Signal Freq (MHz)', "counter_slider", float) self.ControlTab_grid_layout_0.addWidget(self._Center_freq_win, 0, 0, 1, 2) for r in range(0, 1): self.ControlTab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 2): self.ControlTab_grid_layout_0.setColumnStretch(c, 1) _BeamTaper_check_box = Qt.QCheckBox('Set All Element Gains to Max (127)') self._BeamTaper_choices = {True: 1, False: 0} self._BeamTaper_choices_inv = dict((v,k) for k,v in self._BeamTaper_choices.items()) self._BeamTaper_callback = lambda i: Qt.QMetaObject.invokeMethod(_BeamTaper_check_box, "setChecked", Qt.Q_ARG("bool", self._BeamTaper_choices_inv[i])) self._BeamTaper_callback(self.BeamTaper) _BeamTaper_check_box.stateChanged.connect(lambda i: self.set_BeamTaper(self._BeamTaper_choices[bool(i)])) self.ControlTab_grid_layout_1.addWidget(_BeamTaper_check_box, 8, 0, 1, 1) for r in range(8, 9): self.ControlTab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_1.setColumnStretch(c, 1) self._BW_range = Range(0, 2000, 100, 0, 10) self._BW_win = RangeWidget(self._BW_range, self.set_BW, 'Signal BW (MHz)', "counter_slider", float) self.ControlTab_grid_layout_3.addWidget(self._BW_win, 0, 0, 1, 1) for r in range(0, 1): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) self._variable_qtgui_label_0_0_0_0_0_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_0_0_0_0_0_formatter = None else: self._variable_qtgui_label_0_0_0_0_0_0_formatter = lambda x: str(x) self._variable_qtgui_label_0_0_0_0_0_0_tool_bar.addWidget(Qt.QLabel('Angle Measured at (MHz)' + ": ")) self._variable_qtgui_label_0_0_0_0_0_0_label = Qt.QLabel(str(self._variable_qtgui_label_0_0_0_0_0_0_formatter(self.variable_qtgui_label_0_0_0_0_0_0))) self._variable_qtgui_label_0_0_0_0_0_0_tool_bar.addWidget(self._variable_qtgui_label_0_0_0_0_0_0_label) self.ControlTab_grid_layout_3.addWidget(self._variable_qtgui_label_0_0_0_0_0_0_tool_bar, 6, 0, 1, 1) for r in range(6, 7): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) self._variable_qtgui_label_0_0_0_0_0_tool_bar = Qt.QToolBar(self) if None: self._variable_qtgui_label_0_0_0_0_0_formatter = None else: self._variable_qtgui_label_0_0_0_0_0_formatter = lambda x: str(x) self._variable_qtgui_label_0_0_0_0_0_tool_bar.addWidget(Qt.QLabel('Beam Weights Calc at (MHz)' + ": ")) self._variable_qtgui_label_0_0_0_0_0_label = Qt.QLabel(str(self._variable_qtgui_label_0_0_0_0_0_formatter(self.variable_qtgui_label_0_0_0_0_0))) self._variable_qtgui_label_0_0_0_0_0_tool_bar.addWidget(self._variable_qtgui_label_0_0_0_0_0_label) self.ControlTab_grid_layout_3.addWidget(self._variable_qtgui_label_0_0_0_0_0_tool_bar, 5, 0, 1, 1) for r in range(5, 6): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) 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('Signal BW (MHz)' + ": ")) 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.ControlTab_grid_layout_3.addWidget(self._variable_qtgui_label_0_0_0_0_tool_bar, 4, 0, 1, 1) for r in range(4, 5): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) 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('Pluto Rx LO (MHz)' + ": ")) 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.ControlTab_grid_layout_3.addWidget(self._variable_qtgui_label_0_0_0_tool_bar, 3, 0, 1, 1) for r in range(3, 4): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) 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('Mixer LO (MHz)' + ": ")) 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.ControlTab_grid_layout_3.addWidget(self._variable_qtgui_label_0_0_tool_bar, 2, 0, 1, 1) for r in range(2, 3): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) 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('Received Signal (MHz)' + ": ")) 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.ControlTab_grid_layout_3.addWidget(self._variable_qtgui_label_0_tool_bar, 1, 0, 1, 1) for r in range(1, 2): self.ControlTab_grid_layout_3.setRowStretch(r, 1) for c in range(0, 1): self.ControlTab_grid_layout_3.setColumnStretch(c, 1) self.qtgui_const_sink_x_0_0 = qtgui.const_sink_c( 140, #size "Error and Phase vs Steering Angle", #name 2 #number of inputs ) self.qtgui_const_sink_x_0_0.set_update_time(0.10) self.qtgui_const_sink_x_0_0.set_y_axis(-1.5, 1.5) self.qtgui_const_sink_x_0_0.set_x_axis(-80, 80) self.qtgui_const_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0_0.enable_autoscale(False) self.qtgui_const_sink_x_0_0.enable_grid(True) self.qtgui_const_sink_x_0_0.enable_axis_labels(True) labels = ['Error', 'Phase', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "red", "red", "red", "red", "red", "red", "red", "red"] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(2): if len(labels[i]) == 0: self.qtgui_const_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_0_win, 5, 2, 4, 5) for r in range(5, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 7): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 140, #size "Peak Signal vs Steering Angle", #name 2 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-50, 0) self.qtgui_const_sink_x_0.set_x_axis(-80, 80) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(True) self.qtgui_const_sink_x_0.enable_axis_labels(True) labels = ['SUM', 'DELTA', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "red", "red", "red", "red", "red", "red", "red", "red"] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(2): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 0, 2, 5, 5) for r in range(0, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 7): self.top_grid_layout.setColumnStretch(c, 1) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True) self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_float*1) self.ADAR1000_8_sweeper = ADAR1000_8_sweeper.blk(IP=[192, 168, 0, 3], LO_freq=int((Center_freq-LO_freq)*1000000), TX_freq=int(LO_freq*1000000), SampleRate=int(samp_rate), Rx_gain=int(Rx_gain), Averages=int(Times_To_Average), Taper=int(BeamTaper), SymTaper=int(SymmetricTaper), PhaseCal=int(IgnorePhaseCals), SignalFreq=int((Center_freq-BW)*1000000), RxGain1=Rx1Gain, RxGain2=Rx2Gain, RxGain3=Rx3Gain, RxGain4=Rx4Gain, RxGain5=Rx5Gain, RxGain6=Rx6Gain, RxGain7=Rx7Gain, RxGain8=Rx8Gain, Rx1_cal=Rx1_Cal+33.75, Rx2_cal=Rx2_Cal+30.9375, Rx3_cal=Rx3_Cal+11.25, Rx4_cal=Rx4_Cal, Rx5_cal=Rx5_Cal+Rx1_to_Rx2_Offset+75.9375, Rx6_cal=Rx6_Cal+Rx1_to_Rx2_Offset+101.25, Rx7_cal=Rx7_Cal+Rx1_to_Rx2_Offset+112.5, Rx8_cal=Rx8_Cal+Rx1_to_Rx2_Offset+109.6875) ################################################## # Connections ################################################## self.connect((self.ADAR1000_8_sweeper, 4), (self.blocks_throttle_0, 0)) self.connect((self.ADAR1000_8_sweeper, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.ADAR1000_8_sweeper, 1), (self.qtgui_const_sink_x_0, 1)) self.connect((self.ADAR1000_8_sweeper, 2), (self.qtgui_const_sink_x_0_0, 0)) self.connect((self.ADAR1000_8_sweeper, 3), (self.qtgui_const_sink_x_0_0, 1)) self.connect((self.blocks_throttle_0, 0), (self.blocks_null_sink_1, 0))
def __init__(self): gr.top_block.__init__(self, "VOR STATION 144MHZ") Qt.QWidget.__init__(self) self.setWindowTitle("VOR STATION 144MHZ") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "vor_station_144") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.samp_rate = samp_rate = 1000000 self.radial = radial = 45 self.output_gain = output_gain = 1 self.freq_b = freq_b = 30 self.carrier_freq = carrier_freq = 144000000 ################################################## # Blocks ################################################## self._radial_range = Range(0, 360, 0.5, 45, 200) self._radial_win = RangeWidget(self._radial_range, self.set_radial, 'radial', "counter_slider", float) self.top_grid_layout.addWidget(self._radial_win) self._output_gain_range = Range(0.0, 1.0, 0.01, 1, 200) self._output_gain_win = RangeWidget(self._output_gain_range, self.set_output_gain, 'output_gain', "counter_slider", float) self.top_grid_layout.addWidget(self._output_gain_win) self._carrier_freq_range = Range(143900000, 144100000, 10, 144000000, 200) self._carrier_freq_win = RangeWidget(self._carrier_freq_range, self.set_carrier_freq, 'carrier_freq', "counter_slider", float) self.top_grid_layout.addWidget(self._carrier_freq_win) self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f( samp_rate, #size samp_rate, #samp_rate "", #name 2 #number of inputs ) self.qtgui_time_sink_x_0_0.set_update_time(0.10) self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0.enable_tags(True) self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0_0.enable_autoscale(False) self.qtgui_time_sink_x_0_0.enable_grid(False) self.qtgui_time_sink_x_0_0.enable_axis_labels(True) self.qtgui_time_sink_x_0_0.enable_control_panel(False) self.qtgui_time_sink_x_0_0.enable_stem_plot(False) labels = ['North Ref Signal', 'Variable Signal', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ['blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue'] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(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.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( int(samp_rate/10), #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) labels = ['TX Signal', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ['blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue'] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f( 16383, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['TX FFT', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" ) self.osmosdr_sink_0.set_time_unknown_pps(osmosdr.time_spec_t()) self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(carrier_freq, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(0, 0) self.osmosdr_sink_0.set_if_gain(0, 0) self.osmosdr_sink_0.set_bb_gain(0, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0_1_0 = blocks.multiply_const_ff(output_gain) self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_ff(0.5) self.blocks_multiply_const_vxx_0_0_0 = blocks.multiply_const_ff(0.5) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_ff(0.5) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, int((samp_rate/freq_b) * ((((-1*radial)+180)%360)/360))) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.blocks_add_xx_0 = blocks.add_vff(1) self.blocks_add_const_vxx_1 = blocks.add_const_ff(0.5) self.analog_sig_source_x_0_0_0_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, freq_b, 1.0, 0, 0) self.analog_sig_source_x_0_0_0 = analog.sig_source_c(samp_rate, analog.GR_SIN_WAVE, 9960, 1.0, 0, 0) self.analog_nbfm_tx_0 = analog.nbfm_tx( audio_rate=samp_rate, quad_rate=samp_rate, tau=75e-6, max_dev=480, fh=-1.0, ) ################################################## # Connections ################################################## self.connect((self.analog_nbfm_tx_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_0_0_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.analog_sig_source_x_0_0_0_0, 0), (self.blocks_delay_0, 0)) self.connect((self.analog_sig_source_x_0_0_0_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.analog_sig_source_x_0_0_0_0, 0), (self.qtgui_time_sink_x_0_0, 0)) self.connect((self.blocks_add_const_vxx_1, 0), (self.blocks_multiply_const_vxx_0_1_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_0_1, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_const_vxx_0_0_0, 0)) self.connect((self.blocks_delay_0, 0), (self.analog_nbfm_tx_0, 0)) self.connect((self.blocks_delay_0, 0), (self.qtgui_time_sink_x_0_0, 1)) self.connect((self.blocks_float_to_complex_0, 0), (self.osmosdr_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_0_1, 0), (self.blocks_add_const_vxx_1, 0)) self.connect((self.blocks_multiply_const_vxx_0_1_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_1_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_1_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_float_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") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.samp_rate = samp_rate = 1000000 self.frame_size = frame_size = 100 self.add = add = 0 ################################################## # Blocks ################################################## self._add_range = Range(-10, 10, 0.01, 0, 200) self._add_win = RangeWidget(self._add_range, self.set_add, 'add', "counter_slider", float) self.top_grid_layout.addWidget(self._add_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 2000, #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(False) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ['blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue'] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(4): 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.learning_tag_numerotation_0 = learning.tag_numerotation('step', frame_size, "cc") self.learning_sync_rl_preprocessor_0 = learning.sync_rl_preprocessor(frame_size, 20, 4, add, 1e-2) self.learning_error_estimator_0 = learning.error_estimator('step', frame_size, "cc", 10) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_add_const_vxx_0 = blocks.add_const_cc(add + (add*1j)) self.analog_fastnoise_source_x_0 = analog.fastnoise_source_c(analog.GR_GAUSSIAN, 1, 0, 8192) ################################################## # Connections ################################################## self.msg_connect((self.learning_error_estimator_0, 'error'), (self.learning_sync_rl_preprocessor_0, 'error')) self.connect((self.analog_fastnoise_source_x_0, 0), (self.learning_tag_numerotation_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.learning_sync_rl_preprocessor_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.learning_error_estimator_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.learning_sync_rl_preprocessor_0, 0), (self.learning_error_estimator_0, 1)) self.connect((self.learning_sync_rl_preprocessor_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.learning_tag_numerotation_0, 0), (self.blocks_throttle_0, 0))
def __init__(self): gr.top_block.__init__(self, "Not titled yet") Qt.QWidget.__init__(self) self.setWindowTitle("Not titled yet") 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", "test") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry( self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32e3 self.freq_variable = freq_variable = 0 ################################################## # Blocks ################################################## self.set_variable_0 = set_variable(self.set_freq_variable) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) labels = [ 'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10' ] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ 'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue' ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] for i in range(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, samp_rate, True) self.blocks_add_xx_0 = blocks.add_vff(1) self.audio_sink_0 = audio.sink(32000, '', True) self.analog_sig_source_x_2 = analog.sig_source_f( samp_rate, analog.GR_COS_WAVE, 12.34, 5, 0, 0) self.analog_sig_source_x_1 = analog.sig_source_f( samp_rate, analog.GR_CONST_WAVE, 5000, 500, 0, 0) self.analog_sig_source_x_0 = analog.sig_source_f( samp_rate, analog.GR_COS_WAVE, freq_variable, 1, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_add_xx_0, 0)) self.connect((self.analog_sig_source_x_2, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_add_xx_0, 0), (self.set_variable_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_time_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "Residual Carrier") Qt.QWidget.__init__(self) self.setWindowTitle("Residual Carrier") 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", "residual_carrier") 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.sweep_rate = sweep_rate = 0 self.sweep_range = sweep_range = 0 self.snr = snr = 20 self.samp_rate = samp_rate = 100000 self.modulation_coeff = modulation_coeff = 0 self.frequency = frequency = 0 self.datarate = datarate = 4000 self.constellation_0 = constellation_0 = digital.constellation_calcdist( [-1 - 0.5j, -1 + 0.5j], [0, 1], 4, 1).base() ################################################## # Blocks ################################################## self._sweep_rate_range = Range(0, 50e3, 100, 0, 200) self._sweep_rate_win = RangeWidget(self._sweep_rate_range, self.set_sweep_rate, 'Sweep rate (Hz/s)', "counter_slider", float) self.top_layout.addWidget(self._sweep_rate_win) self._sweep_range_range = Range(0, 50e3, 1e3, 0, 200) self._sweep_range_win = RangeWidget(self._sweep_range_range, self.set_sweep_range, 'Sweep Range (Hz)', "counter_slider", float) self.top_layout.addWidget(self._sweep_range_win) self._snr_range = Range(-20, 50, 1, 20, 200) self._snr_win = RangeWidget(self._snr_range, self.set_snr, 'SNR (dB)', "counter_slider", float) self.top_layout.addWidget(self._snr_win) self._modulation_coeff_range = Range(0, 2, 0.1, 0, 200) self._modulation_coeff_win = RangeWidget(self._modulation_coeff_range, self.set_modulation_coeff, 'Modulation Coefficent', "counter", float) self.top_layout.addWidget(self._modulation_coeff_win) self._frequency_range = Range(-10e3, 10e3, 100, 0, 200) self._frequency_win = RangeWidget(self._frequency_range, self.set_frequency, 'Center frequency (Hz)', "counter_slider", float) self.top_layout.addWidget(self._frequency_win) self._datarate_range = Range(1000, 20000, 1000, 4000, 200) self._datarate_win = RangeWidget(self._datarate_range, self.set_datarate, 'Data Rate (bps', "counter", float) self.top_layout.addWidget(self._datarate_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(0.1) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in range(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.blocks_vco_c_0 = blocks.vco_c(samp_rate, 1, 1) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_int * 1, datarate * 16, True) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_float * 1, 25) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_int_to_float_0 = blocks.int_to_float(1, 1) self.blocks_add_xx_1 = blocks.add_vcc(1) self.blocks_add_const_vxx_0 = blocks.add_const_ff(-0.5) self.analog_sig_source_x_2_1 = analog.sig_source_f( samp_rate, analog.GR_TRI_WAVE, 0 if sweep_range == 0 else sweep_rate / sweep_range, 2 * 3.14159265359 * sweep_range, 2 * 3.14159265359 * frequency, -3.14159265359) self.analog_random_source_x_1 = blocks.vector_source_i( list(map(int, numpy.random.randint(0, 2, 1000))), True) self.analog_phase_modulator_fc_0 = analog.phase_modulator_fc( 2 * modulation_coeff) self.analog_noise_source_x_0 = analog.noise_source_c( analog.GR_GAUSSIAN, 10**(-snr / 10), 0) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_1, 1)) self.connect((self.analog_phase_modulator_fc_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.analog_random_source_x_1, 0), (self.blocks_throttle_0, 0)) self.connect((self.analog_sig_source_x_2_1, 0), (self.blocks_vco_c_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.blocks_add_xx_1, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_int_to_float_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_1, 0)) self.connect((self.blocks_repeat_0, 0), (self.analog_phase_modulator_fc_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_int_to_float_0, 0)) self.connect((self.blocks_vco_c_0, 0), (self.blocks_multiply_xx_0, 1))
def __init__(self): gr.top_block.__init__(self, "Receive") Qt.QWidget.__init__(self) self.setWindowTitle("Receive") 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", "receive") if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 6e6 self.freq = freq = 2e6 ################################################## # Blocks ################################################## self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Signal', "") 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_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "FFT", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-100, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.pluto_source_0 = iio.pluto_source('ip:pluto.local', int(2400000000), int(samp_rate), int(freq), 0x8000, True, True, True, "manual", 64.0, '', True) self.digital_psk_demod_0 = digital.psk.psk_demod( constellation_points=4, differential=True, samples_per_symbol=3, excess_bw=0.35, phase_bw=6.28 / 100.0, timing_bw=6.28 / 100.0, mod_code="none", verbose=False, log=False, ) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, 'received.bin', False) self.blocks_file_sink_0.set_unbuffered(True) ################################################## # Connections ################################################## self.connect((self.digital_psk_demod_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.pluto_source_0, 0), (self.digital_psk_demod_0, 0)) self.connect((self.pluto_source_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.pluto_source_0, 0), (self.qtgui_time_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "SECUNDARY") Qt.QWidget.__init__(self) self.setWindowTitle("SECUNDARY") 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", "secundary") 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.pilot_symbols = pilot_symbols = (( 1, 1, 1, -1, ), ) self.pilot_carriers = pilot_carriers = (( -21, -7, 7, 21, ), ) self.payload_mod = payload_mod = digital.constellation_bpsk() self.packet_length_tag_key = packet_length_tag_key = "packet_len" self.occupied_carriers = occupied_carriers = ( list(range(-26, -21)) + list(range(-20, -7)) + list(range(-6, 0)) + list(range(1, 7)) + list(range(8, 21)) + list(range(22, 27)), ) self.length_tag_key = length_tag_key = "packet_len" self.header_mod = header_mod = digital.constellation_bpsk() self.fft_len = fft_len = 64 self.tx_gain = tx_gain = 50 self.sync_word2 = sync_word2 = [ 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 0, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 0, 0, 0, 0, 0 ] self.sync_word1 = sync_word1 = [ 0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 0., 0., 0., 0., 0. ] self.samp_rate = samp_rate = 1000000 self.rx_gain = rx_gain = 50 self.rolloff = rolloff = 0 self.payload_equalizer = payload_equalizer = digital.ofdm_equalizer_simpledfe( fft_len, payload_mod.base(), occupied_carriers, pilot_carriers, pilot_symbols, 1) self.header_formatter = header_formatter = digital.packet_header_ofdm( occupied_carriers, n_syms=1, len_tag_key=packet_length_tag_key, frame_len_tag_key=length_tag_key, bits_per_header_sym=header_mod.bits_per_symbol(), bits_per_payload_sym=payload_mod.bits_per_symbol(), scramble_header=False) self.header_equalizer = header_equalizer = digital.ofdm_equalizer_simpledfe( fft_len, header_mod.base(), occupied_carriers, pilot_carriers, pilot_symbols) self.hdr_format = hdr_format = digital.header_format_ofdm( occupied_carriers, 1, length_tag_key, ) ################################################## # Blocks ################################################## self._tx_gain_tool_bar = Qt.QToolBar(self) self._tx_gain_tool_bar.addWidget(Qt.QLabel('tx_gain' + ": ")) self._tx_gain_line_edit = Qt.QLineEdit(str(self.tx_gain)) self._tx_gain_tool_bar.addWidget(self._tx_gain_line_edit) self._tx_gain_line_edit.returnPressed.connect(lambda: self.set_tx_gain( eng_notation.str_to_num(str(self._tx_gain_line_edit.text())))) self.top_layout.addWidget(self._tx_gain_tool_bar) self._rx_gain_tool_bar = Qt.QToolBar(self) self._rx_gain_tool_bar.addWidget(Qt.QLabel('rx_gain' + ": ")) self._rx_gain_line_edit = Qt.QLineEdit(str(self.rx_gain)) self._rx_gain_tool_bar.addWidget(self._rx_gain_line_edit) self._rx_gain_line_edit.returnPressed.connect(lambda: self.set_rx_gain( eng_notation.str_to_num(str(self._rx_gain_line_edit.text())))) self.top_layout.addWidget(self._rx_gain_tool_bar) self.uhd_usrp_source_0_0_1 = uhd.usrp_source( ",".join(('serial=F5C243', "")), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0, 1)), ), ) self.uhd_usrp_source_0_0_1.set_center_freq(2400000000, 0) self.uhd_usrp_source_0_0_1.set_gain(rx_gain, 0) self.uhd_usrp_source_0_0_1.set_antenna('RX2', 0) self.uhd_usrp_source_0_0_1.set_samp_rate(samp_rate) self.uhd_usrp_source_0_0_1.set_time_unknown_pps(uhd.time_spec()) self.uhd_usrp_source_0_0 = uhd.usrp_source( ",".join(('serial=F5C234', "")), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0, 1)), ), ) self.uhd_usrp_source_0_0.set_center_freq(2450000000, 0) self.uhd_usrp_source_0_0.set_gain(rx_gain, 0) self.uhd_usrp_source_0_0.set_antenna('RX2', 0) 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_sink_0_0 = uhd.usrp_sink( ",".join(('serial=F5C234', "")), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0, 1)), ), length_tag_key, ) self.uhd_usrp_sink_0_0.set_center_freq(2400000000, 0) self.uhd_usrp_sink_0_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0_0.set_time_unknown_pps(uhd.time_spec()) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(('serial=F5C243', "")), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0, 1)), ), length_tag_key, ) self.uhd_usrp_sink_0.set_center_freq(2450000000, 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_time_unknown_pps(uhd.time_spec()) self.qtgui_sink_x_0_0 = qtgui.sink_c( 64, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype 4000000000, #fc 50000, #bw 'SECUNDARY RX', #name True, #plotfreq True, #plotwaterfall True, #plottime True #plotconst ) self.qtgui_sink_x_0_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_0_win = sip.wrapinstance( self.qtgui_sink_x_0_0.pyqwidget(), Qt.QWidget) self.qtgui_sink_x_0_0.enable_rf_freq(False) self.top_layout.addWidget(self._qtgui_sink_x_0_0_win) self.fft_vxx_1_0_0_0_0_0 = fft.fft_vcc(fft_len, True, (), True, 1) self.fft_vxx_1_0_0_0_0 = fft.fft_vcc(fft_len, True, (), True, 1) self.fft_vxx_0_0_0_0_0_0_0 = fft.fft_vcc(fft_len, True, (), True, 1) self.fft_vxx_0_0_0_0_0_0 = fft.fft_vcc(fft_len, True, (), True, 1) self.fft_vxx_0_0 = fft.fft_vcc(fft_len, False, (), True, 1) self.fft_vxx_0 = fft.fft_vcc(fft_len, False, (), True, 1) self.epy_block_0_0 = epy_block_0_0.mac() self.epy_block_0 = epy_block_0.mac() self.digital_protocol_formatter_bb_0_0 = digital.protocol_formatter_bb( hdr_format, length_tag_key) self.digital_protocol_formatter_bb_0 = digital.protocol_formatter_bb( hdr_format, length_tag_key) self.digital_packet_headerparser_b_0_0_0_0_0_0 = digital.packet_headerparser_b( header_formatter.base()) self.digital_packet_headerparser_b_0_0_0_0_0 = digital.packet_headerparser_b( header_formatter.base()) self.digital_ofdm_sync_sc_cfb_0_0_0_0_0_0 = digital.ofdm_sync_sc_cfb( fft_len, fft_len // 4, False, 0.9) self.digital_ofdm_sync_sc_cfb_0_0_0_0_0 = digital.ofdm_sync_sc_cfb( fft_len, fft_len // 4, False, 0.9) self.digital_ofdm_serializer_vcc_payload_0_0_0_0_0 = digital.ofdm_serializer_vcc( fft_len, occupied_carriers, length_tag_key, packet_length_tag_key, 1, '', True) self.digital_ofdm_serializer_vcc_payload_0_0_0_0 = digital.ofdm_serializer_vcc( fft_len, occupied_carriers, length_tag_key, packet_length_tag_key, 1, '', True) self.digital_ofdm_serializer_vcc_header_0_0_0_0_0 = digital.ofdm_serializer_vcc( fft_len, occupied_carriers, length_tag_key, '', 0, '', True) self.digital_ofdm_serializer_vcc_header_0_0_0_0 = digital.ofdm_serializer_vcc( fft_len, occupied_carriers, length_tag_key, '', 0, '', True) self.digital_ofdm_frame_equalizer_vcvc_1_0_0_0_0_0 = digital.ofdm_frame_equalizer_vcvc( payload_equalizer.base(), fft_len // 4, length_tag_key, True, 0) self.digital_ofdm_frame_equalizer_vcvc_1_0_0_0_0 = digital.ofdm_frame_equalizer_vcvc( payload_equalizer.base(), fft_len // 4, length_tag_key, True, 0) self.digital_ofdm_frame_equalizer_vcvc_0_0_0_0_0_0 = digital.ofdm_frame_equalizer_vcvc( header_equalizer.base(), fft_len // 4, length_tag_key, True, 1) self.digital_ofdm_frame_equalizer_vcvc_0_0_0_0_0 = digital.ofdm_frame_equalizer_vcvc( header_equalizer.base(), fft_len // 4, length_tag_key, True, 1) self.digital_ofdm_cyclic_prefixer_0_0 = digital.ofdm_cyclic_prefixer( fft_len, fft_len + fft_len // 4, rolloff, length_tag_key) self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer( fft_len, fft_len + fft_len // 4, rolloff, length_tag_key) self.digital_ofdm_chanest_vcvc_0_0_0_0_0_0 = digital.ofdm_chanest_vcvc( sync_word1, sync_word2, 1, 0, 3, False) self.digital_ofdm_chanest_vcvc_0_0_0_0_0 = digital.ofdm_chanest_vcvc( sync_word1, sync_word2, 1, 0, 3, False) self.digital_ofdm_carrier_allocator_cvc_0_0 = digital.ofdm_carrier_allocator_cvc( fft_len, occupied_carriers, pilot_carriers, pilot_symbols, (sync_word1, sync_word2), length_tag_key, True) self.digital_ofdm_carrier_allocator_cvc_0 = digital.ofdm_carrier_allocator_cvc( fft_len, occupied_carriers, pilot_carriers, pilot_symbols, (sync_word1, sync_word2), length_tag_key, True) self.digital_header_payload_demux_0_0_0_0_0_0 = digital.header_payload_demux( 3, fft_len, fft_len // 4, length_tag_key, "", True, gr.sizeof_gr_complex, "rx_time", samp_rate, (), 0) self.digital_header_payload_demux_0_0_0_0_0 = digital.header_payload_demux( 3, fft_len, fft_len // 4, length_tag_key, "", True, gr.sizeof_gr_complex, "rx_time", samp_rate, (), 0) self.digital_constellation_decoder_cb_1_0_0_0_0_0 = digital.constellation_decoder_cb( payload_mod.base()) self.digital_constellation_decoder_cb_1_0_0_0_0 = digital.constellation_decoder_cb( payload_mod.base()) self.digital_constellation_decoder_cb_0_0_0_0_0_0 = digital.constellation_decoder_cb( header_mod.base()) self.digital_constellation_decoder_cb_0_0_0_0_0 = digital.constellation_decoder_cb( header_mod.base()) self.digital_chunks_to_symbols_xx_0_1 = digital.chunks_to_symbols_bc( header_mod.points(), 1) self.digital_chunks_to_symbols_xx_0_0_0 = digital.chunks_to_symbols_bc( payload_mod.points(), 1) self.digital_chunks_to_symbols_xx_0_0 = digital.chunks_to_symbols_bc( payload_mod.points(), 1) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc( header_mod.points(), 1) self.blocks_tagged_stream_to_pdu_0_0_0_0 = blocks.tagged_stream_to_pdu( blocks.byte_t, length_tag_key) self.blocks_tagged_stream_to_pdu_0_0_0 = blocks.tagged_stream_to_pdu( blocks.byte_t, length_tag_key) self.blocks_tagged_stream_mux_0_0 = blocks.tagged_stream_mux( gr.sizeof_gr_complex * 1, length_tag_key, 0) self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux( gr.sizeof_gr_complex * 1, length_tag_key, 0) self.blocks_tag_gate_0_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1, True) self.blocks_tag_gate_0_0.set_single_key("") self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1, True) self.blocks_tag_gate_0.set_single_key("") self.blocks_repack_bits_bb_0_2_0 = blocks.repack_bits_bb( 8, payload_mod.bits_per_symbol(), length_tag_key, False, gr.GR_LSB_FIRST) self.blocks_repack_bits_bb_0_2 = blocks.repack_bits_bb( 8, payload_mod.bits_per_symbol(), length_tag_key, False, gr.GR_LSB_FIRST) self.blocks_repack_bits_bb_0_1_0_0_0_0_0 = blocks.repack_bits_bb( payload_mod.bits_per_symbol(), 8, packet_length_tag_key, True, gr.GR_LSB_FIRST) self.blocks_repack_bits_bb_0_1_0_0_0_0 = blocks.repack_bits_bb( payload_mod.bits_per_symbol(), 8, packet_length_tag_key, True, gr.GR_LSB_FIRST) self.blocks_repack_bits_bb_0_0_1_0 = blocks.repack_bits_bb( 8, 1, length_tag_key, False, gr.GR_LSB_FIRST) self.blocks_repack_bits_bb_0_0_1 = blocks.repack_bits_bb( 8, 1, length_tag_key, False, gr.GR_LSB_FIRST) self.blocks_pdu_to_tagged_stream_0_0_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, length_tag_key) self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream( blocks.byte_t, length_tag_key) self.blocks_multiply_xx_0_0_0_0_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0_0_0_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_cc(50e-3) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(50e-3) self.blocks_message_strobe_0 = blocks.message_strobe( pmt.intern("TEST"), 1000) self.blocks_message_debug_0 = blocks.message_debug() self.blocks_delay_0_0_0_0_0_0 = blocks.delay(gr.sizeof_gr_complex * 1, fft_len + fft_len // 4) self.blocks_delay_0_0_0_0_0 = blocks.delay(gr.sizeof_gr_complex * 1, fft_len + fft_len // 4) self.analog_frequency_modulator_fc_0_0_0_0_0_0 = analog.frequency_modulator_fc( -2.0 / fft_len) self.analog_frequency_modulator_fc_0_0_0_0_0 = analog.frequency_modulator_fc( -2.0 / fft_len) ################################################## # Connections ################################################## self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.epy_block_0_0, 'time_unit')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0_0_0, 'pdus'), (self.blocks_message_debug_0, 'print_pdu')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0_0_0, 'pdus'), (self.epy_block_0_0, 'ack')) self.msg_connect((self.blocks_tagged_stream_to_pdu_0_0_0_0, 'pdus'), (self.epy_block_0, 'packet')) self.msg_connect( (self.digital_packet_headerparser_b_0_0_0_0_0, 'header_data'), (self.digital_header_payload_demux_0_0_0_0_0, 'header_data')) self.msg_connect( (self.digital_packet_headerparser_b_0_0_0_0_0_0, 'header_data'), (self.digital_header_payload_demux_0_0_0_0_0_0, 'header_data')) self.msg_connect((self.epy_block_0, 'ack'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus')) self.msg_connect((self.epy_block_0_0, 'transmit_packet'), (self.blocks_pdu_to_tagged_stream_0_0_0, 'pdus')) self.msg_connect((self.epy_block_0_0, 'channel_up'), (self.uhd_usrp_sink_0_0, 'command')) self.msg_connect((self.epy_block_0_0, 'channel_down'), (self.uhd_usrp_source_0_0, 'command')) self.connect((self.analog_frequency_modulator_fc_0_0_0_0_0, 0), (self.blocks_multiply_xx_0_0_0_0_0, 0)) self.connect((self.analog_frequency_modulator_fc_0_0_0_0_0_0, 0), (self.blocks_multiply_xx_0_0_0_0_0_0, 0)) self.connect((self.blocks_delay_0_0_0_0_0, 0), (self.blocks_multiply_xx_0_0_0_0_0, 1)) self.connect((self.blocks_delay_0_0_0_0_0_0, 0), (self.blocks_multiply_xx_0_0_0_0_0_0, 1)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_tag_gate_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_tag_gate_0_0, 0)) self.connect((self.blocks_multiply_xx_0_0_0_0_0, 0), (self.digital_header_payload_demux_0_0_0_0_0, 0)) self.connect((self.blocks_multiply_xx_0_0_0_0_0_0, 0), (self.digital_header_payload_demux_0_0_0_0_0_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.blocks_repack_bits_bb_0_2, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.digital_protocol_formatter_bb_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0_0, 0), (self.blocks_repack_bits_bb_0_2_0, 0)) self.connect((self.blocks_pdu_to_tagged_stream_0_0_0, 0), (self.digital_protocol_formatter_bb_0_0, 0)) self.connect((self.blocks_repack_bits_bb_0_0_1, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.blocks_repack_bits_bb_0_0_1_0, 0), (self.digital_chunks_to_symbols_xx_0_1, 0)) self.connect((self.blocks_repack_bits_bb_0_1_0_0_0_0, 0), (self.blocks_tagged_stream_to_pdu_0_0_0, 0)) self.connect((self.blocks_repack_bits_bb_0_1_0_0_0_0_0, 0), (self.blocks_tagged_stream_to_pdu_0_0_0_0, 0)) self.connect((self.blocks_repack_bits_bb_0_2, 0), (self.digital_chunks_to_symbols_xx_0_0, 0)) self.connect((self.blocks_repack_bits_bb_0_2_0, 0), (self.digital_chunks_to_symbols_xx_0_0_0, 0)) self.connect((self.blocks_tag_gate_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_tag_gate_0_0, 0), (self.uhd_usrp_sink_0_0, 0)) self.connect((self.blocks_tagged_stream_mux_0, 0), (self.digital_ofdm_carrier_allocator_cvc_0, 0)) self.connect((self.blocks_tagged_stream_mux_0_0, 0), (self.digital_ofdm_carrier_allocator_cvc_0_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_tagged_stream_mux_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0_0, 0), (self.blocks_tagged_stream_mux_0, 1)) self.connect((self.digital_chunks_to_symbols_xx_0_0_0, 0), (self.blocks_tagged_stream_mux_0_0, 1)) self.connect((self.digital_chunks_to_symbols_xx_0_1, 0), (self.blocks_tagged_stream_mux_0_0, 0)) self.connect((self.digital_constellation_decoder_cb_0_0_0_0_0, 0), (self.digital_packet_headerparser_b_0_0_0_0_0, 0)) self.connect((self.digital_constellation_decoder_cb_0_0_0_0_0_0, 0), (self.digital_packet_headerparser_b_0_0_0_0_0_0, 0)) self.connect((self.digital_constellation_decoder_cb_1_0_0_0_0, 0), (self.blocks_repack_bits_bb_0_1_0_0_0_0, 0)) self.connect((self.digital_constellation_decoder_cb_1_0_0_0_0_0, 0), (self.blocks_repack_bits_bb_0_1_0_0_0_0_0, 0)) self.connect((self.digital_header_payload_demux_0_0_0_0_0, 0), (self.fft_vxx_0_0_0_0_0_0, 0)) self.connect((self.digital_header_payload_demux_0_0_0_0_0, 1), (self.fft_vxx_1_0_0_0_0, 0)) self.connect((self.digital_header_payload_demux_0_0_0_0_0_0, 0), (self.fft_vxx_0_0_0_0_0_0_0, 0)) self.connect((self.digital_header_payload_demux_0_0_0_0_0_0, 1), (self.fft_vxx_1_0_0_0_0_0, 0)) self.connect((self.digital_ofdm_carrier_allocator_cvc_0, 0), (self.fft_vxx_0, 0)) self.connect((self.digital_ofdm_carrier_allocator_cvc_0_0, 0), (self.fft_vxx_0_0, 0)) self.connect((self.digital_ofdm_chanest_vcvc_0_0_0_0_0, 0), (self.digital_ofdm_frame_equalizer_vcvc_0_0_0_0_0, 0)) self.connect((self.digital_ofdm_chanest_vcvc_0_0_0_0_0_0, 0), (self.digital_ofdm_frame_equalizer_vcvc_0_0_0_0_0_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0_0, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.digital_ofdm_frame_equalizer_vcvc_0_0_0_0_0, 0), (self.digital_ofdm_serializer_vcc_header_0_0_0_0, 0)) self.connect((self.digital_ofdm_frame_equalizer_vcvc_0_0_0_0_0_0, 0), (self.digital_ofdm_serializer_vcc_header_0_0_0_0_0, 0)) self.connect((self.digital_ofdm_frame_equalizer_vcvc_1_0_0_0_0, 0), (self.digital_ofdm_serializer_vcc_payload_0_0_0_0, 0)) self.connect((self.digital_ofdm_frame_equalizer_vcvc_1_0_0_0_0_0, 0), (self.digital_ofdm_serializer_vcc_payload_0_0_0_0_0, 0)) self.connect((self.digital_ofdm_serializer_vcc_header_0_0_0_0, 0), (self.digital_constellation_decoder_cb_0_0_0_0_0, 0)) self.connect((self.digital_ofdm_serializer_vcc_header_0_0_0_0_0, 0), (self.digital_constellation_decoder_cb_0_0_0_0_0_0, 0)) self.connect((self.digital_ofdm_serializer_vcc_payload_0_0_0_0, 0), (self.digital_constellation_decoder_cb_1_0_0_0_0, 0)) self.connect((self.digital_ofdm_serializer_vcc_payload_0_0_0_0_0, 0), (self.digital_constellation_decoder_cb_1_0_0_0_0_0, 0)) self.connect((self.digital_ofdm_sync_sc_cfb_0_0_0_0_0, 0), (self.analog_frequency_modulator_fc_0_0_0_0_0, 0)) self.connect((self.digital_ofdm_sync_sc_cfb_0_0_0_0_0, 1), (self.digital_header_payload_demux_0_0_0_0_0, 1)) self.connect((self.digital_ofdm_sync_sc_cfb_0_0_0_0_0_0, 0), (self.analog_frequency_modulator_fc_0_0_0_0_0_0, 0)) self.connect((self.digital_ofdm_sync_sc_cfb_0_0_0_0_0_0, 1), (self.digital_header_payload_demux_0_0_0_0_0_0, 1)) self.connect((self.digital_protocol_formatter_bb_0, 0), (self.blocks_repack_bits_bb_0_0_1, 0)) self.connect((self.digital_protocol_formatter_bb_0_0, 0), (self.blocks_repack_bits_bb_0_0_1_0, 0)) self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0)) self.connect((self.fft_vxx_0_0, 0), (self.digital_ofdm_cyclic_prefixer_0_0, 0)) self.connect((self.fft_vxx_0_0_0_0_0_0, 0), (self.digital_ofdm_chanest_vcvc_0_0_0_0_0, 0)) self.connect((self.fft_vxx_0_0_0_0_0_0_0, 0), (self.digital_ofdm_chanest_vcvc_0_0_0_0_0_0, 0)) self.connect((self.fft_vxx_1_0_0_0_0, 0), (self.digital_ofdm_frame_equalizer_vcvc_1_0_0_0_0, 0)) self.connect((self.fft_vxx_1_0_0_0_0_0, 0), (self.digital_ofdm_frame_equalizer_vcvc_1_0_0_0_0_0, 0)) self.connect((self.uhd_usrp_source_0_0, 0), (self.blocks_delay_0_0_0_0_0, 0)) self.connect((self.uhd_usrp_source_0_0, 0), (self.digital_ofdm_sync_sc_cfb_0_0_0_0_0, 0)) self.connect((self.uhd_usrp_source_0_0, 0), (self.qtgui_sink_x_0_0, 0)) self.connect((self.uhd_usrp_source_0_0_1, 0), (self.blocks_delay_0_0_0_0_0_0, 0)) self.connect((self.uhd_usrp_source_0_0_1, 0), (self.digital_ofdm_sync_sc_cfb_0_0_0_0_0_0, 0))
def __init__(self, parent=None, mesh_dir="data/meshes", label_dir="", id_csv="data/ids.csv", output_file="output.json", hotkey_file="data/hotkeys.csv", opacity=.5): self.curId = 0000000 self.curKeyValue = '' self.curIndex = 0 self.allids = [] self.hotkeys = [] self.keylabels = [] self.curActor = None self.meshopacity = 0.5 #self.LABELS = [[],[]] self.LABELS = {} #inits Qt.QMainWindow.__init__(self, parent) self.setWindowTitle('Mesh Labeller') self.frame = Qt.QFrame() #define layout` self.vl = Qt.QGridLayout() self.vl.setSpacing(10) self.add_title_left('Mesh File Directory:', 1, 0) self.add_title_left('CSV for ids:', 2, 0) self.add_title_left('Output File:', 3, 0) self.add_title_left('mesh_labels', 4, 0) self.add_title_left('Hot Key File (CSV):', 5, 0) self.add_title_left('Mesh Opacity', 6, 0) self.meshdirectoryline = self.add_editor(mesh_dir, 1, 1, 1, 1) self.idline = self.add_editor(id_csv, 2, 1, 1, 1) self.outputline = self.add_editor(output_file, 3, 1, 1, 1) self.labelline = self.add_editor(label_dir, 4, 1, 1, 1) self.hotkeyline = self.add_editor(hotkey_file, 5, 1, 1, 1) self.opacityline = self.add_editor("0.5", 6, 1, 1, 1) #self.opacityline.returnPressed.connect(self.testing123()) self.add_load_button('LOAD', 6, 1) self.add_title('Current Hot Keys:', 7, 1) self.hotkeyvalueline = self.add_title('', 8, 1) self.add_backward_button('<<', 9, 0) self.add_vtk_window(9, 1) self.add_forward_button('>>', 9, 2) self.filenameline = self.add_title('DEFAULT', 10, 1) self.add_button('Continue Labelling', 11, 1) self.add_save_button('SAVE!', 12, 1) self.add_help_button('HELP', 13, 2) #set layout for frame self.frame.setLayout(self.vl) self.setCentralWidget(self.frame) self.show()
def __init__(self): gr.top_block.__init__(self, "OFDM Tx") Qt.QWidget.__init__(self) self.setWindowTitle("OFDM Tx") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "ofdm_tx_virtualsource_qt") self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.occupied_carriers = occupied_carriers = ( range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) + range(8, 21) + range(22, 27), ) self.length_tag_key = length_tag_key = "packet_len" self.sync_word2 = sync_word2 = [ 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 0, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 0, 0, 0, 0, 0 ] self.sync_word1 = sync_word1 = [ 0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 0., 0., 0., 0., 0. ] self.samp_rate = samp_rate = 100000 self.rolloff = rolloff = 0 self.pilot_symbols = pilot_symbols = (( 1, 1, 1, -1, ), ) self.pilot_carriers = pilot_carriers = (( -21, -7, 7, 21, ), ) self.payload_mod = payload_mod = digital.constellation_qpsk() self.packet_len = packet_len = 96 self.header_mod = header_mod = digital.constellation_bpsk() self.hdr_format = hdr_format = digital.header_format_ofdm( occupied_carriers, 1, length_tag_key, ) self.fft_len = fft_len = 64 ################################################## # Blocks ################################################## self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate 'Scope Plot', #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(True) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['Scope Plot', '', '', '', '', '', '', '', '', ''] 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.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw 'FFT Plot', #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(True) self.qtgui_freq_sink_x_0.enable_grid(False) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.10) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win) self.fft_vxx_0 = fft.fft_vcc(fft_len, False, (()), True, 1) self.digital_protocol_formatter_bb_0 = digital.protocol_formatter_bb( hdr_format, length_tag_key) self.digital_ofdm_rx_0 = digital.ofdm_rx( fft_len=fft_len, cp_len=fft_len / 4, frame_length_tag_key='frame_' + "length", packet_length_tag_key="length", occupied_carriers=occupied_carriers, pilot_carriers=pilot_carriers, pilot_symbols=pilot_symbols, sync_word1=sync_word1, sync_word2=sync_word2, bps_header=1, bps_payload=2, debug_log=False, scramble_bits=False) self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer( fft_len, fft_len + fft_len / 4, rolloff, length_tag_key) self.digital_ofdm_carrier_allocator_cvc_0 = digital.ofdm_carrier_allocator_cvc( fft_len, occupied_carriers, pilot_carriers, pilot_symbols, (sync_word1, sync_word2), length_tag_key) self.digital_crc32_bb_0 = digital.crc32_bb(False, length_tag_key, True) self.digital_chunks_to_symbols_xx_0_0 = digital.chunks_to_symbols_bc( (payload_mod.points()), 1) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc( (header_mod.points()), 1) self.channels_channel_model_0 = channels.channel_model( noise_voltage=0.0, frequency_offset=0.0, epsilon=1.0, taps=(1.0 + 1.0j, ), noise_seed=0, block_tags=True) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux( gr.sizeof_gr_complex * 1, length_tag_key, 0) self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1, False) self.blocks_tag_gate_0.set_single_key("") self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_char * 1, "Rx'd Packets", "") self.blocks_tag_debug_0.set_display(True) self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream( gr.sizeof_char, 1, packet_len, length_tag_key) self.blocks_repack_bits_bb_0_0 = blocks.repack_bits_bb( 8, 1, length_tag_key, False, gr.GR_LSB_FIRST) self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb( 8, payload_mod.bits_per_symbol(), length_tag_key, False, gr.GR_LSB_FIRST) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.05, )) self.analog_random_source_x_0 = blocks.vector_source_b( map(int, numpy.random.randint(0, 255, 1000)), True) ################################################## # Connections ################################################## self.connect((self.analog_random_source_x_0, 0), (self.blocks_stream_to_tagged_stream_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_tag_gate_0, 0)) self.connect((self.blocks_repack_bits_bb_0, 0), (self.digital_chunks_to_symbols_xx_0_0, 0)) self.connect((self.blocks_repack_bits_bb_0_0, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.blocks_stream_to_tagged_stream_0, 0), (self.digital_crc32_bb_0, 0)) self.connect((self.blocks_tag_gate_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_tagged_stream_mux_0, 0), (self.digital_ofdm_carrier_allocator_cvc_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.digital_ofdm_rx_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_tagged_stream_mux_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0_0, 0), (self.blocks_tagged_stream_mux_0, 1)) self.connect((self.digital_crc32_bb_0, 0), (self.blocks_repack_bits_bb_0, 0)) self.connect((self.digital_crc32_bb_0, 0), (self.digital_protocol_formatter_bb_0, 0)) self.connect((self.digital_ofdm_carrier_allocator_cvc_0, 0), (self.fft_vxx_0, 0)) self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_tag_debug_0, 0)) self.connect((self.digital_protocol_formatter_bb_0, 0), (self.blocks_repack_bits_bb_0_0, 0)) self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0))
def __init__(self): gr.top_block.__init__(self, "Uhd Packet Rx") Qt.QWidget.__init__(self) self.setWindowTitle("Uhd Packet Rx") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "uhd_packet_rx") self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.sps = sps = 2 self.rate = rate = 2 self.polys = polys = [109, 79] self.nfilts = nfilts = 32 self.k = k = 7 self.eb = eb = 0.22 self.Const_PLD = Const_PLD = digital.constellation_calcdist( (digital.psk_2()[0]), (digital.psk_2()[1]), 2, 1).base() self.Const_PLD.gen_soft_dec_lut(8) self.samp_rate = samp_rate = 1000e3 self.rx_rrc_taps = rx_rrc_taps = firdes.root_raised_cosine( nfilts, sps * nfilts, 1.0, eb, 11 * sps * nfilts) self.rep = rep = 3 self.on = on = 0 self.hdr_format = hdr_format = digital.header_format_counter( digital.packet_utils.default_access_code, 3, Const_PLD.bits_per_symbol()) self.gain = gain = 20 self.freq = freq = 484e6 self.dec_hdr = dec_hdr = fec.dummy_decoder.make(8000) self.dec = dec = fec.cc_decoder.make(8000, k, rate, (polys), 0, -1, fec.CC_TERMINATED, False) self.amp = amp = 500 self.Const_HDR = Const_HDR = digital.constellation_calcdist( (digital.psk_2()[0]), (digital.psk_2()[1]), 2, 1).base() self.Const_HDR.gen_soft_dec_lut(8) ################################################## # 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, 'Const') 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, 'Time') self.top_grid_layout.addWidget(self.tab1, 2, 0, 1, 1) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.tab0 = Qt.QTabWidget() self.tab0_widget_0 = Qt.QWidget() self.tab0_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab0_widget_0) self.tab0_grid_layout_0 = Qt.QGridLayout() self.tab0_layout_0.addLayout(self.tab0_grid_layout_0) self.tab0.addTab(self.tab0_widget_0, 'Time') self.tab0_widget_1 = Qt.QWidget() self.tab0_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab0_widget_1) self.tab0_grid_layout_1 = Qt.QGridLayout() self.tab0_layout_1.addLayout(self.tab0_grid_layout_1) self.tab0.addTab(self.tab0_widget_1, 'Const.') self.top_grid_layout.addWidget(self.tab0, 2, 1, 1, 1) for r in range(2, 3): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self._samp_rate_range = Range(200e3, 10e6, 200e3, 1000e3, 200) self._samp_rate_win = RangeWidget(self._samp_rate_range, self.set_samp_rate, 'Sample Rate', "counter_slider", float) self.top_grid_layout.addWidget(self._samp_rate_win, 0, 0, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) _on_check_box = Qt.QCheckBox('On') self._on_choices = {True: 1, False: 0} self._on_choices_inv = dict( (v, k) for k, v in self._on_choices.iteritems()) self._on_callback = lambda i: Qt.QMetaObject.invokeMethod( _on_check_box, "setChecked", Qt.Q_ARG("bool", self._on_choices_inv[i])) self._on_callback(self.on) _on_check_box.stateChanged.connect( lambda i: self.set_on(self._on_choices[bool(i)])) self.top_grid_layout.addWidget(_on_check_box) self._gain_range = Range(0, 31.5, 0.5, 20, 200) self._gain_win = RangeWidget(self._gain_range, self.set_gain, 'Gain', "counter_slider", float) self.top_grid_layout.addWidget(self._gain_win, 1, 0, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._freq_range = Range(480e6, 490e6, 100, 484e6, 200) self._freq_win = RangeWidget(self._freq_range, self.set_freq, 'Frequency', "counter_slider", float) self.top_grid_layout.addWidget(self._freq_win, 0, 1, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self._amp_range = Range(0, 15000, 10, 500, 200) self._amp_win = RangeWidget(self._amp_range, self.set_amp, 'Amplitude', "counter_slider", float) self.top_grid_layout.addWidget(self._amp_win, 1, 1, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(('addr=192.168.10.2', "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_clock_source('gpsdo', 0) self.uhd_usrp_source_0.set_time_source('gpsdo', 0) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq( uhd.tune_request(freq, samp_rate / 2.0), 0) self.uhd_usrp_source_0.set_gain(gain, 0) self.uhd_usrp_source_0.set_antenna('TX/RX', 0) self.uhd_usrp_source_0.set_auto_dc_offset("", 0) self.uhd_usrp_source_0.set_auto_iq_balance("", 0) self.qtgui_time_sink_x_1_0_0_1 = qtgui.time_sink_c( 1250, #size 1, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_1_0_0_1.set_update_time(0.10) self.qtgui_time_sink_x_1_0_0_1.set_y_axis(-2, 2) self.qtgui_time_sink_x_1_0_0_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_1_0_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_1_0_0_1.set_trigger_mode( qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 25, 0, "time_est") self.qtgui_time_sink_x_1_0_0_1.enable_autoscale(False) self.qtgui_time_sink_x_1_0_0_1.enable_grid(False) self.qtgui_time_sink_x_1_0_0_1.enable_axis_labels(True) self.qtgui_time_sink_x_1_0_0_1.enable_control_panel(False) self.qtgui_time_sink_x_1_0_0_1.enable_stem_plot(False) if not False: self.qtgui_time_sink_x_1_0_0_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 = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [0, -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_0_1.set_line_label( i, "Re{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_1_0_0_1.set_line_label( i, "Im{{Data {0}}}".format(i / 2)) else: self.qtgui_time_sink_x_1_0_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_1_0_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_1_0_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_1_0_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_1_0_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_1_0_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_1_0_0_1_win = sip.wrapinstance( self.qtgui_time_sink_x_1_0_0_1.pyqwidget(), Qt.QWidget) self.tab0_grid_layout_0.addWidget(self._qtgui_time_sink_x_1_0_0_1_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.01) self.qtgui_time_sink_x_0.set_y_axis(-2, 2) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.5, 0.5e-3, 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.tab1_grid_layout_1.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_const_sink_x_0_0_0 = qtgui.const_sink_c( 800, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0_0_0.set_update_time(0.10) self.qtgui_const_sink_x_0_0_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0_0_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_0_0_0.enable_autoscale(False) self.qtgui_const_sink_x_0_0_0.enable_grid(False) self.qtgui_const_sink_x_0_0_0.enable_axis_labels(True) if not False: self.qtgui_const_sink_x_0_0_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0_0_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0_0_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0_0_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0_0_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0_0_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0_0_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0_0_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_0_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0_0_0.pyqwidget(), Qt.QWidget) self.tab0_grid_layout_1.addWidget(self._qtgui_const_sink_x_0_0_0_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "", #name 1 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(0.01) self.qtgui_const_sink_x_0.set_y_axis(-2, 2) self.qtgui_const_sink_x_0.set_x_axis(-2, 2) self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.5, 0, "") self.qtgui_const_sink_x_0.enable_autoscale(False) self.qtgui_const_sink_x_0.enable_grid(False) self.qtgui_const_sink_x_0.enable_axis_labels(True) if not False: self.qtgui_const_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_const_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_0_win = sip.wrapinstance( self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) self.tab1_grid_layout_0.addWidget(self._qtgui_const_sink_x_0_win) self.packet_rx_0 = packet_rx( eb=eb, hdr_const=Const_HDR, hdr_format=digital.header_format_default( digital.packet_utils.default_access_code, 0), pld_const=Const_PLD, psf_taps=rx_rrc_taps, puncpat='11', samp_rate=250000, sps=sps, ) self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc( sps, eb, 44, 0.05) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((on, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((amp, )) self.blocks_message_debug_0_0_0 = blocks.message_debug() ################################################## # Connections ################################################## self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.packet_rx_0, 0)) self.connect((self.digital_fll_band_edge_cc_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.packet_rx_0, 1), (self.qtgui_const_sink_x_0_0_0, 0)) self.connect((self.packet_rx_0, 2), (self.qtgui_time_sink_x_1_0_0_1, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.digital_fll_band_edge_cc_0, 0))