def _addGroupBox(self, parent, title, setting=None, obj_name=None): """ Add a group box item. Note: To add checkable group box (enabled / disabled by the user), specify *setting* parameter. Arguments: parent (QWidget): Parent widget. title (str): Group title. setting (str): Preference item's identifier. Returns: QGroupBox: A group box item. """ grp = Q.QGroupBox(title, parent) _setObjName(grp, "group", setting or obj_name or title) grp.setLayout(Q.QGridLayout()) if setting: grp.setCheckable(True) self.widgets[setting] = grp row = self._layout(parent).rowCount() self._layout(parent).addWidget(grp, row, 0, 1, 2) return grp
def __init__(self, render_list, shape, frame): # check if render_list and mayout match assert len(render_list) == shape[0] * shape[1] QMainWindow.__init__(self) self.vl = Qt.QVBoxLayout() self.horizontalGroupBox = Qt.QGroupBox("Surface rendering") self.vl.addWidget(self.horizontalGroupBox) self.layout = Qt.QGridLayout() self.frame = frame self.render = render_list self.vtk_widgets = [ren_.interactor for ren_ in self.render] self.layout_grid = idx_from_shape(shape) self.rens = list() self.irens = list() print("loading...") for idx, (wid_, grd_, ren_) in enumerate( zip(self.vtk_widgets, self.layout_grid, self.render)): self.layout.addWidget(wid_, grd_[0], grd_[1]) self.rens.append(vtk.vtkRenderer()) wid_.GetRenderWindow().AddRenderer(ren_.renderer) self.irens.append(wid_.GetRenderWindow().GetInteractor()) self.horizontalGroupBox.setLayout(self.layout) self.frame.setLayout(self.vl) self.setCentralWidget(self.horizontalGroupBox) for iren_ in self.irens: iren_.Initialize() iren_.Start()
def __init__(self, rw, fields, image_dir, annotation_file='annotations.pickle'): self.rw = rw self.rw.add_annotator(fields) self.image_dir = pathlib.Path(image_dir) self.annotation_file = annotation_file assert self.image_dir.exists() self.image_paths = sorted(self.image_dir.glob('*.png')) self.rw.add_image_files_to_flipbook( self.image_paths, page_names=[path.stem for path in self.image_paths]) self.load_annotations() nb_widget = Qt.QGroupBox() button_layout = Qt.QHBoxLayout(nb_widget) button_layout.setSpacing(11) up_button = _add_button(button_layout, '\N{UPWARDS ARROW}', lambda: self.rw.flipbook.focus_prev_page()) down_button = _add_button(button_layout, '\N{DOWNWARDS ARROW}', lambda: self.rw.flipbook.focus_next_page()) self.rw.annotator.layout().insertRow(0, nb_widget) db_widget = Qt.QGroupBox() data_buttons = Qt.QVBoxLayout(db_widget) save = _add_button(data_buttons, 'Save Annotations', self.save_annotations) reload = _add_button(data_buttons, 'Reload Annotations', self.load_annotations) self.rw.annotator.layout().insertRow(1, db_widget) Qt.QShortcut(Qt.Qt.Key_T, self.rw.annotator, self.toggle_zoom_to_fit, context=Qt.Qt.ApplicationShortcut) Qt.QShortcut(Qt.Qt.Key_Q, self.rw.annotator, lambda: self.incremental_zoom(False), context=Qt.Qt.ApplicationShortcut) Qt.QShortcut(Qt.Qt.Key_W, self.rw.annotator, lambda: self.incremental_zoom(True), context=Qt.Qt.ApplicationShortcut)
def init_widget(self): self.widget = Qt.QGroupBox(self.name) layout = Qt.QHBoxLayout() self.widget.setLayout(layout) self.labels = [Qt.QLabel(name) for name in self.keypoint_names] for label in self.labels: label.setAlignment(Qt.Qt.AlignCenter) layout.addWidget(label)
def create_buttons(self): action_box = Qt.QGroupBox('Ação:') self.convert = Qt.QRadioButton('Converter') self.minimize = Qt.QRadioButton('Minimizar') self.union = Qt.QRadioButton('União') self.intersec = Qt.QRadioButton('Intersecção') self.determinize = Qt.QRadioButton('Determinizar') action_layout = Qt.QVBoxLayout() action_layout.addWidget(self.convert) action_layout.addWidget(self.minimize) action_layout.addWidget(self.union) action_layout.addWidget(self.intersec) action_layout.addWidget(self.determinize) action_box.setLayout(action_layout) self.layout.addWidget(action_box, 2, 0) from_box = Qt.QGroupBox('De:') self.from_regular_expression = Qt.QRadioButton('Expressão regular') self.from_regular_grammar = Qt.QRadioButton('Gramática regular') self.from_finite_automata = Qt.QRadioButton('Automato Finito') from_layout = Qt.QVBoxLayout() from_layout.addWidget(self.from_regular_expression) from_layout.addWidget(self.from_regular_grammar) from_layout.addWidget(self.from_finite_automata) from_box.setLayout(from_layout) self.layout.addWidget(from_box, 2, 1) to_box = Qt.QGroupBox('Para:') self.to_regular_expression = Qt.QRadioButton('Expressão regular') self.to_regular_grammar = Qt.QRadioButton('Gramática regular') self.to_finite_automata = Qt.QRadioButton('Automato Finito') to_layout = Qt.QVBoxLayout() to_layout.addWidget(self.to_regular_expression) to_layout.addWidget(self.to_regular_grammar) to_layout.addWidget(self.to_finite_automata) to_box.setLayout(to_layout) self.layout.addWidget(to_box, 2, 2) self.convert_button = Qt.QPushButton('Converter') self.layout.addWidget(self.convert_button, 2, 3)
def __init__(self): self.fields = [ annotator.BoolField('exclude'), annotator.StringField('notes') ] exclude, notes = [field.widget for field in self.fields] exclude.setText('Exclude') notes.setPlaceholderText('notes') self.widget = Qt.QGroupBox('timepoint annotations') layout = Qt.QHBoxLayout() self.widget.setLayout(layout) layout.addWidget(notes) layout.addWidget(exclude)
def __init__(self, astergui, parent=None): """ Create `Show all` edition panel. Arguments: astergui (AsterGui): Parent AsterGui instance. parent (Optional[QWidget]): Parent widget. Defaults to *None*. """ super(ShowAllPanel, self).__init__(parent=parent, name=translate("ShowAllPanel", "Show all commands"), astergui=astergui) self.setWindowTitle(translate("ShowAllPanel", "Add command")) self.setPixmap(load_pixmap("as_pic_new_command.png")) v_layout = Q.QVBoxLayout(self) v_layout.setContentsMargins(0, 0, 0, 0) self.panel = Panel(self) description = Q.QGroupBox(self) description.setTitle(translate("ShowAllPanel", "Command description")) desc_layout = Q.QVBoxLayout(description) self.info = Q.QLabel(description) self.info.setWordWrap(True) self.info.setOpenExternalLinks(True) desc_layout.addWidget(self.info) for category in CATA.get_categories("showall"): # get commands from category items = CATA.get_category(category) if not items: continue # get translation for category's title view = CategoryView(translate_category(category), parent=self.panel) view.category = category for item in items: # get translation for command title = translate_command(item) if title != item: title = title + " ({})".format(item) view.addItem(title, item) self.panel.addWidget(view) connect(view.selected, self._selectionChanged) connect(view.doubleClicked, self._doubleClicked) v_layout.addWidget(self.panel) v_layout.addWidget(description) connect(self.astergui().selectionChanged, self.updateButtonStatus) self.panel.installEventFilter(self) self.setFocusProxy(self.panel)
def __init__(self, ris_widget, fields, image_directory, batch_size=200, annotation_filename='annotations'): super().__init__(ris_widget, fields) widget = Qt.QGroupBox() annotation_layout = Qt.QVBoxLayout(widget) ris_widget.add_annotator(fields) self.ris_widget = ris_widget self.image_directory = pathlib.Path(image_directory) # image_list = list(self.image_directory.glob('*.png')) image_list = list(self.image_directory.glob('*_*.png')) self.images = sorted( image_list, key=lambda entry: int(entry.name.split('_')[0]) ) # Sort by first field (alt. just rename to have constant number of zeros at beginning) assert self.images self.annotation_file = self.image_directory / f'{annotation_filename}.txt' self.annotations = collections.defaultdict(dict) self.load_annotations() self.batch_size = batch_size self.batch_num = 0 info_layout = Qt.QHBoxLayout() info_layout.setSpacing(11) save = self._add_button(info_layout, 'Save', self.save_annotations) annotation_layout.addLayout(info_layout) nav_buttons = Qt.QHBoxLayout() nav_buttons.setSpacing(11) self._prev_button = self._add_button(nav_buttons, '\N{LEFTWARDS ARROW TO BAR}', lambda: self.load_next_batch(-1)) self._add_button(nav_buttons, '\N{UPWARDS ARROW}', self.prev_timepoint) self._add_button(nav_buttons, '\N{DOWNWARDS ARROW}', self.next_timepoint) self._next_button = self._add_button(nav_buttons, '\N{RIGHTWARDS ARROW TO BAR}', lambda: self.load_next_batch(1)) annotation_layout.addLayout(nav_buttons) ris_widget.annotator.layout().insertRow(0, widget) self.load_next_batch(0)
def init_widget(self): self.widget = Qt.QGroupBox(self.name) layout = Qt.QHBoxLayout() self.widget.setLayout(layout) self.label = Qt.QLabel() layout.addWidget(self.label) for category, key in zip(self.CATEGORIES, self.SHORTCUTS): button = Qt.QPushButton(category) callback = self._make_annotation_callback(category) button.clicked.connect(callback) layout.addWidget(button) Qt.QShortcut(key, self.widget, callback, context=Qt.Qt.ApplicationShortcut)
def init_widget(self): self.widget = Qt.QGroupBox(self.name) layout = Qt.QHBoxLayout() self.widget.setLayout(layout) self.label = Qt.QLabel() layout.addWidget(self.label) self.draw = _add_button(layout, 'Draw Spline', self._handle_spline_drawing) self.draw.setEnabled(True) Qt.QShortcut(Qt.Qt.Key_D, self.widget, self._handle_spline_drawing, context=Qt.Qt.ApplicationShortcut) self.show_spline = Qt.QCheckBox('Show Splines') self.show_spline.setChecked(True) self.show_spline.toggled.connect(self.toggle_show_spline) layout.addWidget(self.show_spline)
def init_widget(self): self.widget = Qt.QGroupBox(self.name) layout = Qt.QHBoxLayout() self.widget.setLayout(layout) self.buttons = [] self.button_group = Qt.QButtonGroup() for stage, key in zip(self.stages, self.shortcuts): button = Qt.QPushButton(stage) self.buttons.append(button) button.setCheckable(True) self.button_group.addButton(button) callback = self._make_stage_callback(button, stage) button.clicked.connect(callback) layout.addWidget(button) Qt.QShortcut(key, self.widget, callback, context=Qt.Qt.ApplicationShortcut)
def _curveTypeBox(self): box = Qt.QGroupBox(title="Curve Info") self.curveInfoBox = box lo = Qt.QHBoxLayout() lab = Qt.QLabel("Curve Type", self) lo.addWidget(lab) self.curveTypesSelector = self._curvesComboBox() lo.addWidget(self.curveTypesSelector) self.polyLabel = Qt.QLabel("Polynomial Order:") self.polyOrderBox = Qt.QLineEdit("3") orderVal = Qt.QIntValidator() orderVal.setBottom(0) self.polyOrderBox.setValidator(orderVal) self.polyOrderBox.textChanged.connect(self._polyOrderChanged) if self.getCurveTypeIndex() == 1: lo.addWidget(self.polyLabel) lo.addWidget(self.polyOrderBox) box.setLayout(lo) return box
def initUI(self): ###################################################################### # Spectrum analyzer/Diagnostics ###################################################################### self.qgroupbox_diagnostics = Qt.QGroupBox( 'Spectrum analyzer/diagnostics (all computed from raw ADC input)', self) # Create the scale which indicates the ADC fill ratio: self.qlabel_adc_fill = Qt.QLabel('ADC fill\n[bits]') self.qlabel_adc_fill.setAlignment(Qt.Qt.AlignHCenter) self.qadc0_scale = ThermometerWidget() #Qwt.QwtThermo() #self.qadc0_scale.setOrientation(Qt.Qt.Vertical, Qwt.QwtThermo.LeftScale) self.qadc0_scale.setRange(0, 16) #self.qadc0_scale.setScale(0, 16) self.qadc0_scale.setValue(0) self.qadc0_scale.setFillColor(Qt.Qt.blue) ticksListMajor = [0, 5, 10, 15] ticksListMinor = [2.5, 7.5, 12.5] ticksLabelMajor = list(map(str, ticksListMajor)) self.qadc0_scale.setTicks(ticksListMajor, ticksListMinor, ticksLabelMajor) self.qlabel_adc_fill_value = Qt.QLabel('10 bits') self.qlabel_adc_fill_value.setAlignment(Qt.Qt.AlignHCenter) # Create the scale which indicates the baseband SNR: self.qlabel_baseband_snr = Qt.QLabel('SNR\n[dB]') self.qlabel_baseband_snr.setAlignment(Qt.Qt.AlignHCenter) self.qthermo_baseband_snr = ThermometerWidget() #Qwt.QwtThermo() #self.qthermo_baseband_snr.setOrientation(Qt.Qt.Vertical, Qwt.QwtThermo.LeftScale) self.qthermo_baseband_snr.setRange(0, 50) self.qthermo_baseband_snr.setScale(0, 50) self.qthermo_baseband_snr.setValue(0) self.qthermo_baseband_snr.setFillColor(Qt.Qt.blue) ticksListMajor = [0, 10, 20, 30, 40, 50] ticksListMinor = [5, 15, 25, 35, 45] ticksLabelMajor = list(map(str, ticksListMajor)) self.qthermo_baseband_snr.setTicks(ticksListMajor, ticksListMinor, ticksLabelMajor) self.qlabel_baseband_snr_value = Qt.QLabel('20 dB') self.qlabel_baseband_snr_value.setAlignment(Qt.Qt.AlignHCenter) # Create the widgets which shows the current dac output and sets the output offset: self.qlabel_dac_current = {} self.qlabel_dac_current_value = {} self.qthermo_dac_current = {} self.qlabel_dac_offset = {} self.q_dac_offset = {} self.qlabel_dac_offset_value = {} for k in range(3): if self.output_controls[k] == True: self.qlabel_dac_current[k] = Qt.QLabel('Output\nDAC %d [V]' % k) self.qlabel_dac_current[k].setAlignment(Qt.Qt.AlignHCenter) self.qthermo_dac_current[k] = ThermometerWidget( ) #Qwt.QwtThermo() #self.qthermo_dac_current[k].setOrientation(Qt.Qt.Vertical, Qwt.QwtThermo.LeftScale) self.qthermo_dac_current[k].setRange( self.sl.convertDACCountsToVolts(k, self.sl.DACs_limit_low[k]), self.sl.convertDACCountsToVolts( k, self.sl.DACs_limit_high[k])) self.qthermo_dac_current[k].setScale( self.sl.convertDACCountsToVolts(k, self.sl.DACs_limit_low[k]), self.sl.convertDACCountsToVolts( k, self.sl.DACs_limit_high[k])) self.qthermo_dac_current[k].setValue(0) #self.qthermo_dac_current[k].setFillBrush(Qt.QBrush(Qt.QColor(0, 186, 52))) self.qthermo_dac_current[k].setFillColor(Qt.QColor(0, 186, 52)) if k == 2: ticksListMajor = [0, 1, 2, 3] ticksListMinor = [0.5, 1.5, 2.5] else: ticksListMajor = [-1, -0.5, 0, 0.5, 1] ticksListMinor = [-0.75, -0.25, 0.25, 0.75] ticksLabelMajor = list(map(str, ticksListMajor)) self.qthermo_dac_current[k].setTicks(ticksListMajor, ticksListMinor, ticksLabelMajor) self.qlabel_dac_offset[k] = Qt.QLabel('Offset\nDAC %d [V]' % k) self.qlabel_dac_offset[k].setAlignment(Qt.Qt.AlignHCenter) self.q_dac_offset[k] = Qt.QSlider() self.q_dac_offset[k].valueChanged.connect( self.setDACOffset_event) self.q_dac_offset[k].setSliderPosition(0) self.q_dac_offset[k].setOrientation(Qt.Qt.Vertical) # Units are millionth of the full range available between the min and max DAC value self.q_dac_offset[k].setMinimum(0) self.q_dac_offset[k].setMaximum(1e6) self.qlabel_dac_current_value[k] = Qt.QLabel('0 V') self.qlabel_dac_current_value[k].setAlignment( Qt.Qt.AlignHCenter) self.qlabel_dac_offset_value[k] = Qt.QLabel('0 V') self.qlabel_dac_offset_value[k].setAlignment( Qt.Qt.AlignHCenter) # Create widgets to set the number of points for the graphs: self.qlabel_rawdata_rbw = Qt.QLabel('RBW: 100 kHz; Points:') self.qedit_rawdata_length = Qt.QLineEdit('1.73e3') self.qedit_rawdata_length.setMaximumWidth(60) # Plot type select self.qlabel_adc_plot_type = Qt.QLabel('Plot type:') self.qcombo_adc_plottype = Qt.QComboBox() self.qcombo_adc_plottype.addItems([ 'Spectrum', 'Time: raw input', 'Time: Phase', 'Time: IQ', 'Time: IQ, synced' ]) # Input select self.qlabel_adc_plot_input = Qt.QLabel('Input:') self.qcombo_adc_plot = Qt.QComboBox() self.qcombo_adc_plot.addItems(['ADC0', 'ADC1', 'DAC0', 'DAC1', 'DAC2']) self.qcombo_adc_plot.setCurrentIndex(self.selected_ADC) # Set a few global PyQtGraph settings before creating plots: pg.setConfigOption('leftButtonPan', False) pg.setConfigOption('background', 'w') pg.setConfigOption('foreground', 'k') pg.setConfigOption('antialias', True) # Create the baseband IQ plot: #self.qplt_IQ = Qwt.QwtPlot() self.qplt_IQ = pg.PlotWidget() #self.qplt_IQ.move(50, 50) #self.qplt_IQ.resize(200, 200) self.qplt_IQ.setMinimumSize(50, 50) self.qplt_IQ.setMaximumSize(200, 200) self.qplt_IQ.setFixedSize(100, 100) # self.qplt_IQ.setsetHeightForWidth(True) # qPolicy = Qt.QSizePolicy(Qt.QSizePolicy.Preferred, Qt.QSizePolicy.Preferred) qPolicy = Qt.QSizePolicy(Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Fixed) # qPolicy.setHeightForWidth(True) self.qplt_IQ.setSizePolicy(qPolicy) # self.qplt_IQ.setSizePolicy(Qt.QSizePolicy.setHeightForWidth(True)) # print(self.qplt_IQ.sizeHint()) #self.qplt_IQ.setTitle('', fill=None) # self.qplt_IQ.setTitle('Baseband IQ') #self.qplt_IQ.setCanvasBackground(Qt.Qt.white) #self.qplt_IQ.enableAxis(Qwt.QwtPlot.yLeft, False) #self.qplt_IQ.enableAxis(Qwt.QwtPlot.xBottom, False) self.qplt_IQ.hideAxis('left') self.qplt_IQ.hideAxis('bottom') self.lblplt_IQ_title = Qt.QLabel('Baseband IQ:') # Create the curves in the plot self.curve_IQ = self.qplt_IQ.getPlotItem().plot(pen=None, symbol='o', symbolPen=None, symbolSize=3, symbolBrush='b') # self.curve_IQ = Qwt.QwtPlotCurve('Spectrum') # self.curve_IQ.attach(self.qplt_IQ) # self.curve_IQ.setPen(Qt.QPen(Qt.Qt.NoPen)) # self.curve_IQ.setSymbol(Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse, # Qt.QBrush(Qt.Qt.blue), # Qt.QPen(Qt.Qt.blue), # Qt.QSize(3, 3))) # self.curve_IQ.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased); # Create the frequency domain plot: # self.qplt_spc = Qwt.QwtPlot() # self.qplt_spc.setTitle('Spectrum') # self.qplt_spc.setCanvasBackground(Qt.Qt.white) self.plt_spc = pg.PlotWidget() # Create the curves in the plot # self.curve_spc = Qwt.QwtPlotCurve('Spectrum') # self.curve_spc.attach(self.qplt_spc) # self.curve_spc.setPen(Qt.QPen(Qt.Qt.blue)) # self.curve_filter = Qwt.QwtPlotCurve('Spectrum') # self.curve_filter.attach(self.qplt_spc) # self.curve_filter.setPen(Qt.QPen(Qt.Qt.red)) self.curve_spc = self.plt_spc.getPlotItem().plot(title='Spectrum', pen='b') self.curve_filter = self.plt_spc.getPlotItem().plot(pen='r') # Put all the widgets into a grid layout grid = QtGui.QGridLayout() grid.setSpacing(5) grid.addWidget(self.qlabel_adc_fill, 0, 0) grid.addWidget(self.qadc0_scale, 1, 0, 3, 1) grid.addWidget(self.qlabel_adc_fill_value, 4, 0, 1, 1) grid.addWidget(self.qlabel_baseband_snr, 0, 1) grid.addWidget(self.qthermo_baseband_snr, 1, 1, 3, 1) grid.addWidget(self.qlabel_baseband_snr_value, 4, 1, 1, 1) N_dac_controls = 0 for k in range(3): if self.output_controls[k] == True: grid.addWidget(self.qlabel_dac_current[k], 0, 2 + N_dac_controls) grid.addWidget(self.qthermo_dac_current[k], 1, 2 + N_dac_controls, 3, 1) grid.addWidget(self.qlabel_dac_current_value[k], 4, 2 + N_dac_controls, 1, 1) grid.addWidget(self.qlabel_dac_offset[k], 0, 3 + N_dac_controls) grid.addWidget(self.q_dac_offset[k], 1, 3 + N_dac_controls, 3, 1) grid.addWidget(self.qlabel_dac_offset_value[k], 4, 3 + N_dac_controls, 1, 1) N_dac_controls = N_dac_controls + 2 grid.setRowStretch(1, 1) # The plots: qhoriz = Qt.QHBoxLayout() qhoriz.addWidget(self.lblplt_IQ_title) qhoriz.addWidget(self.qplt_IQ) qhoriz.addStretch(1) grid.addLayout(qhoriz, 0, 2 + N_dac_controls, 2, 2) #grid.addWidget(self.qplt_IQ, 0, 2+N_dac_controls, 2, 2) grid.addWidget(self.plt_spc, 0, 4 + N_dac_controls, 5, 1) grid.setColumnStretch(4 + N_dac_controls, 1) # # The controls below the IQ plot: grid.addWidget(self.qlabel_adc_plot_input, 2, 2 + N_dac_controls) grid.addWidget(self.qlabel_adc_plot_type, 3, 2 + N_dac_controls) grid.addWidget(self.qlabel_rawdata_rbw, 4, 2 + N_dac_controls) grid.addWidget(self.qcombo_adc_plot, 2, 3 + N_dac_controls) grid.addWidget(self.qcombo_adc_plottype, 3, 3 + N_dac_controls) grid.addWidget(self.qedit_rawdata_length, 4, 3 + N_dac_controls) # grid.addItem(spacerItem, 9, 0, 1, 2) if self.PalNormal is not None: self.qgroupbox_diagnostics.setPalette(self.PalNormal) self.qgroupbox_diagnostics.setLayout(grid) self.qgroupbox_diagnostics.setAutoFillBackground(True) vbox = Qt.QVBoxLayout() vbox.addWidget(self.qgroupbox_diagnostics) self.setLayout(vbox)
def initUI(self, modulation_frequency_in_hz, output_amplitude, integration_time_in_seconds, bEnableDither): # Create the widgets which control the dither module: # Controls for the dither mode: # Needs: output select, frequency, amplitude, Square/Sine select, dither on/off ###################################################################### # Settings ###################################################################### self.qgroupbox_dither = Qt.QGroupBox('Dither DAC%d settings' % self.output_number) self.qgroupbox_dither.setAutoFillBackground(True) # Modulation frequency: self.qedit_freq_label = Qt.QLabel('Frequency [Hz]:') self.qedit_dither_freq = Qt.QLineEdit(str(modulation_frequency_in_hz)) self.qedit_dither_freq.textChanged.connect(self.ditherClicked) self.qedit_dither_freq.setMaximumWidth(100) # Integration time: self.qedit_int_label = Qt.QLabel('Integration time [s]:') self.qedit_integration_time = Qt.QLineEdit( str(integration_time_in_seconds)) self.qedit_integration_time.textChanged.connect(self.ditherClicked) self.qedit_integration_time.setMaximumWidth(100) # Amplitude: self.qlabel_dither_amplitude = Qt.QLabel('Amplitude [0-1]:') self.qedit_dither_amplitude = Qt.QLineEdit(str(output_amplitude)) self.qedit_dither_amplitude.textChanged.connect(self.ditherClicked) self.qedit_dither_amplitude.setMaximumWidth(100) # # On/Off button # self.qbtn_dither = QtGui.QPushButton('Activate dither') # self.qbtn_dither.clicked.connect(self.ditherClicked) # self.qbtn_dither.setCheckable(True) # self.qbtn_dither.setChecked(bool(bEnableDither)) # Mode select button (Automatic, Manual Off, Manual On) self.qchk_mode_auto = QtGui.QRadioButton('Automatic') self.qchk_mode_manual_off = QtGui.QRadioButton('Manual Off') self.qchk_mode_manual_on = QtGui.QRadioButton('Manual On') qbtn_group = Qt.QButtonGroup() qbtn_group.addButton(self.qchk_mode_auto) qbtn_group.addButton(self.qchk_mode_manual_off) qbtn_group.addButton(self.qchk_mode_manual_on) self.qchk_mode_auto.setChecked(True) self.qchk_mode_auto.clicked.connect(self.ditherClicked) self.qchk_mode_manual_off.clicked.connect(self.ditherClicked) self.qchk_mode_manual_on.clicked.connect(self.ditherClicked) # Put all the widgets into a grid layout grid = QtGui.QGridLayout() grid.addWidget(self.qedit_freq_label, 0, 0) grid.addWidget(self.qedit_dither_freq, 0, 1) grid.addWidget(self.qedit_int_label, 1, 0) grid.addWidget(self.qedit_integration_time, 1, 1) grid.addWidget(self.qlabel_dither_amplitude, 2, 0) grid.addWidget(self.qedit_dither_amplitude, 2, 1) grid.addWidget(self.qchk_mode_auto, 3, 0, 1, 2) grid.addWidget(self.qchk_mode_manual_off, 4, 0, 1, 2) grid.addWidget(self.qchk_mode_manual_on, 5, 0, 1, 2) self.qgroupbox_dither.setLayout(grid) vbox = Qt.QVBoxLayout() vbox.addWidget(self.qgroupbox_dither) self.setLayout(vbox) # Adjust the size and position of the window # self.resize(800, 600) self.center() self.setWindowTitle('Dither #%d control' % self.output_number)
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") 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.window_size = window_size = 48 self.sync_length = sync_length = 320 self.samp_rate = samp_rate = 2e6 self.rf = rf = 14 self.lo_offset = lo_offset = 0 self.gain = gain = 0.75 self.freqq = freqq = 2.412e6 self.freq = freq = 2412000000.0 self.device_6 = device_6 = "hackrf=26b468dc3540b58f" self.device_5 = device_5 = "hackrf=88869dc38686a1b" self.device_4 = device_4 = "hackrf=88869dc2930b41b" self.device_3 = device_3 = "hackrf=88869dc3347501b" self.device_2 = device_2 = "hackrf=88869dc3918701b" self.device_1 = device_1 = "hackrf=88869dc3397a01b" self.chan_est = chan_est = 0 self.bb = bb = 20 self.IF = IF = 30 ################################################## # Blocks ################################################## # Create the options list self._samp_rate_options = [ 2000000.0, 5000000.0, 10000000.0, 20000000.0 ] # Create the labels list self._samp_rate_labels = ['2MHz', '5 MHz', '10 MHz', '20 MHz'] # Create the combo box 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])) # Create the radio buttons self.top_layout.addWidget(self._samp_rate_tool_bar) self._rf_range = Range(0, 50, 1, 14, 200) self._rf_win = RangeWidget(self._rf_range, self.set_rf, 'rf', "counter_slider", int) self.top_layout.addWidget(self._rf_win) # Create the options list self._chan_est_options = [0, 1, 3, 2] # Create the labels list self._chan_est_labels = ['LS', 'LMS', 'STA', 'Linear Comb'] # Create the combo box # Create the radio buttons 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_layout.addWidget(self._chan_est_group_box) self._bb_range = Range(0, 70, 1, 20, 200) self._bb_win = RangeWidget(self._bb_range, self.set_bb, 'bb', "counter_slider", int) self.top_layout.addWidget(self._bb_win) self._IF_range = Range(0, 50, 1, 30, 200) self._IF_win = RangeWidget(self._IF_range, self.set_IF, 'IF', "counter_slider", int) self.top_layout.addWidget(self._IF_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(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 = ['', '', '', '', '', '', '', '', '', ''] 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_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) 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_layout.addWidget(self._qtgui_const_sink_x_0_win) self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + device_5) self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t()) self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(2.45e9, 0) self.osmosdr_source_0.set_freq_corr(0, 0) self.osmosdr_source_0.set_dc_offset_mode(0, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(rf, 0) self.osmosdr_source_0.set_if_gain(IF, 0) self.osmosdr_source_0.set_bb_gain(bb, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(0, 0) # Create the options list self._lo_offset_options = [0, 6000000.0, 11000000.0] # Create the labels list self._lo_offset_labels = ['0', '6000000.0', '11000000.0'] # Create the combo box 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])) # Create the radio buttons self.top_layout.addWidget(self._lo_offset_tool_bar) 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_frame_equalizer_0 = ieee802_11.frame_equalizer( chan_est, 2.45e9, samp_rate, False, False) self.ieee802_11_decode_mac_0 = ieee802_11.decode_mac(True, False) 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_layout.addWidget(self._gain_win) # Create the options list self._freqq_options = [2437000.0, 2462000.0, 2412000.0] # Create the labels list self._freqq_labels = ['ch6', 'ch11', 'ch1'] # Create the combo box self._freqq_tool_bar = Qt.QToolBar(self) self._freqq_tool_bar.addWidget(Qt.QLabel("freqq: ")) self._freqq_combo_box = Qt.QComboBox() self._freqq_tool_bar.addWidget(self._freqq_combo_box) for _label in self._freqq_labels: self._freqq_combo_box.addItem(_label) self._freqq_callback = lambda i: Qt.QMetaObject.invokeMethod( self._freqq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._freqq_options.index(i))) self._freqq_callback(self.freqq) self._freqq_combo_box.currentIndexChanged.connect( lambda i: self.set_freqq(self._freqq_options[i])) # Create the radio buttons self.top_layout.addWidget(self._freqq_tool_bar) # Create the options list 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 ] # Create the labels list 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' ] # Create the combo box 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])) # Create the radio buttons self.top_layout.addWidget(self._freq_tool_bar) self.foo_wireshark_connector_0 = foo.wireshark_connector(127, False) self.fft_vxx_0 = fft.fft_vcc(64, True, window.rectangular(64), True, 1) self.correctiq_correctiq_0 = correctiq.correctiq() 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_moving_average_xx_1 = blocks.moving_average_cc( window_size, 1, 4000, 1) self.blocks_moving_average_xx_0 = blocks.moving_average_ff( window_size + 16, 1, 4000, 1) self.blocks_file_sink_2 = blocks.file_sink( gr.sizeof_gr_complex * 1, '/home/erc/SDN/symbols_5_1.bin', False) self.blocks_file_sink_2.set_unbuffered(True) self.blocks_file_sink_1_1 = blocks.file_sink( gr.sizeof_gr_complex * 64, '/home/erc/SDN/before_fft_5_1.bin', False) self.blocks_file_sink_1_1.set_unbuffered(True) self.blocks_file_sink_1_0 = blocks.file_sink( gr.sizeof_char * 48, '/home/erc/SDN/output_equ_5_1.bin', False) self.blocks_file_sink_1_0.set_unbuffered(True) self.blocks_file_sink_1 = blocks.file_sink( gr.sizeof_gr_complex * 64, '/home/erc/SDN/after_fft_5_1.bin', False) self.blocks_file_sink_1.set_unbuffered(True) self.blocks_file_sink_0 = blocks.file_sink( gr.sizeof_char * 1, '/home/erc/SDN/wifi_5_1.pcap', False) self.blocks_file_sink_0.set_unbuffered(True) 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.foo_wireshark_connector_0, 'in')) 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.blocks_moving_average_xx_0, 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_moving_average_xx_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_moving_average_xx_1, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.blocks_moving_average_xx_1, 0), (self.ieee802_11_sync_short_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_moving_average_xx_1, 0)) self.connect((self.blocks_pdu_to_tagged_stream_1, 0), (self.blocks_file_sink_2, 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.blocks_file_sink_1_1, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.correctiq_correctiq_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.correctiq_correctiq_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.correctiq_correctiq_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.fft_vxx_0, 0), (self.blocks_file_sink_1, 0)) self.connect((self.fft_vxx_0, 0), (self.ieee802_11_frame_equalizer_0, 0)) self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.ieee802_11_frame_equalizer_0, 0), (self.blocks_file_sink_1_0, 0)) self.connect((self.ieee802_11_frame_equalizer_0, 0), (self.ieee802_11_decode_mac_0, 0)) 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.osmosdr_source_0, 0), (self.correctiq_correctiq_0, 0))
def initUI(self): # init the UI self.qlabel_serial = Qt.QLabel('Connected FPGAs') self.qlabel_broadcast = Qt.QLabel('UDP Broadcast address') self.qlabel_firmware = Qt.QLabel('FPGA Firmware file') self.qlabel_software = Qt.QLabel('CPU Software file') self.qcombo_serial = Qt.QComboBox() self.qcombo_serial.setMinimumContentsLength( 100 ) # I can't figure out how to make it scale correctly with content so we'll make it big enough... self.qcombo_serial.setSizeAdjustPolicy( Qt.QComboBox.AdjustToMinimumContentsLength) self.qedit_broadcast = Qt.QLineEdit(self.strBroadcastAddress) self.qedit_firmware = Qt.QLineEdit(self.strFPGAFirmware) self.qedit_software = Qt.QLineEdit(self.strCPUFirmware) self.qbtn_send_broadcast = Qt.QPushButton('Broadcast discovery packet') self.qbtn_reprogram_fpga = Qt.QPushButton('Update FPGA firmware') self.qbtn_reprogram_cpu = Qt.QPushButton('Update CPU software') self.qbtn_send_broadcast.clicked.connect( self.reset_list_and_send_broadcast) self.qbtn_reprogram_fpga.clicked.connect(self.programFPGAClicked) self.qbtn_reprogram_cpu.clicked.connect(self.programCPUClicked) self.qradio_reprogram = Qt.QRadioButton('Send default values') self.qradio_noreprogram = Qt.QRadioButton( 'Connect to an already running box') self.qradio_reprogram.setChecked(True) self.qradio_noreprogram.setDisabled(True) btn_group = Qt.QButtonGroup(self) btn_group.addButton(self.qradio_reprogram) btn_group.setId(self.qradio_reprogram, 0) btn_group.addButton(self.qradio_noreprogram) btn_group.setId(self.qradio_noreprogram, 1) # btn_group2 = Qt.QButtonGroup(self) # btn_group2.addButton(self.qradio_usefromlist) # btn_group2.setId(self.qradio_usefromlist, 0) # btn_group2.addButton(self.qradio_usefromtextbox) # btn_group2.setId(self.qradio_usefromtextbox, 1) self.qbtn_yes = Qt.QPushButton('OK') self.qbtn_no = Qt.QPushButton('Cancel') self.qbtn_yes.clicked.connect(self.okClicked) self.qbtn_no.clicked.connect(self.cancelClicked) self.qgroupbox_IP_addr = Qt.QGroupBox('IP Address') gridIP = Qt.QGridLayout() self.qradio_usefromlist = Qt.QRadioButton('Use listed') self.qradio_usefromtextbox = Qt.QRadioButton('Use manual entry') self.qradio_usefromtextbox.setChecked(False) self.qradio_usefromlist.setChecked(True) self.qlabel_manual_entry = Qt.QLabel('Manual IP entry') self.qedit_manual_entry = Qt.QLineEdit('192.168.0.150') self.qlabel_host_port = Qt.QLabel('Host Port') self.qedit_host_port = Qt.QLineEdit('5000') gridIP.addWidget(self.qradio_usefromtextbox, 0, 0) gridIP.addWidget(self.qlabel_manual_entry, 0, 1) gridIP.addWidget(self.qedit_manual_entry, 0, 2) gridIP.addWidget(self.qlabel_host_port, 0, 3) gridIP.addWidget(self.qedit_host_port, 0, 4) gridIP.addWidget(self.qradio_usefromlist, 1, 0) gridIP.addWidget(self.qlabel_serial, 1, 1) gridIP.addWidget(self.qcombo_serial, 1, 2) gridIP.addWidget(self.qbtn_send_broadcast, 2, 0) gridIP.addWidget(self.qlabel_broadcast, 2, 1) gridIP.addWidget(self.qedit_broadcast, 2, 2) self.qgroupbox_IP_addr.setLayout(gridIP) self.qgroupbox_connection = Qt.QGroupBox('Red Pitaya Connection') gridConnection = Qt.QGridLayout() self.qradio_pushValue = Qt.QRadioButton( 'Push default values to Red Pitaya') self.qradio_existingRP = Qt.QRadioButton( 'Reconnect to an already running Red Pitaya') self.qradio_noRP = Qt.QRadioButton( 'Open the GUI without any Red Pitaya') self.qradio_existingRP.setChecked(True) gridConnection.addWidget(self.qradio_pushValue, 0, 0) gridConnection.addWidget(self.qradio_existingRP, 0, 1) gridConnection.addWidget(self.qradio_noRP, 0, 2) self.qgroupbox_connection.setLayout(gridConnection) # btn_group2 = Qt.QButtonGroup(self) # btn_group2.addButton(self.qradio_clk_internal) # btn_group2.addButton(self.qradio_clk_external) # btn_group2.setId(self.qradio_clk_internal, 2) # btn_group2.setId(self.qradio_clk_external, 3) # self.close.connect(self.closeEvent) grid = Qt.QGridLayout() grid.addWidget(self.qgroupbox_IP_addr, 2, 0, 1, 3) grid.addWidget(self.qgroupbox_connection, 0, 0, 1, 3) grid.addWidget(self.qbtn_reprogram_fpga, 3, 0) grid.addWidget(self.qlabel_firmware, 3, 1) grid.addWidget(self.qedit_firmware, 3, 2) grid.addWidget(self.qbtn_reprogram_cpu, 4, 0) grid.addWidget(self.qlabel_software, 4, 1) grid.addWidget(self.qedit_software, 4, 2) # #FEATURE # grid.addWidget(self.qradio_reprogram, 4, 0) # grid.addWidget(self.qradio_noreprogram, 4, 1) # grid.addWidget(self.qradio_clk_internal, 3, 0) # grid.addWidget(self.qradio_clk_external, 3, 1) # grid.addWidget(self.qbtn_yes, 4, 0) # grid.addWidget(self.qbtn_no, 4, 1) hbox = Qt.QHBoxLayout() hbox.addStretch(1) hbox.addWidget(self.qbtn_yes) hbox.addWidget(self.qbtn_no) grid.addLayout(hbox, 5, 0, 1, 3) self.setLayout(grid) self.setWindowTitle('Initial configuration') self.qbtn_yes.setFocus() self.show()
def __init__(self): gr.top_block.__init__(self, "Uhd Hf Am") Qt.QWidget.__init__(self) self.setWindowTitle("Uhd Hf Am") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "uhd_hf_am") 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 = 2.5e6 self.rx_freq = rx_freq = 1.0e6 self.fine_freq = fine_freq = 0 self.coarse_freq = coarse_freq = 0 self.volume = volume = 1 self.usb_lsb = usb_lsb = -1 self.ssb_am = ssb_am = 0 self.selection = selection = ((1, 0, 0), (0, 1, 0), (0, 0, 1)) self.pll_lbw = pll_lbw = 200 self.pll_freq = pll_freq = 100 self.lpf_cutoff = lpf_cutoff = 2e3 self.interp = interp = 48 self.freq_label = freq_label = rx_freq + fine_freq + coarse_freq self.decim = decim = samp_rate / 1e3 self.decay_rate = decay_rate = 100e-6 self.audio_ref = audio_ref = 1 self.audio_max_gain = audio_max_gain = 1 self.audio_gain = audio_gain = 1 self.audio_decay = audio_decay = 100 self.audio_attack = audio_attack = 1000 ################################################## # Blocks ################################################## self._volume_range = Range(0, 100, .1, 1, 200) self._volume_win = RangeWidget(self._volume_range, self.set_volume, 'volume', "counter_slider", float) self.top_grid_layout.addWidget(self._volume_win, 7, 0, 1, 4) for r in range(7, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) # Create the options list self._usb_lsb_options = [-1, 1] # Create the labels list self._usb_lsb_labels = ['USB', 'LSB'] # Create the combo box # Create the radio buttons self._usb_lsb_group_box = Qt.QGroupBox('usb_lsb' + ": ") self._usb_lsb_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._usb_lsb_button_group = variable_chooser_button_group() self._usb_lsb_group_box.setLayout(self._usb_lsb_box) for i, _label in enumerate(self._usb_lsb_labels): radio_button = Qt.QRadioButton(_label) self._usb_lsb_box.addWidget(radio_button) self._usb_lsb_button_group.addButton(radio_button, i) self._usb_lsb_callback = lambda i: Qt.QMetaObject.invokeMethod( self._usb_lsb_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._usb_lsb_options.index(i))) self._usb_lsb_callback(self.usb_lsb) self._usb_lsb_button_group.buttonClicked[int].connect( lambda i: self.set_usb_lsb(self._usb_lsb_options[i])) self.top_grid_layout.addWidget(self._usb_lsb_group_box, 5, 5, 1, 1) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 6): self.top_grid_layout.setColumnStretch(c, 1) # Create the options list self._ssb_am_options = [0, 1, 2] # Create the labels list self._ssb_am_labels = ['SSB', 'AM', 'AM*'] # Create the combo box # Create the radio buttons self._ssb_am_group_box = Qt.QGroupBox('ssb_am' + ": ") self._ssb_am_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._ssb_am_button_group = variable_chooser_button_group() self._ssb_am_group_box.setLayout(self._ssb_am_box) for i, _label in enumerate(self._ssb_am_labels): radio_button = Qt.QRadioButton(_label) self._ssb_am_box.addWidget(radio_button) self._ssb_am_button_group.addButton(radio_button, i) self._ssb_am_callback = lambda i: Qt.QMetaObject.invokeMethod( self._ssb_am_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._ssb_am_options.index(i))) self._ssb_am_callback(self.ssb_am) self._ssb_am_button_group.buttonClicked[int].connect( lambda i: self.set_ssb_am(self._ssb_am_options[i])) self.top_grid_layout.addWidget(self._ssb_am_group_box, 4, 4, 1, 1) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 5): self.top_grid_layout.setColumnStretch(c, 1) self._rx_freq_range = Range(.2e6, 100e6, 100e3, 1.0e6, 200) self._rx_freq_win = RangeWidget(self._rx_freq_range, self.set_rx_freq, 'rx_freq', "counter_slider", float) self.top_grid_layout.addWidget(self._rx_freq_win, 4, 0, 1, 4) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self._pll_lbw_tool_bar = Qt.QToolBar(self) self._pll_lbw_tool_bar.addWidget(Qt.QLabel('pll_lbw' + ": ")) self._pll_lbw_line_edit = Qt.QLineEdit(str(self.pll_lbw)) self._pll_lbw_tool_bar.addWidget(self._pll_lbw_line_edit) self._pll_lbw_line_edit.returnPressed.connect(lambda: self.set_pll_lbw( eng_notation.str_to_num(str(self._pll_lbw_line_edit.text())))) self.top_grid_layout.addWidget(self._pll_lbw_tool_bar, 9, 7, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(7, 8): self.top_grid_layout.setColumnStretch(c, 1) self._pll_freq_tool_bar = Qt.QToolBar(self) self._pll_freq_tool_bar.addWidget(Qt.QLabel('pll_freq' + ": ")) self._pll_freq_line_edit = Qt.QLineEdit(str(self.pll_freq)) self._pll_freq_tool_bar.addWidget(self._pll_freq_line_edit) self._pll_freq_line_edit.returnPressed.connect( lambda: self.set_pll_freq( eng_notation.str_to_num(str(self._pll_freq_line_edit.text())))) self.top_grid_layout.addWidget(self._pll_freq_tool_bar, 9, 6, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 7): self.top_grid_layout.setColumnStretch(c, 1) # Create the options list self._lpf_cutoff_options = [2000.0, 3000.0, 4000.0, 8000.0] # Create the labels list self._lpf_cutoff_labels = ['2000.0', '3000.0', '4000.0', '8000.0'] # Create the combo box self._lpf_cutoff_tool_bar = Qt.QToolBar(self) self._lpf_cutoff_tool_bar.addWidget(Qt.QLabel("lpf_cutoff: ")) self._lpf_cutoff_combo_box = Qt.QComboBox() self._lpf_cutoff_tool_bar.addWidget(self._lpf_cutoff_combo_box) for _label in self._lpf_cutoff_labels: self._lpf_cutoff_combo_box.addItem(_label) self._lpf_cutoff_callback = lambda i: Qt.QMetaObject.invokeMethod( self._lpf_cutoff_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._lpf_cutoff_options.index(i))) self._lpf_cutoff_callback(self.lpf_cutoff) self._lpf_cutoff_combo_box.currentIndexChanged.connect( lambda i: self.set_lpf_cutoff(self._lpf_cutoff_options[i])) # Create the radio buttons self.top_grid_layout.addWidget(self._lpf_cutoff_tool_bar, 4, 5, 1, 1) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 6): self.top_grid_layout.setColumnStretch(c, 1) self._fine_freq_range = Range(-1e3, 1e3, 1, 0, 200) self._fine_freq_win = RangeWidget(self._fine_freq_range, self.set_fine_freq, 'fine_freq', "counter_slider", float) self.top_grid_layout.addWidget(self._fine_freq_win, 6, 0, 1, 4) for r in range(6, 7): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) # Create the options list self._decay_rate_options = [0.0001, 0.065, 0.02] # Create the labels list self._decay_rate_labels = ['Fast', 'Medium', 'Slow'] # Create the combo box # Create the radio buttons self._decay_rate_group_box = Qt.QGroupBox('decay_rate' + ": ") self._decay_rate_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._decay_rate_button_group = variable_chooser_button_group() self._decay_rate_group_box.setLayout(self._decay_rate_box) for i, _label in enumerate(self._decay_rate_labels): radio_button = Qt.QRadioButton(_label) self._decay_rate_box.addWidget(radio_button) self._decay_rate_button_group.addButton(radio_button, i) self._decay_rate_callback = lambda i: Qt.QMetaObject.invokeMethod( self._decay_rate_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._decay_rate_options.index(i))) self._decay_rate_callback(self.decay_rate) self._decay_rate_button_group.buttonClicked[int].connect( lambda i: self.set_decay_rate(self._decay_rate_options[i])) self.top_grid_layout.addWidget(self._decay_rate_group_box, 4, 6, 1, 1) for r in range(4, 5): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 7): self.top_grid_layout.setColumnStretch(c, 1) self._coarse_freq_range = Range(-100e3, 100e3, 1, 0, 200) self._coarse_freq_win = RangeWidget(self._coarse_freq_range, self.set_coarse_freq, 'coarse_freq', "counter_slider", float) self.top_grid_layout.addWidget(self._coarse_freq_win, 5, 0, 1, 4) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self._audio_ref_tool_bar = Qt.QToolBar(self) self._audio_ref_tool_bar.addWidget(Qt.QLabel('audio_ref' + ": ")) self._audio_ref_line_edit = Qt.QLineEdit(str(self.audio_ref)) self._audio_ref_tool_bar.addWidget(self._audio_ref_line_edit) self._audio_ref_line_edit.returnPressed.connect( lambda: self.set_audio_ref( eng_notation.str_to_num(str(self._audio_ref_line_edit.text())) )) self.top_grid_layout.addWidget(self._audio_ref_tool_bar, 9, 3, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 4): self.top_grid_layout.setColumnStretch(c, 1) self._audio_max_gain_tool_bar = Qt.QToolBar(self) self._audio_max_gain_tool_bar.addWidget( Qt.QLabel('audio_max_gain' + ": ")) self._audio_max_gain_line_edit = Qt.QLineEdit(str(self.audio_max_gain)) self._audio_max_gain_tool_bar.addWidget(self._audio_max_gain_line_edit) self._audio_max_gain_line_edit.returnPressed.connect( lambda: self.set_audio_max_gain( eng_notation.str_to_num( str(self._audio_max_gain_line_edit.text())))) self.top_grid_layout.addWidget(self._audio_max_gain_tool_bar, 9, 5, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 6): self.top_grid_layout.setColumnStretch(c, 1) self._audio_gain_tool_bar = Qt.QToolBar(self) self._audio_gain_tool_bar.addWidget(Qt.QLabel('audio_gain' + ": ")) self._audio_gain_line_edit = Qt.QLineEdit(str(self.audio_gain)) self._audio_gain_tool_bar.addWidget(self._audio_gain_line_edit) self._audio_gain_line_edit.returnPressed.connect( lambda: self.set_audio_gain( eng_notation.str_to_num(str(self._audio_gain_line_edit.text())) )) self.top_grid_layout.addWidget(self._audio_gain_tool_bar, 9, 4, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 5): self.top_grid_layout.setColumnStretch(c, 1) self._audio_decay_tool_bar = Qt.QToolBar(self) self._audio_decay_tool_bar.addWidget(Qt.QLabel('audio_decay' + ": ")) self._audio_decay_line_edit = Qt.QLineEdit(str(self.audio_decay)) self._audio_decay_tool_bar.addWidget(self._audio_decay_line_edit) self._audio_decay_line_edit.returnPressed.connect( lambda: self.set_audio_decay( eng_notation.str_to_num(str(self._audio_decay_line_edit.text()) ))) self.top_grid_layout.addWidget(self._audio_decay_tool_bar, 9, 2, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) self._audio_attack_tool_bar = Qt.QToolBar(self) self._audio_attack_tool_bar.addWidget(Qt.QLabel('audio_attack' + ": ")) self._audio_attack_line_edit = Qt.QLineEdit(str(self.audio_attack)) self._audio_attack_tool_bar.addWidget(self._audio_attack_line_edit) self._audio_attack_line_edit.returnPressed.connect( lambda: self.set_audio_attack( eng_notation.str_to_num( str(self._audio_attack_line_edit.text())))) self.top_grid_layout.addWidget(self._audio_attack_tool_bar, 9, 1, 1, 1) for r in range(9, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self.uhd_usrp_source_1 = uhd.usrp_source( ",".join(("addr=10.41.1.11", "")), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0, 1)), ), ) self.uhd_usrp_source_1.set_subdev_spec('A:B', 0) self.uhd_usrp_source_1.set_time_source('gpsdo', 0) self.uhd_usrp_source_1.set_clock_source('gpsdo', 0) self.uhd_usrp_source_1.set_center_freq(uhd.tune_request(rx_freq), 0) self.uhd_usrp_source_1.set_gain(0, 0) self.uhd_usrp_source_1.set_samp_rate(samp_rate) self.uhd_usrp_source_1.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=1, decimation=4, taps=None, fractional_bw=None) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=200, decimation=int(samp_rate / 1e3), taps=None, fractional_bw=None) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=interp, decimation=int(decim), taps=None, fractional_bw=None) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate / decim * interp / 3, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(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 = ['', '', '', '', '', '', '', '', '', ''] 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, 8, 0, 1, 4) for r in range(8, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_HORIZ, 1) self.qtgui_number_sink_0.set_update_time(0.010) self.qtgui_number_sink_0.set_title('') labels = ["RSSI", '', '', '', '', '', '', '', '', ''] units = ['', '', '', '', '', '', '', '', '', ''] colors = [("blue", "red"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in range(1): self.qtgui_number_sink_0.set_min(i, 0) self.qtgui_number_sink_0.set_max(i, 50) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance( self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win, 5, 6, 1, 1) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 7): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim * interp / 3, #bw "", #name 1) self.qtgui_freq_sink_x_0_0.set_update_time(0.0010) self.qtgui_freq_sink_x_0_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0.enable_grid(True) self.qtgui_freq_sink_x_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0_0.enable_control_panel(False) self.qtgui_freq_sink_x_0_0.disable_legend() labels = ['', 'processed', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in 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, 6, 4, 3, 2) for r in range(6, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 6): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim * interp, #bw "", #name 1) self.qtgui_freq_sink_x_0.set_update_time(0.010) self.qtgui_freq_sink_x_0.set_y_axis(-120, -10) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(1.0) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) labels = ['pre-d', 'processed', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in 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, 0, 4, 4, 4) for r in range(0, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.low_pass_filter_0_1 = filter.interp_fir_filter_fff( 1, firdes.low_pass(1, samp_rate / decim * interp / 3, 1.5e3, 100, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0 = filter.fir_filter_ccf( 3, firdes.low_pass(1, samp_rate / decim * interp, lpf_cutoff, 100, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.interp_fir_filter_fff( 1, firdes.low_pass(1, samp_rate / decim * interp / 3, 1.5e3, 100, firdes.WIN_HAMMING, 6.76)) self._freq_label_tool_bar = Qt.QToolBar(self) if None: self._freq_label_formatter = None else: self._freq_label_formatter = lambda x: eng_notation.num_to_str(x) self._freq_label_tool_bar.addWidget(Qt.QLabel('Tuned Freq' + ": ")) self._freq_label_label = Qt.QLabel( str(self._freq_label_formatter(self.freq_label))) self._freq_label_tool_bar.addWidget(self._freq_label_label) self.top_grid_layout.addWidget(self._freq_label_tool_bar, 5, 4, 1, 1) for r in range(5, 6): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 5): self.top_grid_layout.setColumnStretch(c, 1) self.fosphor_qt_sink_c_0 = fosphor.qt_sink_c() self.fosphor_qt_sink_c_0.set_fft_window(window.WIN_BLACKMAN_hARRIS) self.fosphor_qt_sink_c_0.set_frequency_range( rx_freq, samp_rate / int(samp_rate / 1e3) * 200) self._fosphor_qt_sink_c_0_win = sip.wrapinstance( self.fosphor_qt_sink_c_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._fosphor_qt_sink_c_0_win, 0, 0, 4, 4) for r in range(0, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) self.blocks_multiply_xx_1_0 = blocks.multiply_vff(1) self.blocks_multiply_xx_1 = blocks.multiply_vff(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_matrix_xx_0_0_0 = blocks.multiply_matrix_cc( (selection[ssb_am], ), gr.TPP_ALL_TO_ALL) self.blocks_multiply_matrix_xx_0 = blocks.multiply_matrix_ff( (selection[ssb_am], ), gr.TPP_ALL_TO_ALL) self.blocks_multiply_const_vxx_1_0 = blocks.multiply_const_ff(100000) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_ff(usb_lsb) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(volume) self.blocks_moving_average_xx_0 = blocks.moving_average_ff( 1000, 1 / 1000.0, 4000, 1) self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.blocks_add_xx_0 = blocks.add_vff(1) self.audio_sink_0 = audio.sink(16000, '', True) self.analog_sig_source_x_0_0_0 = analog.sig_source_f( samp_rate / decim * interp / 3, analog.GR_SIN_WAVE, 1.5e3, 1, 0, 0) self.analog_sig_source_x_0_0 = analog.sig_source_f( samp_rate / decim * interp / 3, analog.GR_COS_WAVE, 1.5e3, 1, 0, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -1 * (fine_freq + coarse_freq), 1, 0, 0) self.analog_pll_carriertracking_cc_0 = analog.pll_carriertracking_cc( math.pi / pll_lbw, math.pi / pll_freq, -math.pi / pll_freq) self.analog_agc2_xx_0_0 = analog.agc2_ff(audio_attack, audio_decay, audio_ref, audio_gain) self.analog_agc2_xx_0_0.set_max_gain(audio_max_gain) self.analog_agc2_xx_0 = analog.agc2_cc(0.1, decay_rate, .3, 1000) self.analog_agc2_xx_0.set_max_gain(65000) ################################################## # Connections ################################################## self.connect((self.analog_agc2_xx_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.analog_agc2_xx_0_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.analog_pll_carriertracking_cc_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.analog_pll_carriertracking_cc_0, 0), (self.blocks_multiply_matrix_xx_0_0_0, 2)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.analog_sig_source_x_0_0_0, 0), (self.blocks_multiply_xx_1_0, 1)) self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_matrix_xx_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.low_pass_filter_0_1, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_matrix_xx_0, 2)) self.connect((self.blocks_complex_to_real_0_0, 0), (self.blocks_multiply_matrix_xx_0, 1)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_multiply_const_vxx_1_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_const_vxx_1_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.blocks_multiply_matrix_xx_0, 0), (self.analog_agc2_xx_0_0, 0)) self.connect((self.blocks_multiply_matrix_xx_0_0_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.blocks_multiply_matrix_xx_0_0_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_xx_1_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.analog_pll_carriertracking_cc_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_complex_to_real_0_0, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_multiply_matrix_xx_0_0_0, 1)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_multiply_matrix_xx_0_0_0, 0)) self.connect((self.low_pass_filter_0_1, 0), (self.blocks_multiply_xx_1_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.fosphor_qt_sink_c_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.analog_agc2_xx_0, 0))
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.gui_samp_rate = gui_samp_rate = 20 self.samp_rate = samp_rate = gui_samp_rate*1e6 self.gui_freq_min = gui_freq_min = 0 self.gui_freq_max = gui_freq_max = gui_freq_min+samp_rate/1e6 self.freq_min = freq_min = gui_freq_min*1e6 self.variable_qtgui_chooser_0 = variable_qtgui_chooser_0 = 0 self.jammer_amp = jammer_amp = 50 self.gui_time_switch = gui_time_switch = 50 self.gui_rf_gain = gui_rf_gain = 14 self.gui_jam_mode = gui_jam_mode = 1 self.gui_if_gain = gui_if_gain = 47 self.freq_max = freq_max = gui_freq_max*1e6 self.center_freq = center_freq = freq_min+samp_rate/2 ################################################## # Blocks ################################################## self._jammer_amp_range = Range(1, 100, 1, 50, 200) self._jammer_amp_win = RangeWidget(self._jammer_amp_range, self.set_jammer_amp, "jammer_amp", "counter_slider", float) self.top_layout.addWidget(self._jammer_amp_win) self._gui_rf_gain_options = (0, 14, ) self._gui_rf_gain_labels = ('0 db', '14 db', ) self._gui_rf_gain_group_box = Qt.QGroupBox('RF Gain (db)') self._gui_rf_gain_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._gui_rf_gain_button_group = variable_chooser_button_group() self._gui_rf_gain_group_box.setLayout(self._gui_rf_gain_box) for i, label in enumerate(self._gui_rf_gain_labels): radio_button = Qt.QRadioButton(label) self._gui_rf_gain_box.addWidget(radio_button) self._gui_rf_gain_button_group.addButton(radio_button, i) self._gui_rf_gain_callback = lambda i: Qt.QMetaObject.invokeMethod(self._gui_rf_gain_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._gui_rf_gain_options.index(i))) self._gui_rf_gain_callback(self.gui_rf_gain) self._gui_rf_gain_button_group.buttonClicked[int].connect( lambda i: self.set_gui_rf_gain(self._gui_rf_gain_options[i])) self.top_layout.addWidget(self._gui_rf_gain_group_box) self._gui_if_gain_range = Range(0, 47, 1, 47, 47) self._gui_if_gain_win = RangeWidget(self._gui_if_gain_range, self.set_gui_if_gain, 'IF Gain (db)', "counter_slider", float) self.top_layout.addWidget(self._gui_if_gain_win) self._gui_freq_min_range = Range(0, 6000-samp_rate/1e6, samp_rate/1e6, 0, 200) self._gui_freq_min_win = RangeWidget(self._gui_freq_min_range, self.set_gui_freq_min, 'Lower Frequency (MHz)', "counter_slider", float) self.top_layout.addWidget(self._gui_freq_min_win) self._variable_qtgui_chooser_0_options = (0, 1, 2, 3, 4, ) self._variable_qtgui_chooser_0_labels = ('433 MHz', '868 MHz', 'Wifi 2.4GHz', 'Wifi 5.8 GHz', 'GPS', ) self._variable_qtgui_chooser_0_tool_bar = Qt.QToolBar(self) self._variable_qtgui_chooser_0_tool_bar.addWidget(Qt.QLabel('Preset Bands'+": ")) self._variable_qtgui_chooser_0_combo_box = Qt.QComboBox() self._variable_qtgui_chooser_0_tool_bar.addWidget(self._variable_qtgui_chooser_0_combo_box) for label in self._variable_qtgui_chooser_0_labels: self._variable_qtgui_chooser_0_combo_box.addItem(label) self._variable_qtgui_chooser_0_callback = lambda i: Qt.QMetaObject.invokeMethod(self._variable_qtgui_chooser_0_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._variable_qtgui_chooser_0_options.index(i))) self._variable_qtgui_chooser_0_callback(self.variable_qtgui_chooser_0) self._variable_qtgui_chooser_0_combo_box.currentIndexChanged.connect( lambda i: self.set_variable_qtgui_chooser_0(self._variable_qtgui_chooser_0_options[i])) self.top_layout.addWidget(self._variable_qtgui_chooser_0_tool_bar) self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype center_freq, #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.top_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(False) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + '' ) self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(center_freq, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(gui_rf_gain, 0) self.osmosdr_sink_0.set_if_gain(gui_if_gain, 0) self.osmosdr_sink_0.set_bb_gain(0, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(samp_rate, 0) self._gui_time_switch_range = Range(50, 1500, 50, 50, 200) self._gui_time_switch_win = RangeWidget(self._gui_time_switch_range, self.set_gui_time_switch, 'Frequency Switch Time (ms)', "counter_slider", float) self.top_layout.addWidget(self._gui_time_switch_win) self._gui_samp_rate_options = (10, 20, ) self._gui_samp_rate_labels = ('10 Msps', '20 Msps', ) self._gui_samp_rate_tool_bar = Qt.QToolBar(self) self._gui_samp_rate_tool_bar.addWidget(Qt.QLabel('Sample Rate'+": ")) self._gui_samp_rate_combo_box = Qt.QComboBox() self._gui_samp_rate_tool_bar.addWidget(self._gui_samp_rate_combo_box) for label in self._gui_samp_rate_labels: self._gui_samp_rate_combo_box.addItem(label) self._gui_samp_rate_callback = lambda i: Qt.QMetaObject.invokeMethod(self._gui_samp_rate_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._gui_samp_rate_options.index(i))) self._gui_samp_rate_callback(self.gui_samp_rate) self._gui_samp_rate_combo_box.currentIndexChanged.connect( lambda i: self.set_gui_samp_rate(self._gui_samp_rate_options[i])) self.top_layout.addWidget(self._gui_samp_rate_tool_bar) self._gui_jam_mode_options = (1, 2, ) self._gui_jam_mode_labels = ('Fixed Band (20 MHz)', 'Continuous ', ) self._gui_jam_mode_tool_bar = Qt.QToolBar(self) self._gui_jam_mode_tool_bar.addWidget(Qt.QLabel('Jammer Mode'+": ")) self._gui_jam_mode_combo_box = Qt.QComboBox() self._gui_jam_mode_tool_bar.addWidget(self._gui_jam_mode_combo_box) for label in self._gui_jam_mode_labels: self._gui_jam_mode_combo_box.addItem(label) self._gui_jam_mode_callback = lambda i: Qt.QMetaObject.invokeMethod(self._gui_jam_mode_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._gui_jam_mode_options.index(i))) self._gui_jam_mode_callback(self.gui_jam_mode) self._gui_jam_mode_combo_box.currentIndexChanged.connect( lambda i: self.set_gui_jam_mode(self._gui_jam_mode_options[i])) self.top_layout.addWidget(self._gui_jam_mode_tool_bar) self._gui_freq_max_range = Range(gui_freq_min+samp_rate/1e6, 6000, samp_rate/1e6, gui_freq_min+samp_rate/1e6, 200) self._gui_freq_max_win = RangeWidget(self._gui_freq_max_range, self.set_gui_freq_max, 'Higher Frequency (MHz)', "counter_slider", float) self.top_layout.addWidget(self._gui_freq_max_win) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((20, )) self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, jammer_amp, 0) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.osmosdr_sink_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_sink_x_0, 0))
def initUI(self): # Put everything in a groupbox so we can change the border of the window without it looking too obnoxious: self.qgroupbox_freq = Qt.QGroupBox('') self.qgroupbox_freq.setAutoFillBackground(True) # Add a QwtPlot to the UI: #self.qplt_freq = Qwt.QwtPlot() self.qplt_freq = pg.PlotWidget() self.qplt_freq.setTitle('Lock #%d Frequency error' % (self.output_number)) #self.qplt_freq.setCanvasBackground(Qt.Qt.white) # plotgrid = Qwt.QwtPlotGrid() # plotgrid.setMajPen(Qt.QPen(Qt.Qt.black, 0, Qt.Qt.DotLine)); # plotgrid.setMinPen(Qt.QPen(Qt.Qt.black, 0, Qt.Qt.DotLine)); # plotgrid.attach(self.qplt_freq); self.qplt_freq.showGrid(x=True, y=True) # Add another QwtPlot to the UI: self.qplt_dac = pg.PlotWidget() self.qplt_dac.setTitle('Lock #%d DAC outputs' % (self.output_number)) #self.qplt_dac.setCanvasBackground(Qt.Qt.white) self.qplt_dac.setYRange(0, 1) # plotgrid = Qwt.QwtPlotGrid() # plotgrid.setMajPen(Qt.QPen(Qt.Qt.black, 0, Qt.Qt.DotLine)); # plotgrid.setMinPen(Qt.QPen(Qt.Qt.black, 0, Qt.Qt.DotLine)); # plotgrid.attach(self.qplt_dac); self.qplt_dac.showGrid(x=True, y=True) # Create the curve in the plot self.curve_freq_error = self.qplt_freq.getPlotItem().plot(pen='b') #self.curve_freq_error.attach(self.qplt_freq) #self.curve_freq_error.setPen(Qt.QPen(Qt.Qt.blue)) # Create the curve in the plot self.curve_dac = self.qplt_dac.getPlotItem().plot(pen='b') self.curve_dac_uthrsh = self.qplt_dac.getPlotItem().plot( connect='finite', pen=pg.mkPen(0.5, style=QtCore.Qt.DashLine)) self.curve_dac_lthrsh = self.qplt_dac.getPlotItem().plot( connect='finite', pen=pg.mkPen(0.5, style=QtCore.Qt.DashLine)) # Create widgets to specify buffer length and clear buffer: self.qbtn_reset = Qt.QPushButton('Clear display') self.qbtn_reset.clicked.connect(self.initBuffer) self.qlabel_history = Qt.QLabel('Display [s]') self.qedit_history = Qt.QLineEdit('600') self.qedit_history.setMaximumWidth(40) self.qedit_history.textChanged.connect(self.initBuffer) self.qchk_fullscale_freq = Qt.QCheckBox('Fullscale Freq Graph') self.qchk_fullscale_freq.setChecked(True) self.qchk_fullscale_dac = Qt.QCheckBox('Fullscale DAC Graph') self.qchk_fullscale_dac.setChecked(True) self.qchk_triangular = Qt.QCheckBox('Triangular averaging') self.qchk_triangular.setChecked(True) self.qchk_triangular.clicked.connect(self.chkTriangular_checked) # Controls for the vertical scale of the frequency graph: print(type(self.sl.dev.ADC_CLK_Hz)) print(self.sl.dev.ADC_CLK_Hz) self.qedit_ymin = Qt.QLineEdit('%f' % (-self.sl.dev.ADC_CLK_Hz / 4.)) self.qedit_ymax = Qt.QLineEdit('%f' % (self.sl.dev.ADC_CLK_Hz / 4.)) # Controls for Auto Recovery self.qchk_autorecover = Qt.QCheckBox('Auto Recover') self.qchk_autorecover.setChecked(False) self.qlabel_rec_thresh = Qt.QLabel('Recovery Threshold') self.qedit_rec_thresh = Qt.QLineEdit('5') self.qedit_rec_thresh.setMaximumWidth(40) # Put the two graphs into a vertical box layout, so that they share all the vertical space equally: vbox = QtGui.QVBoxLayout() vbox.addWidget(self.qplt_freq) vbox.addWidget(self.qplt_dac) # Put all the widgets into a grid layout grid = QtGui.QGridLayout() grid.addLayout(vbox, 0, 2, 16, 1) grid.addWidget(self.qbtn_reset, 0, 0, 1, 2) grid.addWidget(self.qlabel_history, 1, 0) grid.addWidget(self.qedit_history, 1, 1) grid.addWidget(self.qchk_fullscale_freq, 2, 0, 1, 2) grid.addWidget(self.qchk_fullscale_dac, 3, 0, 1, 2) grid.addWidget(self.qchk_triangular, 4, 0, 1, 2) grid.addWidget(self.qedit_ymin, 5, 0, 1, 2) grid.addWidget(self.qedit_ymax, 6, 0, 1, 2) #FEATURE grid.addWidget(self.qchk_autorecover, 7, 0, 1, 2) grid.addWidget(self.qlabel_rec_thresh, 8, 0) grid.addWidget(self.qedit_rec_thresh, 8, 1) if self.client or True: # we need to add the controls which implement the temperature control loop: self.qlabel_threshold_step = Qt.QLabel('Threshold for step:') self.qedit_threshold_step = Qt.QLineEdit('0.2') self.qedit_threshold_step.setMaximumWidth(40) self.qlabel_threshold_disable = Qt.QLabel('Threshold for disable:') self.qedit_threshold_disable = Qt.QLineEdit('0.05') self.qedit_threshold_disable.setMaximumWidth(40) self.qlabel_step_size = Qt.QLabel('Step size [deg C]:') self.qedit_step_size = Qt.QLineEdit('0.05') self.qedit_step_size.setMaximumWidth(40) self.qlabel_step_delay = Qt.QLabel('Step delay [s]:') self.qedit_step_delay = Qt.QLineEdit('120') self.qedit_step_delay.setMaximumWidth(40) self.qchk_temp_control = Qt.QCheckBox('Temperature control') self.qchk_temp_control.setChecked(False) self.qchk_clear_temp_control = Qt.QCheckBox( 'Clear Temperature control') self.qchk_clear_temp_control.setChecked(False) #FEATURE #grid.addWidget(self.qlabel_threshold_step, 8, 0) #grid.addWidget(self.qedit_threshold_step, 8, 1) #grid.addWidget(self.qlabel_threshold_disable, 9, 0) #grid.addWidget(self.qedit_threshold_disable, 9, 1) #grid.addWidget(self.qlabel_step_size, 10, 0) #grid.addWidget(self.qedit_step_size, 11, 1) # #grid.addWidget(self.qlabel_step_delay, 12, 0) #grid.addWidget(self.qedit_step_delay, 13, 1) # #grid.addWidget(self.qchk_temp_control, 14, 0, 1, 2) #grid.addWidget(self.qchk_clear_temp_control, 15, 0, 1, 2) grid.addWidget(Qt.QLabel(''), 16, 0, 1, 2) grid.setRowStretch(15, 1) grid.setColumnStretch(2, 1) else: # no controls for the temp control loop grid.addWidget(Qt.QLabel(''), 8, 0, 1, 2) grid.setRowStretch(8, 1) grid.setColumnStretch(2, 1) self.qgroupbox_freq.setLayout(grid) vbox2 = Qt.QVBoxLayout() vbox2.addWidget(self.qgroupbox_freq) self.setLayout(vbox2) # self.setLayout(vbox) # Adjust the size and position of the window # self.resize(800, 480) self.center() self.setWindowTitle(self.strTitle)
def __init__(self): gr.top_block.__init__(self, "Lab8") Qt.QWidget.__init__(self) self.setWindowTitle("Lab8") 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", "lab8") 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.std_dev = std_dev = 0.05 self.samp_rate = samp_rate = 32000 self.p_xy = p_xy = 0 self.npts = npts = 8192 self.mimo_option = mimo_option = 0 self.lw = lw = 0.5 self.const_qam = const_qam = digital.constellation_calcdist( digital.qam_16()[0], digital.qam_16()[1], 2, 1).base() self.const_psk = const_psk = digital.constellation_calcdist( digital.psk_4()[0], digital.psk_4()[1], 2, 1).base() ################################################## # Blocks ################################################## self.tab = Qt.QTabWidget() self.tab_widget_0 = Qt.QWidget() self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_0) self.tab_grid_layout_0 = Qt.QGridLayout() self.tab_layout_0.addLayout(self.tab_grid_layout_0) self.tab.addTab(self.tab_widget_0, 'Transmitted') self.tab_widget_1 = Qt.QWidget() self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_1) self.tab_grid_layout_1 = Qt.QGridLayout() self.tab_layout_1.addLayout(self.tab_grid_layout_1) self.tab.addTab(self.tab_widget_1, 'Received') self.tab_widget_2 = Qt.QWidget() self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_2) self.tab_grid_layout_2 = Qt.QGridLayout() self.tab_layout_2.addLayout(self.tab_grid_layout_2) self.tab.addTab(self.tab_widget_2, 'Histogram') self.top_grid_layout.addWidget(self.tab, 1, 0, 8, 7) for r in range(1, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 7): self.top_grid_layout.setColumnStretch(c, 1) self._std_dev_range = Range(0, 1, 0.001, 0.05, 200) self._std_dev_win = RangeWidget(self._std_dev_range, self.set_std_dev, 'Noise Std. Dev', "counter_slider", float) self.top_grid_layout.addWidget(self._std_dev_win, 0, 0, 1, 3) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 3): self.top_grid_layout.setColumnStretch(c, 1) self._p_xy_range = Range(0, 0.99, 0.001, 0, 200) self._p_xy_win = RangeWidget(self._p_xy_range, self.set_p_xy, 'Correlation Pxy', "counter_slider", float) self.top_grid_layout.addWidget(self._p_xy_win, 0, 3, 1, 3) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 6): self.top_grid_layout.setColumnStretch(c, 1) # Create the options list self._mimo_option_options = ( 0, 1, ) # Create the labels list self._mimo_option_labels = ( 'Alamouti', 'MIMO', ) # Create the combo box # Create the radio buttons self._mimo_option_group_box = Qt.QGroupBox('MIMO Option' + ": ") self._mimo_option_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._mimo_option_button_group = variable_chooser_button_group() self._mimo_option_group_box.setLayout(self._mimo_option_box) for i, _label in enumerate(self._mimo_option_labels): radio_button = Qt.QRadioButton(_label) self._mimo_option_box.addWidget(radio_button) self._mimo_option_button_group.addButton(radio_button, i) self._mimo_option_callback = lambda i: Qt.QMetaObject.invokeMethod( self._mimo_option_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._mimo_option_options.index(i))) self._mimo_option_callback(self.mimo_option) self._mimo_option_button_group.buttonClicked[int].connect( lambda i: self.set_mimo_option(self._mimo_option_options[i])) self.top_grid_layout.addWidget(self._mimo_option_group_box, 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.qtgui_time_sink_x_0 = qtgui.time_sink_f( 4096, #size 1, #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(0, 20) self.qtgui_time_sink_x_0.set_y_label('Eigenvalue Ratio (dB)', "") 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(True) 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(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, 9, 0, 2, 8) for r in range(9, 11): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 8): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_histogram_sink_x_0 = qtgui.histogram_sink_f( npts, 200, -2, 2, "Histogram", 1) self.qtgui_histogram_sink_x_0.set_update_time(0.10) 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(True) self.qtgui_histogram_sink_x_0.enable_axis_labels(True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] 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 range(1): 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.tab_layout_2.addWidget(self._qtgui_histogram_sink_x_0_win) self.qtgui_const_sink_x_1 = qtgui.const_sink_c( 1024, #size "De-Correlated Constellation", #name 2 #number of inputs ) self.qtgui_const_sink_x_1.set_update_time(0.10) self.qtgui_const_sink_x_1.set_y_axis(-1.5, 1.5) self.qtgui_const_sink_x_1.set_x_axis(-1.5, 1.5) self.qtgui_const_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") self.qtgui_const_sink_x_1.enable_autoscale(False) self.qtgui_const_sink_x_1.enable_grid(True) self.qtgui_const_sink_x_1.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, 2, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, -1, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 0.2, 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_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_const_sink_x_1.set_line_label(i, labels[i]) self.qtgui_const_sink_x_1.set_line_width(i, widths[i]) self.qtgui_const_sink_x_1.set_line_color(i, colors[i]) self.qtgui_const_sink_x_1.set_line_style(i, styles[i]) self.qtgui_const_sink_x_1.set_line_marker(i, markers[i]) self.qtgui_const_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_const_sink_x_1_win = sip.wrapinstance( self.qtgui_const_sink_x_1.pyqwidget(), Qt.QWidget) self.tab_layout_1.addWidget(self._qtgui_const_sink_x_1_win) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "Correlated Constellation", #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(-4, 4) self.qtgui_const_sink_x_0.set_x_axis(-4, 4) 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 = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "red", "red", "red", "red", "red", "red", "red", "red" ] styles = [0, 2, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, -1, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 0.2, 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.tab_layout_0.addWidget(self._qtgui_const_sink_x_0_win) self.ofdm_alamouti_cc_0 = ofdm.alamouti_cc(p_xy, std_dev, mimo_option) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc( const_psk.points(), 1) self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0) self.blocks_moving_average_xx_0 = blocks.moving_average_ff( 4096, 1 / 4096, 4096, 1) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_deinterleave_0 = blocks.deinterleave( gr.sizeof_float * 1, 1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.analog_random_source_x_0 = blocks.vector_source_b( list(map(int, numpy.random.randint(0, 4, 1000))), True) ################################################## # Connections ################################################## self.connect((self.analog_random_source_x_0, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.qtgui_histogram_sink_x_0, 0)) self.connect((self.blocks_deinterleave_0, 1), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_deinterleave_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.blocks_divide_xx_0, 0), (self.blocks_moving_average_xx_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_nlog10_ff_0, 0)) self.connect((self.blocks_nlog10_ff_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.ofdm_alamouti_cc_0, 0)) self.connect((self.ofdm_alamouti_cc_0, 1), (self.blocks_complex_to_real_0, 0)) self.connect((self.ofdm_alamouti_cc_0, 2), (self.blocks_deinterleave_0, 0)) self.connect((self.ofdm_alamouti_cc_0, 0), (self.qtgui_const_sink_x_0, 1)) self.connect((self.ofdm_alamouti_cc_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.ofdm_alamouti_cc_0, 1), (self.qtgui_const_sink_x_1, 0)) self.connect((self.ofdm_alamouti_cc_0, 1), (self.qtgui_const_sink_x_1, 1))
def initUI(self): # Create the widgets which control the system identification module: # Input select transfer_input_label = Qt.QLabel('Input:') self.qcombo_transfer_input = Qt.QComboBox() self.qcombo_transfer_input.addItems( ['ADC 0', 'ADC 1', 'DDC 0', 'DDC 1']) self.qcombo_transfer_input.setCurrentIndex(2) # transfer_input_label.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) # self.qcombo_transfer_input.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed) # Output select transfer_output_label = Qt.QLabel('Output:') self.qcombo_transfer_output = Qt.QComboBox() self.qcombo_transfer_output.addItems(['DAC 0', 'DAC 1', 'DAC 2']) self.qcombo_transfer_output.setCurrentIndex(0) # transfer_output_label.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) # self.qcombo_transfer_output.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed) # settling_time_label = Qt.QLabel('System settling time [s]:') self.qedit_settling_time = Qt.QLineEdit('1e-3') self.qedit_settling_time.setMaximumWidth(60) self.qedit_settling_time.editingFinished.connect( self.updateIntegrationTime) # settling_time_label.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) # self.qedit_settling_time.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed) freq_start_label = Qt.QLabel('Freq start [Hz]:') self.qedit_freq_start = Qt.QLineEdit('10e3') self.qedit_freq_start.setMaximumWidth(60) self.qedit_freq_start.editingFinished.connect( self.updateIntegrationTime) # freq_start_label.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) # self.qedit_freq_start.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed) freq_end_label = Qt.QLabel('Freq end [Hz]:') self.qedit_freq_end = Qt.QLineEdit('2e6') self.qedit_freq_end.setMaximumWidth(60) # self.qedit_freq_end.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed) freq_number_label = Qt.QLabel('Number of freq [max 3276]:') self.qedit_freq_number = Qt.QLineEdit('160') self.qedit_freq_number.setMaximumWidth(60) # self.qedit_freq_number.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed) amplitude_label = Qt.QLabel('Modulation amplitude [0-1]:') self.qedit_output_amplitude = Qt.QLineEdit('0.01') self.qedit_output_amplitude.setMaximumWidth(60) # self.qedit_output_amplitude.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed) self.qlbl_integration_time = Qt.QLabel( 'Integration time per freq [s]: ') self.updateIntegrationTime() # Button which triggers the system identification self.qbtn_ident = QtGui.QPushButton('Run identification') self.qbtn_ident.clicked.connect(self.runSytemIdentification) # self.qbtn_ident.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed) self.qbtn_stop_ident = QtGui.QPushButton('Stop identification') self.qbtn_stop_ident.clicked.connect(self.stopClicked) # Progress bar which indicates the progression of the identification self.qprogress_ident = Qt.QProgressBar() self.qprogress_ident.setTextVisible(False) self.qprogress_ident.setValue(0) # self.qprogress_ident.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed) # Controls for the dither mode: # Needs: output select, frequency, amplitude, Square/Sine select, dither on/off ###################################################################### # Settings ###################################################################### self.qgroupbox_dither = Qt.QGroupBox('Continuous output', self) self.dither_output_label = Qt.QLabel('Output:') self.qcombo_dither_output = Qt.QComboBox() self.qcombo_dither_output.addItems(['DAC 0', 'DAC 1', 'DAC 2']) self.qcombo_dither_output.setCurrentIndex(0) self.qcombo_dither_output.currentIndexChanged.connect( self.ditherClicked) # Modulation frequency: self.qedit_freq_label = Qt.QLabel('Frequency [Hz]:') self.qedit_dither_freq = Qt.QLineEdit('1e6') self.qedit_dither_freq.textChanged.connect(self.ditherClicked) self.qedit_dither_freq.setMaximumWidth(60) # Amplitude: self.qlabel_dither_amplitude = Qt.QLabel('Amplitude [0-1]:') self.qedit_dither_amplitude = Qt.QLineEdit('0.01') self.qedit_dither_amplitude.textChanged.connect(self.ditherClicked) self.qedit_dither_amplitude.setMaximumWidth(60) # Sine/Square wave self.qradio_sinewave = Qt.QRadioButton('Sine wave') self.qradio_squarewave = Qt.QRadioButton('Square wave') self.qsign_group = Qt.QButtonGroup(self) self.qsign_group.addButton(self.qradio_sinewave) self.qsign_group.addButton(self.qradio_squarewave) self.qradio_sinewave.setChecked(True) self.qradio_squarewave.setChecked(False) self.qradio_sinewave.clicked.connect(self.ditherClicked) self.qradio_squarewave.clicked.connect(self.ditherClicked) # On/Off button self.qbtn_dither = QtGui.QPushButton('Activate dither') self.qbtn_dither.clicked.connect(self.ditherClicked) self.qbtn_dither.setCheckable(True) # Put all the widgets into a grid layout grid = QtGui.QGridLayout() grid.addWidget(self.dither_output_label, 0, 0) grid.addWidget(self.qcombo_dither_output, 0, 1) grid.addWidget(self.qedit_freq_label, 1, 0) grid.addWidget(self.qedit_dither_freq, 1, 1) grid.addWidget(self.qlabel_dither_amplitude, 2, 0) grid.addWidget(self.qedit_dither_amplitude, 2, 1) grid.addWidget(self.qradio_sinewave, 3, 0) grid.addWidget(self.qradio_squarewave, 3, 1) grid.addWidget(self.qbtn_dither, 4, 0, 1, 2) self.qgroupbox_dither.setLayout(grid) ###################################################################### # Settings ###################################################################### self.qgroupbox_test_osc = Qt.QGroupBox( 'Variable duty-cycle oscillator') self.qlbl_osc_freq = Qt.QLabel('Frequency [Hz]:') self.qedit_osc_freq = Qt.QLineEdit('200e3') self.qedit_osc_freq.textChanged.connect(self.oscClicked) # On/Off button self.qbtn_osc = QtGui.QPushButton('Activate output') self.qbtn_osc.setCheckable(True) self.qbtn_osc.setChecked(True) self.qbtn_osc.clicked.connect(self.oscClicked) # Polarity setting self.qchk_osc_polarity = Qt.QCheckBox('Invert polarity') self.qchk_osc_polarity.clicked.connect(self.oscClicked) # Duty cycle slider self.q_osc_duty_cyle = Qt.QSlider() self.q_osc_duty_cyle.valueChanged.connect(self.oscClicked) self.q_osc_duty_cyle.setSliderPosition(0) self.q_osc_duty_cyle.setOrientation(Qt.Qt.Horizontal) # Units are millionth of the full range available self.q_osc_duty_cyle.setMinimum(0) self.q_osc_duty_cyle.setMaximum(1e6) self.q_osc_duty_cyle.setSingleStep(1e6 / 100. / 3.) self.q_osc_duty_cyle.setPageStep(1e6 / 10.) # Put all the widgets into a grid layout grid = QtGui.QGridLayout() grid.addWidget(self.qlbl_osc_freq, 0, 0) grid.addWidget(self.qedit_osc_freq, 0, 1) grid.addWidget(self.qbtn_osc, 1, 0, 1, 2) grid.addWidget(self.qchk_osc_polarity, 2, 0, 1, 2) grid.addWidget(self.q_osc_duty_cyle, 3, 0, 1, 2) self.qgroupbox_test_osc.setLayout(grid) # Put all the widgets into a grid layout grid = QtGui.QGridLayout() grid.addWidget(transfer_input_label, 0, 0) grid.addWidget(self.qcombo_transfer_input, 0, 1) grid.addWidget(transfer_output_label, 1, 0) grid.addWidget(self.qcombo_transfer_output, 1, 1) grid.addWidget(settling_time_label, 2, 0) grid.addWidget(self.qedit_settling_time, 2, 1) grid.addWidget(freq_start_label, 3, 0) grid.addWidget(self.qedit_freq_start, 3, 1) grid.addWidget(freq_end_label, 4, 0) grid.addWidget(self.qedit_freq_end, 4, 1) grid.addWidget(freq_number_label, 5, 0) grid.addWidget(self.qedit_freq_number, 5, 1) grid.addWidget(amplitude_label, 6, 0) grid.addWidget(self.qedit_output_amplitude, 6, 1) grid.addWidget(self.qlbl_integration_time, 7, 0, 1, 2) grid.addWidget(self.qbtn_ident, 8, 0, 1, 2) grid.addWidget(self.qbtn_stop_ident, 9, 0, 1, 2) grid.addWidget(self.qprogress_ident, 10, 0, 1, 2) self.qgroupbox_vna = Qt.QGroupBox('Swept sine', self) self.qgroupbox_vna.setLayout(grid) vbox = Qt.QVBoxLayout() vbox.addWidget(self.qgroupbox_vna) vbox.addWidget(self.qgroupbox_dither) # vbox.addWidget(self.qgroupbox_test_osc) # Spacer which takes up the rest of the space: spacerItem = QtGui.QSpacerItem(1, 1, QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Expanding) vbox.addItem(spacerItem) self.setLayout(vbox) # Adjust the size and position of the window # self.resize(800, 600) self.center() self.setWindowTitle('VNA control') self.show()
def initUI(self): ################################################################################### self.qgroupbox_clkselect = Qt.QGroupBox('Clock source') self.qgroupbox_clkselect.setAutoFillBackground(True) grid = Qt.QGridLayout() self.qradio_internal_clk = Qt.QRadioButton('Internal clock') self.qradio_external_clk = Qt.QRadioButton('External clock') self.qradio_internal_clk.setChecked(True) self.qradio_internal_clk.clicked.connect(self.setClkSelect) self.qradio_external_clk.clicked.connect(self.setClkSelect) self.lblExtClkFreq = Qt.QLabel('Ext clk freq = %.6f MHz' % 0.0) grid.addWidget(self.qradio_internal_clk, 0, 0) grid.addWidget(self.qradio_external_clk, 1, 0) grid.addWidget(self.lblExtClkFreq, 2, 0) #grid.setRowStretch(2, 2) self.qgroupbox_clkselect.setLayout(grid) ################################################################################### self.qgroupbox_xadc = Qt.QGroupBox('XADC inputs') self.qgroupbox_xadc.setAutoFillBackground(True) grid = Qt.QGridLayout() self.time_start = time.perf_counter() self.qplots = DataLoggingDisplayWidget.DataLoggingDisplayWidget( numPlots=1, numCurvesPerPlot=1) self.qplots.pltItemsList[0].setLabel('left', 'Temp [degC]') # self.qplots.show() self.qlbl_Temp = Qt.QLabel('Zynq temperature: %.2f degC' % 0.) self.qlbl_vccint = Qt.QLabel('Vccint = %.2f V' % 0.) self.qlbl_vccaux = Qt.QLabel('Vccaux = %.2f V' % 0.) self.qbtn_OpenTempGraph = Qt.QPushButton( 'Open temperature display window') self.qbtn_OpenTempGraph.clicked.connect(self.qplots.show) grid.addWidget(self.qlbl_Temp, 0, 0, 1, 2) grid.addWidget(self.qlbl_vccint, 1, 0) grid.addWidget(self.qlbl_vccaux, 2, 0) grid.addWidget(self.qbtn_OpenTempGraph, 2, 1) #grid.setRowStretch(2, 2) self.qgroupbox_xadc.setLayout(grid) # polling timer for the xadc values: self.timerXADC = Qt.QTimer(self) self.timerXADC.timeout.connect(self.timerXADCEvent) ################################################################################### self.qgroupbox_MUX_vco = Qt.QGroupBox('Select VCO connection') 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('VCO not 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(100) 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( 'DAC_a output to PLL_b input (cascade lock)') 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 fan on/off') 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) ################################################################################### SATA = Qt.QGridLayout() self.qgroupbox_SATA = Qt.QGroupBox('Configure serial receiver (SATA)') self.qgroupbox_SATA.setAutoFillBackground(True) self.qlabel_SATA = Qt.QLabel('SATA mode:') self.qcombo_SATA = Qt.QComboBox() self.qcombo_SATA.addItems(['Off', 'Fast+Slow control', 'Training']) self.qcombo_SATA.setCurrentIndex(0) self.qcombo_SATA.currentIndexChanged.connect(self.setSATA) SATA.addWidget(self.qlabel_SATA, 2, 1) SATA.addWidget(self.qcombo_SATA, 2, 2) #SATA.addItem(Qt.QSpacerItem(0, 0, Qt.QSizePolicy.MinimumExpanding, Qt.QSizePolicy.Minimum), 3, 0) #SATA.setRowStretch(3, 2) self.qgroupbox_SATA.setLayout(SATA) ################################################################################### self.group = Qt.QGroupBox('RP configuration') self.group.setAutoFillBackground(True) group = Qt.QGridLayout() group.addWidget(self.qgroupbox_clkselect, 0, 0, 1, 1) group.addWidget(self.qgroupbox_xadc, 0, 1, 1, 2) group.addWidget(self.qgroupbox_MUX_vco, 1, 0, 1, 3) group.addWidget(self.qgroupbox_MUX_pll2, 2, 0, 1, 3) group.addWidget(self.qgroupbox_read_data, 3, 0, 1, 3) group.addWidget(self.qgroupbox_fanUI, 4, 0, 1, 1) group.addWidget(self.qbtn_reconnect, 4, 1, 1, 1) group.addWidget(self.qgroupbox_SATA, 4, 2, 1, 1) #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, "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") 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.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 = int(sys.argv[1]) * 10e5 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_layout.addWidget(self._samp_rate_tool_bar) 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_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_layout.addWidget(self._chan_est_group_box) self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' ) self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(freq, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(10, 0) self.rtlsdr_source_0.set_if_gain(20, 0) self.rtlsdr_source_0.set_bb_gain(20, 0) self.rtlsdr_source_0.set_antenna('', 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.qtgui_const_sink_x_0 = 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_layout.addWidget(self._qtgui_const_sink_x_0_win) 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_layout.addWidget(self._lo_offset_tool_bar) 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._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_layout.addWidget(self._gain_win) 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.rtlsdr_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_delay_0_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_multiply_xx_0, 0))
def __init__(self): gr.top_block.__init__(self, "multitone_gen") Qt.QWidget.__init__(self) self.setWindowTitle("multitone_gen") 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", "mutlitone_gen") 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.waveform = waveform = 0 self.tone_freq = tone_freq = 100 self.sdr_freq = sdr_freq = 136050000 self.samp_rate = samp_rate = 30000000 self.num_tones = num_tones = 3 self.jam_button = jam_button = 0 self.freq_spacing = freq_spacing = 1000000 ################################################## # Blocks ################################################## # Create the options list self._waveform_options = ( 0, 1, 2, ) # Create the labels list self._waveform_labels = ( 'Square', 'Sawtooth', 'Sine', ) # Create the combo box # Create the radio buttons self._waveform_group_box = Qt.QGroupBox('Select Waveform ' + ": ") self._waveform_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._waveform_button_group = variable_chooser_button_group() self._waveform_group_box.setLayout(self._waveform_box) for i, _label in enumerate(self._waveform_labels): radio_button = Qt.QRadioButton(_label) self._waveform_box.addWidget(radio_button) self._waveform_button_group.addButton(radio_button, i) self._waveform_callback = lambda i: Qt.QMetaObject.invokeMethod( self._waveform_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._waveform_options.index(i))) self._waveform_callback(self.waveform) self._waveform_button_group.buttonClicked[int].connect( lambda i: self.set_waveform(self._waveform_options[i])) self.top_grid_layout.addWidget(self._waveform_group_box, 0, 0, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._tone_freq_range = Range(100, 10000000, 100, 100, 200) self._tone_freq_win = RangeWidget(self._tone_freq_range, self.set_tone_freq, 'Tone Frequency', "counter_slider", int) self.top_grid_layout.addWidget(self._tone_freq_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._sdr_freq_range = Range(60000000, 6000000000, 10000, 136050000, 200) self._sdr_freq_win = RangeWidget(self._sdr_freq_range, self.set_sdr_freq, 'SDR frequency', "counter_slider", int) self.top_grid_layout.addWidget(self._sdr_freq_win, 1, 2, 1, 1) for r in range(1, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) self._num_tones_range = Range(1, 100, 1, 3, 200) self._num_tones_win = RangeWidget(self._num_tones_range, self.set_num_tones, 'Number of Tones', "counter_slider", int) self.top_grid_layout.addWidget(self._num_tones_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) _jam_button_push_button = Qt.QPushButton('JAM') _jam_button_push_button = Qt.QPushButton('JAM') self._jam_button_choices = {'Pressed': 1, 'Released': 0} _jam_button_push_button.pressed.connect( lambda: self.set_jam_button(self._jam_button_choices['Pressed'])) _jam_button_push_button.released.connect( lambda: self.set_jam_button(self._jam_button_choices['Released'])) self.top_grid_layout.addWidget(_jam_button_push_button, 0, 2, 1, 1) for r in range(0, 1): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) self._freq_spacing_range = Range(25000, 10000000, 25000, 1000000, 200) self._freq_spacing_win = RangeWidget(self._freq_spacing_range, self.set_freq_spacing, 'Spacing of Tones', "counter_slider", int) self.top_grid_layout.addWidget(self._freq_spacing_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.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype tone_freq, #fc (num_tones * freq_spacing), #bw "", #name 2) 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) labels = ['rx_data', 'tx_data', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "yellow", "magenta", "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(2): 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, 2, 0, 2, 3) for r in range(2, 4): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 3): self.top_grid_layout.setColumnStretch(c, 1) self.iio_pluto_source_0 = iio.pluto_source('', int(sdr_freq), int(samp_rate), int(20000000), 32768, True, True, True, 'manual', 60, '', True) self.iio_pluto_sink_0 = iio.pluto_sink('', int(sdr_freq), int(samp_rate), int(20000000), 32768, False, 10.0, '', True) self.epy_block_0 = epy_block_0.blk(waveform=waveform, samp_rate=samp_rate, ctr_freq=10000000, num_tones=num_tones, freq_spacing=freq_spacing) self.blocks_mute_xx_0 = blocks.mute_cc(bool(not (jam_button))) self.analog_sig_source_x_0_0_0_0_0 = analog.sig_source_c( samp_rate, analog.GR_SIN_WAVE, tone_freq, 1, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0_0_0_0_0, 0), (self.epy_block_0, 0)) self.connect((self.blocks_mute_xx_0, 0), (self.iio_pluto_sink_0, 0)) self.connect((self.blocks_mute_xx_0, 0), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.epy_block_0, 0), (self.blocks_mute_xx_0, 0)) self.connect((self.iio_pluto_source_0, 0), (self.qtgui_freq_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "Nsf Airspy Mini 3 MHz Event detect") Qt.QWidget.__init__(self) self.setWindowTitle("Nsf Airspy Mini 3 MHz Event detect") 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", "NsfDetect30") self.restoreGeometry( self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.ObsName = ObsName = "Detect30" 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._nsigmas_config = ConfigParser.ConfigParser() self._nsigmas_config.read(ConfigFile) try: nsigmas = self._nsigmas_config.getfloat('main', 'nsimga') except: nsigmas = 5.5 self.nsigmas = nsigmas 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._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_group_box = Qt.QGroupBox('Data Mode') self._Mode_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._Mode_button_group = variable_chooser_button_group() self._Mode_group_box.setLayout(self._Mode_box) for i, label in enumerate(self._Mode_labels): radio_button = Qt.QRadioButton(label) self._Mode_box.addWidget(radio_button) self._Mode_button_group.addButton(radio_button, i) self._Mode_callback = lambda i: Qt.QMetaObject.invokeMethod( self._Mode_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._Mode_options.index(i))) self._Mode_callback(self.Mode) self._Mode_button_group.buttonClicked[int].connect( lambda i: self.set_Mode(self._Mode_options[i])) self.top_grid_layout.addWidget(self._Mode_group_box, 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_group_box = Qt.QGroupBox('Write Mode') self._EventMode_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._EventMode_button_group = variable_chooser_button_group() self._EventMode_group_box.setLayout(self._EventMode_box) for i, label in enumerate(self._EventMode_labels): radio_button = Qt.QRadioButton(label) self._EventMode_box.addWidget(radio_button) self._EventMode_button_group.addButton(radio_button, i) self._EventMode_callback = lambda i: Qt.QMetaObject.invokeMethod( self._EventMode_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._EventMode_options.index(i))) self._EventMode_callback(self.EventMode) self._EventMode_button_group.buttonClicked[int].connect( lambda i: self.set_EventMode(self._EventMode_options[i])) self.top_grid_layout.addWidget(self._EventMode_group_box, 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.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.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + Device) self.osmosdr_source_0.set_sample_rate(Bandwidth) self.osmosdr_source_0.set_center_freq(Frequency, 0) self.osmosdr_source_0.set_freq_corr(0, 0) self.osmosdr_source_0.set_dc_offset_mode(0, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(float(Gain1), 0) self.osmosdr_source_0.set_if_gain(float(Gain2), 0) self.osmosdr_source_0.set_bb_gain(float(Gain3), 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(Bandwidth, 0) 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.osmosdr_source_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_stream_to_vector_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))
def initUI(self): # print('initUI()') self.qchk_lock = Qt.QCheckBox( 'Lock On' ) # Not displayed, for status reading only (to act like the other LoopFilter) self.qchk_lock.setChecked(False) # first column: contains the radio buttons to select the mode vbox = Qt.QVBoxLayout() self.qradio_mode_off = Qt.QRadioButton('Off') self.qradio_mode_off.setChecked(True) self.qradio_mode_slow = Qt.QRadioButton('Acquisition on slow PZT only') self.qradio_mode_fast = Qt.QRadioButton('Lock on fast PZT only') self.qradio_mode_both = Qt.QRadioButton('Lock on both PZTs') # self.qradio_mode_off.setEnabled(self.bDisplayLockChkBox) # self.qradio_mode_slow.setEnabled(self.bDisplayLockChkBox) # self.qradio_mode_fast.setEnabled(self.bDisplayLockChkBox) # self.qradio_mode_both.setEnabled(self.bDisplayLockChkBox) # Two checkboxes to flip the sign self.qchk_flip1 = Qt.QCheckBox('Flip sign on acquisition') self.qchk_flip1.clicked.connect(self.setIntegratorGainEvent) self.qchk_flip2 = Qt.QCheckBox('Flip sign on lock') self.qchk_flip2.clicked.connect(self.setIntegratorGainEvent) self.qradio_mode_off.clicked.connect(self.updateSettings) self.qradio_mode_slow.clicked.connect(self.updateSettings) self.qradio_mode_fast.clicked.connect(self.updateSettings) self.qradio_mode_both.clicked.connect(self.updateSettings) self.qgroup_mode = Qt.QButtonGroup(self) self.qgroup_mode.addButton(self.qradio_mode_off) self.qgroup_mode.addButton(self.qradio_mode_slow) self.qgroup_mode.addButton(self.qradio_mode_fast) self.qgroup_mode.addButton(self.qradio_mode_both) self.qchk_hold = Qt.QCheckBox('Hold both') self.qchk_hold.clicked.connect(self.updateSettings) self.qlabel_int1_state = Qt.QLabel('Integrator 1 state: Off') self.qlabel_int2_state = Qt.QLabel('Integrator 2 state: Off') vbox.addWidget(self.qradio_mode_off) vbox.addWidget(self.qradio_mode_slow) vbox.addWidget(self.qradio_mode_fast) vbox.addWidget(self.qradio_mode_both) #FEATURE vbox.addWidget(self.qchk_flip1) vbox.addWidget(self.qchk_flip2) #vbox.addWidget(self.qchk_hold) vbox.addWidget(self.qlabel_int1_state) vbox.addWidget(self.qlabel_int2_state) vbox.addStretch(1) ## The slow PZT integrators BW controls: # The label to indicate the predicted closed-loop BW self.qlbl_acquisition = Qt.QLabel('Acq gain:') self.qlabel_int1_gain = Qt.QLabel('BW : 10 Hz') self.qlabel_int1_gain.setAlignment(Qt.Qt.AlignHCenter) # The knob to set the open-loop gain, and thus closed-loop BW self.qcombo_int1_gain = Qt.QComboBox() gainsList = range(-31, 31) gainsList = list(map(str, gainsList)) self.qcombo_int1_gain.addItems(gainsList) self.qcombo_int1_gain.setCurrentIndex( 32 - 17 ) # this has to be overridden if we load the register settings (TODO) self.qcombo_int1_gain.currentIndexChanged.connect( self.setIntegratorGainEvent) self.qlbl_lock_gain = Qt.QLabel('Lock gain:') self.qlabel_int2_gain = Qt.QLabel('BW : 1 kHz') self.qlabel_int2_gain.setAlignment(Qt.Qt.AlignHCenter) # The knob to set the open-loop gain, and thus closed-loop BW self.qcombo_int2_gain = Qt.QComboBox() gainsList = range(-31, 31) gainsList = list(map(str, gainsList)) self.qcombo_int2_gain.addItems(gainsList) self.qcombo_int2_gain.setCurrentIndex( 32 - 17 ) # this has to be overridden if we load the register settings (TODO) self.qcombo_int2_gain.currentIndexChanged.connect( self.setIntegratorGainEvent) self.qgroupbox_integrators = Qt.QGroupBox('Slow PZT (DAC2)') vbox_int = Qt.QVBoxLayout() vbox_int.addWidget(self.qlbl_acquisition) vbox_int.addWidget(self.qcombo_int1_gain) vbox_int.addWidget(self.qlabel_int1_gain) vbox_int.addWidget(self.qlbl_lock_gain) vbox_int.addWidget(self.qcombo_int2_gain) vbox_int.addWidget(self.qlabel_int2_gain) vbox_int.addStretch(1) self.qgroupbox_integrators.setLayout(vbox_int) # The controls for the fast PZT's loop filter settings, contains only one (composite) widget: self.qgroupbox_pll = Qt.QGroupBox('Fast PZT (DAC1)', self) # self.dac1_ui.setParent(self.qgroupbox_pll) vbox3 = Qt.QVBoxLayout() vbox3.addWidget(self.dac1_ui) self.qgroupbox_pll.setLayout(vbox3) # Put all the vboxes and groupboxes into a single layout: hbox = Qt.QHBoxLayout() hbox.addLayout(vbox) hbox.addWidget(self.qgroupbox_integrators) hbox.addWidget(self.qgroupbox_pll) hbox.setStretch(2, 1) self.setLayout(hbox)
def __init__(self): gr.top_block.__init__(self, "Hf Spectrum Simple Fosphor") Qt.QWidget.__init__(self) self.setWindowTitle("Hf Spectrum Simple Fosphor") 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", "hf_spectrum_simple_fosphor") 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.ts_str = ts_str = dt.strftime(dt.utcnow(), "%Y-%m-%dT%H:%M:%S.%fZ") self.y_min = y_min = -140 self.y_max = y_max = -60 self.variable_qtgui_label_0 = variable_qtgui_label_0 = ts_str self.samp_rate = samp_rate = 500e3 self.rx_freq = rx_freq = 10e6 self.decim = decim = 1 self.decay_rate = decay_rate = 20e-3 self.ahfd_ant = ahfd_ant = 'A' ################################################## # Blocks ################################################## self._samp_rate_tool_bar = Qt.QToolBar(self) self._samp_rate_tool_bar.addWidget(Qt.QLabel('SAMP_RATE' + ": ")) self._samp_rate_line_edit = Qt.QLineEdit(str(self.samp_rate)) self._samp_rate_tool_bar.addWidget(self._samp_rate_line_edit) self._samp_rate_line_edit.returnPressed.connect( lambda: self.set_samp_rate( eng_notation.str_to_num(str(self._samp_rate_line_edit.text())) )) self.top_grid_layout.addWidget(self._samp_rate_tool_bar, 8, 0, 1, 1) for r in range(8, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._rx_freq_tool_bar = Qt.QToolBar(self) self._rx_freq_tool_bar.addWidget(Qt.QLabel('FREQ' + ": ")) self._rx_freq_line_edit = Qt.QLineEdit(str(self.rx_freq)) self._rx_freq_tool_bar.addWidget(self._rx_freq_line_edit) self._rx_freq_line_edit.returnPressed.connect(lambda: self.set_rx_freq( eng_notation.str_to_num(str(self._rx_freq_line_edit.text())))) self.top_grid_layout.addWidget(self._rx_freq_tool_bar, 8, 1, 1, 1) for r in range(8, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) # Create the options list self._ahfd_ant_options = ( 'A', 'B', ) # Create the labels list self._ahfd_ant_labels = ( 'N/S', 'E/W', ) # Create the combo box self._ahfd_ant_tool_bar = Qt.QToolBar(self) self._ahfd_ant_tool_bar.addWidget(Qt.QLabel('AHFD Ant' + ": ")) self._ahfd_ant_combo_box = Qt.QComboBox() self._ahfd_ant_tool_bar.addWidget(self._ahfd_ant_combo_box) for _label in self._ahfd_ant_labels: self._ahfd_ant_combo_box.addItem(_label) self._ahfd_ant_callback = lambda i: Qt.QMetaObject.invokeMethod( self._ahfd_ant_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._ahfd_ant_options.index(i))) self._ahfd_ant_callback(self.ahfd_ant) self._ahfd_ant_combo_box.currentIndexChanged.connect( lambda i: self.set_ahfd_ant(self._ahfd_ant_options[i])) # Create the radio buttons self.top_grid_layout.addWidget(self._ahfd_ant_tool_bar, 8, 3, 1, 1) for r in range(8, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(3, 4): self.top_grid_layout.setColumnStretch(c, 1) self._y_min_tool_bar = Qt.QToolBar(self) self._y_min_tool_bar.addWidget(Qt.QLabel('FREQ' + ": ")) self._y_min_line_edit = Qt.QLineEdit(str(self.y_min)) self._y_min_tool_bar.addWidget(self._y_min_line_edit) self._y_min_line_edit.returnPressed.connect(lambda: self.set_y_min( eng_notation.str_to_num(str(self._y_min_line_edit.text())))) self.top_grid_layout.addWidget(self._y_min_tool_bar, 8, 4, 1, 1) for r in range(8, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 5): self.top_grid_layout.setColumnStretch(c, 1) self._y_max_tool_bar = Qt.QToolBar(self) self._y_max_tool_bar.addWidget(Qt.QLabel('FREQ' + ": ")) self._y_max_line_edit = Qt.QLineEdit(str(self.y_max)) self._y_max_tool_bar.addWidget(self._y_max_line_edit) self._y_max_line_edit.returnPressed.connect(lambda: self.set_y_max( eng_notation.str_to_num(str(self._y_max_line_edit.text())))) self.top_grid_layout.addWidget(self._y_max_tool_bar, 8, 5, 1, 1) for r in range(8, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(5, 6): self.top_grid_layout.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: str(x) self._variable_qtgui_label_0_tool_bar.addWidget( Qt.QLabel('Start Time [UTC]' + ": ")) 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.top_grid_layout.addWidget(self._variable_qtgui_label_0_tool_bar, 8, 6, 1, 2) for r in range(8, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(6, 8): self.top_grid_layout.setColumnStretch(c, 1) self.uhd_usrp_source_1 = uhd.usrp_source( ",".join(("addr=192.168.10.2", "")), uhd.stream_args( cpu_format="fc32", args='', channels=list(range(0, 2)), ), ) self.uhd_usrp_source_1.set_subdev_spec('A:AB B:AB', 0) self.uhd_usrp_source_1.set_time_source('gpsdo', 0) self.uhd_usrp_source_1.set_clock_source('gpsdo', 0) self.uhd_usrp_source_1.set_center_freq(uhd.tune_request(rx_freq), 0) self.uhd_usrp_source_1.set_gain(0, 0) self.uhd_usrp_source_1.set_antenna('A', 0) self.uhd_usrp_source_1.set_center_freq(uhd.tune_request(rx_freq), 1) self.uhd_usrp_source_1.set_gain(0, 1) self.uhd_usrp_source_1.set_antenna(ahfd_ant, 1) self.uhd_usrp_source_1.set_samp_rate(samp_rate) self.uhd_usrp_source_1.set_time_unknown_pps(uhd.time_spec()) self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc( interpolation=1, decimation=decim, taps=None, fractional_bw=None) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=1, decimation=decim, taps=None, fractional_bw=None) self.fosphor_qt_sink_c_0_0 = fosphor.qt_sink_c() self.fosphor_qt_sink_c_0_0.set_fft_window(firdes.WIN_BLACKMAN_hARRIS) self.fosphor_qt_sink_c_0_0.set_frequency_range(0, samp_rate) self._fosphor_qt_sink_c_0_0_win = sip.wrapinstance( self.fosphor_qt_sink_c_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._fosphor_qt_sink_c_0_0_win, 0, 4, 8, 4) for r in range(0, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(4, 8): self.top_grid_layout.setColumnStretch(c, 1) self.fosphor_qt_sink_c_0 = fosphor.qt_sink_c() self.fosphor_qt_sink_c_0.set_fft_window(firdes.WIN_BLACKMAN_hARRIS) self.fosphor_qt_sink_c_0.set_frequency_range(0, samp_rate) self._fosphor_qt_sink_c_0_win = sip.wrapinstance( self.fosphor_qt_sink_c_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._fosphor_qt_sink_c_0_win, 0, 0, 8, 4) for r in range(0, 8): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 4): self.top_grid_layout.setColumnStretch(c, 1) # Create the options list self._decay_rate_options = ( 100e-6, 65e-3, 20e-3, ) # Create the labels list self._decay_rate_labels = ( 'Fast', 'Medium', 'Slow', ) # Create the combo box # Create the radio buttons self._decay_rate_group_box = Qt.QGroupBox('decay_rate' + ": ") self._decay_rate_box = Qt.QHBoxLayout() class variable_chooser_button_group(Qt.QButtonGroup): def __init__(self, parent=None): Qt.QButtonGroup.__init__(self, parent) @pyqtSlot(int) def updateButtonChecked(self, button_id): self.button(button_id).setChecked(True) self._decay_rate_button_group = variable_chooser_button_group() self._decay_rate_group_box.setLayout(self._decay_rate_box) for i, _label in enumerate(self._decay_rate_labels): radio_button = Qt.QRadioButton(_label) self._decay_rate_box.addWidget(radio_button) self._decay_rate_button_group.addButton(radio_button, i) self._decay_rate_callback = lambda i: Qt.QMetaObject.invokeMethod( self._decay_rate_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._decay_rate_options.index(i))) self._decay_rate_callback(self.decay_rate) self._decay_rate_button_group.buttonClicked[int].connect( lambda i: self.set_decay_rate(self._decay_rate_options[i])) self.top_grid_layout.addWidget(self._decay_rate_group_box, 8, 2, 1, 1) for r in range(8, 9): self.top_grid_layout.setRowStretch(r, 1) for c in range(2, 3): self.top_grid_layout.setColumnStretch(c, 1) ################################################## # Connections ################################################## self.connect((self.rational_resampler_xxx_0, 0), (self.fosphor_qt_sink_c_0_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.fosphor_qt_sink_c_0, 0)) self.connect((self.uhd_usrp_source_1, 1), (self.rational_resampler_xxx_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.rational_resampler_xxx_0_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_pll1 = Qt.QGroupBox('Select connection to PLL 1') self.qgroupbox_MUX_pll1.setAutoFillBackground(True) MUX_pll1 = Qt.QGridLayout() self.qradio_ddc0_to_pll1 = Qt.QRadioButton('DDC_0 output to PLL_1 input') self.qradio_pll0_to_pll1 = Qt.QRadioButton('PLL_0 output to PLL_1 input') self.qradio_ddc1_to_pll1 = Qt.QRadioButton('DDC_1 output to PLL_1 input') self.qradio_ddc1_to_pll1.setChecked(True) self.qradio_pll0_to_pll1.clicked.connect(self.mux_pll1_Action) self.qradio_ddc0_to_pll1.clicked.connect(self.mux_pll1_Action) self.qradio_ddc1_to_pll1.clicked.connect(self.mux_pll1_Action) MUX_pll1.addWidget(self.qradio_ddc0_to_pll1, 0, 0) MUX_pll1.addWidget(self.qradio_pll0_to_pll1, 1, 0) MUX_pll1.addWidget(self.qradio_ddc1_to_pll1, 2, 0) MUX_pll1.setRowStretch(2, 0) self.qgroupbox_MUX_pll1.setLayout(MUX_pll1) ################################################################################### 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_pll1, 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, "RTTY_receive", catch_exceptions=True) Qt.QWidget.__init__(self) self.setWindowTitle("RTTY_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", "RTTY_receive") 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.sq_lvl = sq_lvl = -70 self.samp_rate = samp_rate = 48000 self.reverse = reverse = 1 self.fsk_deviation = fsk_deviation = 170 self.decim = decim = 50 self.center = center = 2210 self.baud = baud = 1 / 0.022 ################################################## # Blocks ################################################## self._sq_lvl_range = Range(-100, 0, 5, -70, 200) self._sq_lvl_win = RangeWidget(self._sq_lvl_range, self.set_sq_lvl, 'Squelch', "counter_slider", float, QtCore.Qt.Horizontal) self.top_grid_layout.addWidget(self._sq_lvl_win) # Create the options list self._reverse_options = ( 1, -1, ) # Create the labels list self._reverse_labels = ( 'Normal', 'Reverse', ) # Create the combo box # Create the radio buttons self._reverse_group_box = Qt.QGroupBox('reverse' + ": ") self._reverse_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._reverse_button_group = variable_chooser_button_group() self._reverse_group_box.setLayout(self._reverse_box) for i, _label in enumerate(self._reverse_labels): radio_button = Qt.QRadioButton(_label) self._reverse_box.addWidget(radio_button) self._reverse_button_group.addButton(radio_button, i) self._reverse_callback = lambda i: Qt.QMetaObject.invokeMethod( self._reverse_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._reverse_options.index(i))) self._reverse_callback(self.reverse) self._reverse_button_group.buttonClicked[int].connect( lambda i: self.set_reverse(self._reverse_options[i])) self.top_grid_layout.addWidget(self._reverse_group_box) self.zeromq_push_msg_sink_0 = zeromq.push_msg_sink( 'tcp://127.0.0.1:50252', 100, True) self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff( interpolation=500, decimation=960, taps=None, fractional_bw=None) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 128, #size 960, #samp_rate "", #name 1, #number of inputs None # parent ) self.qtgui_time_sink_x_0.set_update_time(0.10) self.qtgui_time_sink_x_0.set_y_axis(0, 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_NEG, 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(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_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype center, #fc 1024, #bw "", #name 1, None # parent ) self.qtgui_freq_sink_x_0.set_update_time(0.05) 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(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_fcf( 50, firdes.low_pass(1.0, samp_rate, 1000, 400), center, samp_rate) self.epy_block_0 = epy_block_0.my_sync_block() self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(reverse) self.audio_source_0 = audio.source(samp_rate, '', True) self.analog_simple_squelch_cc_0 = analog.simple_squelch_cc(sq_lvl, 1) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1.0) ################################################## # Connections ################################################## self.msg_connect((self.epy_block_0, 'msg_out'), (self.zeromq_push_msg_sink_0, 'in')) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.analog_simple_squelch_cc_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.audio_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.epy_block_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_simple_squelch_cc_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_multiply_const_vxx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Lab 1") Qt.QWidget.__init__(self) self.setWindowTitle("Lab 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", "lab1") 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.freqc = freqc = 900 self.sps = sps = 8 self.samp_rate = samp_rate = 1000 self.phase = phase = 0 self.mod_M = mod_M = 0 self.gain_ = gain_ = 0.5 self.freqc_ = freqc_ = freqc self.fps = fps = 30 self.foffset = foffset = 0 self.bw = bw = 1 self.buff_size = buff_size = 32768 self.analog_gain = analog_gain = 32 ################################################## # Blocks ################################################## 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, 'Spectrum/Constellation') 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, 'Time-Series') self.top_grid_layout.addWidget(self.tab0, 0, 0, 10, 2) for r in range(0, 10): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 2): self.top_grid_layout.setColumnStretch(c, 1) self._phase_range = Range(-180*2, 180*2, 0.1, 0, 200) self._phase_win = RangeWidget(self._phase_range, self.set_phase, 'Phase Offset (Degrees)', "counter_slider", float) self.top_grid_layout.addWidget(self._phase_win, 11, 1, 1, 1) for r in range(11, 12): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) # Create the options list self._mod_M_options = (0, 1, ) # Create the labels list self._mod_M_labels = ('BPSK', 'QPSK', ) # Create the combo box # Create the radio buttons self._mod_M_group_box = Qt.QGroupBox('Modulation Select' + ": ") self._mod_M_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._mod_M_button_group = variable_chooser_button_group() self._mod_M_group_box.setLayout(self._mod_M_box) for i, _label in enumerate(self._mod_M_labels): radio_button = Qt.QRadioButton(_label) self._mod_M_box.addWidget(radio_button) self._mod_M_button_group.addButton(radio_button, i) self._mod_M_callback = lambda i: Qt.QMetaObject.invokeMethod(self._mod_M_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._mod_M_options.index(i))) self._mod_M_callback(self.mod_M) self._mod_M_button_group.buttonClicked[int].connect( lambda i: self.set_mod_M(self._mod_M_options[i])) self.top_grid_layout.addWidget(self._mod_M_group_box, 12, 1, 1, 1) for r in range(12, 13): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self._gain__range = Range(0.1, 1, 0.01, 0.5, 200) self._gain__win = RangeWidget(self._gain__range, self.set_gain_, 'Gain (Amp)', "counter_slider", float) self.top_grid_layout.addWidget(self._gain__win, 10, 1, 1, 1) for r in range(10, 11): self.top_grid_layout.setRowStretch(r, 1) for c in range(1, 2): self.top_grid_layout.setColumnStretch(c, 1) self._freqc__range = Range(70, 6000, .01, freqc, 200) self._freqc__win = RangeWidget(self._freqc__range, self.set_freqc_, 'Carrier (MHz)', "counter_slider", float) self.top_grid_layout.addWidget(self._freqc__win, 10, 0, 1, 1) for r in range(10, 11): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._foffset_range = Range(-10, 10, 1, 0, 10) self._foffset_win = RangeWidget(self._foffset_range, self.set_foffset, 'Frequency Offset (Hz)', "counter_slider", float) self.top_grid_layout.addWidget(self._foffset_win, 12, 0, 1, 1) for r in range(12, 13): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self._analog_gain_range = Range(0, 64, 1, 32, 200) self._analog_gain_win = RangeWidget(self._analog_gain_range, self.set_analog_gain, 'Gain (Analog)', "counter_slider", float) self.top_grid_layout.addWidget(self._analog_gain_win, 11, 0, 1, 1) for r in range(11, 12): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 1): self.top_grid_layout.setColumnStretch(c, 1) self.qtgui_time_sink_x_0 = qtgui.time_sink_c( 131072, #size samp_rate*1000, #samp_rate "", #name 1 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(1/fps) 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(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.tab0_grid_layout_1.addWidget(self._qtgui_time_sink_x_0_win, 0, 0, 10, 2) for r in range(0, 10): self.tab0_grid_layout_1.setRowStretch(r, 1) for c in range(0, 2): self.tab0_grid_layout_1.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate*1e3, #bw "", #name 1 ) self.qtgui_freq_sink_x_0_0.set_update_time(1/fps) self.qtgui_freq_sink_x_0_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_0_0.enable_grid(True) self.qtgui_freq_sink_x_0_0.set_fft_average(0.1) self.qtgui_freq_sink_x_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0_0.enable_control_panel(False) labels = ['Magnitude', '', '', '', '', '', '', '', '', ''] 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.tab0_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_0_win, 0, 0, 5, 1) for r in range(0, 5): self.tab0_grid_layout_0.setRowStretch(r, 1) for c in range(0, 1): self.tab0_grid_layout_0.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0_0.set_processor_affinity([0]) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate*1e3, #bw "", #name 2 ) self.qtgui_freq_sink_x_0.set_update_time(1/fps) 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(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) self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['In-Phase', 'Quadrature', '', '', '', '', '', '', '', ''] 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(2): 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.tab0_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_win, 5, 0, 5, 1) for r in range(5, 10): self.tab0_grid_layout_0.setRowStretch(r, 1) for c in range(0, 1): self.tab0_grid_layout_0.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0.set_processor_affinity([0]) self.qtgui_const_sink_x_0 = qtgui.const_sink_c( 1024, #size "", #name 2 #number of inputs ) self.qtgui_const_sink_x_0.set_update_time(1/fps) self.qtgui_const_sink_x_0.set_y_axis(-3, 3) self.qtgui_const_sink_x_0.set_x_axis(-3, 3) 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 = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "red", "red", "red", "red", "red", "red", "red", "red"] styles = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0] markers = [0, -1, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 0.5, 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.tab0_grid_layout_0.addWidget(self._qtgui_const_sink_x_0_win, 0, 1, 10, 1) for r in range(0, 10): self.tab0_grid_layout_0.setRowStretch(r, 1) for c in range(1, 2): self.tab0_grid_layout_0.setColumnStretch(c, 1) self.qtgui_const_sink_x_0.set_processor_affinity([0]) self.iio_pluto_source_0 = iio.pluto_source('', int(freqc_*1e6), int(samp_rate*1000), 20000000, buff_size, True, True, True, 'manual', analog_gain, '', True) self.iio_pluto_sink_0 = iio.pluto_sink('', int(freqc_*1e6)+foffset, int(samp_rate*1000), 20000000, buff_size, False, 10.0, '', True) self.digital_psk_mod_0_0 = digital.psk.psk_mod( constellation_points=4, mod_code="gray", differential=True, samples_per_symbol=sps, excess_bw=1, verbose=False, log=False) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_cc(np.exp(1j*2*pi*phase/360)) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_ff(mod_M) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(gain_ * np.exp(1j * pi / 4)) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_complex_to_real_1 = blocks.complex_to_real(1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_complex_to_imag_1 = blocks.complex_to_imag(1) self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1) self.analog_random_source_x_0 = blocks.vector_source_b(list(map(int, numpy.random.randint(0, 4, 8192))), True) self.analog_agc_xx_0 = analog.agc_cc(1e-4, ( 1.0 + mod_M), 1.0) self.analog_agc_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc_xx_0, 0), (self.blocks_complex_to_imag_0, 0)) self.connect((self.analog_agc_xx_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.analog_agc_xx_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.analog_agc_xx_0, 0), (self.qtgui_const_sink_x_0, 1)) self.connect((self.analog_agc_xx_0, 0), (self.qtgui_freq_sink_x_0_0, 0)) self.connect((self.analog_agc_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.digital_psk_mod_0_0, 0)) self.connect((self.blocks_complex_to_imag_0, 0), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.blocks_complex_to_imag_1, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.blocks_complex_to_real_1, 0), (self.blocks_multiply_const_vxx_0_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.iio_pluto_sink_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_complex_to_imag_1, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_complex_to_real_1, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.analog_agc_xx_0, 0)) self.connect((self.digital_psk_mod_0_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.iio_pluto_source_0, 0), (self.blocks_multiply_const_vxx_1, 0))