コード例 #1
0
    def setFlagQimage(self):
      (nx,ny) = self._image_for_display.shape
      image_for_display = self._image_for_display.copy()
      if not self._flags_array is None:
        if self.complex:
          image_for_display[:nx/2,:] = numpy.where(self._flags_array,0,self._image_for_display[:nx/2,:])
          image_for_display[nx/2:,:] = numpy.where(self._flags_array,0,self._image_for_display[nx/2:,:])
        else:
          image_for_display = numpy.where(self._flags_array,0,self._image_for_display)

      if not self._nan_flags_array is None:
        if self.complex:
          image_for_display[:nx/2,:] = numpy.where(self._nan_flags_array,1,image_for_display[:nx/2,:])
          image_for_display[nx/2:,:] = numpy.where(self._nan_flags_array,1,image_for_display[nx/2:,:])
        else:
          image_for_display = numpy.where(self._nan_flags_array,1,image_for_display)

#     self.flags_Qimage = Qwt.toQImage(image_for_display).mirrored(0, 1)
      self.flags_Qimage = convertToQImage(image_for_display,True).mirrored(0, 1)

# set color scale a la HippoDraw Scale
      if self.display_type == "hippo":
        self.toHippo(self.flags_Qimage)

# set color scale to Grayscale
      if self.display_type == "grayscale":
        self.toGrayScale(self.flags_Qimage)

# set zero to black to display flag image pixels in black 
      self.flags_Qimage.setColor(0, Qt.qRgb(self.flag_colour, self.flag_colour, self.flag_colour))
      self.flags_Qimage.setColor(1, Qt.qRgb(self.nan_colour, self.nan_colour, self.nan_colour))
コード例 #2
0
ファイル: app.py プロジェクト: diegomvh/prymatex
    def setupLogging(self, verbose, namePattern):
        from datetime import datetime
        
        level = [ logging.CRITICAL, logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG ][verbose % 5]
        
        # File name
        d = datetime.now().strftime('%d-%m-%Y-%H-%M-%S')
        filename = os.path.join(self.settings.PMX_LOG_PATH, 'messages-%s.log' % d)
        logging.basicConfig(filename = filename, level=level)
        
        # Console handler
        ch = logging.StreamHandler()
        formatter = logging.Formatter('%(name)s - %(levelname)s - %(message)s')
        ch.setFormatter(formatter)
        ch.setLevel(level)
        
        if namePattern:
            #Solo al de consola
            ch.addFilter(NameFilter(namePattern))

        logging.root.addHandler(ch)
        logging.root.info("Application startup")
        logging.root.debug("Application startup debug")

        self.logger = logging.root
        
        # Route Qt output
        Qt.qInstallMsgHandler(self.qtMessageHandler)
コード例 #3
0
ファイル: MainWindow.py プロジェクト: ghold/OneKeySql
 def openEditMode(self, item):
     if item.childCount() == 0:
         if item.treeWidget().editState and item == item.treeWidget().selectedItem:
             item.treeWidget().itemPressed.connect(self.updateStepList)
             item.treeWidget().itemPressed.disconnect(item.treeWidget().pressItem)
             self.mainSplitter.widget(2).setParent(None)
             self.mainSplitter.widget(1).setStretchFactor(1, 1)
             for btn in self.moduleGroup.buttons():
                 btn.setEnabled(True)
             self.addButton.setEnabled(True)
             item.treeWidget().editState = False
             #change background
             image = Qt.QImage(1, 41, Qt.QImage.Format_RGB32)
             image.fill(Qt.QColor(238,  238,  238))
             image.setPixel(0, 40, Qt.qRgba(255, 255, 255, 255))
             brush = Qt.QBrush()
             brush.setTextureImage(image)
             item.setBackground(0, brush)
             item.setTextColor(0, Qt.QColor(110,  110,  110))
             item.state = False
             item.treeWidget().selectedItem = None
             
         elif not item.treeWidget().editState:
             self.updateStepList(item)
             item.treeWidget().itemPressed.disconnect(self.updateStepList)
             item.treeWidget().itemPressed.connect(item.treeWidget().pressItem)
             #setup unitList
             unitList = self.model.makeupUnitList()
             unitList.itemPressed.connect(unitList.pressItem)
             #completer
             wordList = ["中转" ,  "运输" ,  "散货" ,  "收仓"]
             completer = Qt.QCompleter(wordList)
             #unitWidget
             unitWidget = Qt.QWidget()
             lineEdit = Qt.QLineEdit()
             lineEdit.setCompleter(completer)
             lineEdit.textChanged.connect(unitList.search)
             unitLayout = Qt.QVBoxLayout()
             unitLayout.addWidget(lineEdit)
             unitLayout.addWidget(unitList)
             unitWidget.setLayout(unitLayout)
             
             self.mainSplitter.addWidget(unitWidget)
             for btn in self.moduleGroup.buttons():
                 btn.setEnabled(False)
             self.addButton.setEnabled(False)
             item.treeWidget().editState = True
             #change background
             image = Qt.QImage(1, 41, Qt.QImage.Format_RGB32)
             image.fill(Qt.QColor(221, 221, 221))
             image.setPixel(0, 39, Qt.qRgba(33, 133, 197, 255))
             image.setPixel(0, 40, Qt.qRgba(255, 255, 255, 255))
             brush = Qt.QBrush()
             brush.setTextureImage(image)
             item.setBackground(0, brush)
             item.setTextColor(0, Qt.QColor(59,  66,  76))
             item.setItemSelected(item)
コード例 #4
0
ファイル: exceptionform.py プロジェクト: crossroadchurch/paul
 def _create_report(self):
     """
     Create an exception report.
     """
     openlp_version = get_application_version()
     description = self.description_text_edit.toPlainText()
     traceback = self.exception_text_edit.toPlainText()
     system = translate('OpenLP.ExceptionForm', 'Platform: %s\n') % platform.platform()
     libraries = 'Python: %s\n' % platform.python_version() + \
         'Qt4: %s\n' % Qt.qVersion() + \
         'Phonon: %s\n' % PHONON_VERSION + \
         'PyQt4: %s\n' % Qt.PYQT_VERSION_STR + \
         'QtWebkit: %s\n' % WEBKIT_VERSION + \
         'SQLAlchemy: %s\n' % sqlalchemy.__version__ + \
         'SQLAlchemy Migrate: %s\n' % MIGRATE_VERSION + \
         'BeautifulSoup: %s\n' % bs4.__version__ + \
         'lxml: %s\n' % etree.__version__ + \
         'Chardet: %s\n' % CHARDET_VERSION + \
         'PyEnchant: %s\n' % ENCHANT_VERSION + \
         'Mako: %s\n' % MAKO_VERSION + \
         'pyICU: %s\n' % ICU_VERSION + \
         'pyUNO bridge: %s\n' % self._pyuno_import() + \
         'VLC: %s\n' % VLC_VERSION
     if is_linux():
         if os.environ.get('KDE_FULL_SESSION') == 'true':
             system += 'Desktop: KDE SC\n'
         elif os.environ.get('GNOME_DESKTOP_SESSION_ID'):
             system += 'Desktop: GNOME\n'
         elif os.environ.get('DESKTOP_SESSION') == 'xfce':
             system += 'Desktop: Xfce\n'
     return openlp_version, description, traceback, system, libraries
コード例 #5
0
ファイル: OkListItem.py プロジェクト: ghold/OneKeySql
 def mousePressEvent(self, event):
     if event.buttons() == Qt.Qt.LeftButton and not self.item.state:
         #change background
         image = Qt.QImage(1, 41, Qt.QImage.Format_RGB32)
         image.fill(Qt.QColor(221, 221, 221))
         image.setPixel(0, 39, Qt.qRgba(33, 133, 197, 255))
         image.setPixel(0, 40, Qt.qRgba(255, 255, 255, 255))
         brush = Qt.QBrush()
         brush.setTextureImage(image)
         self.item.setBackground(0, brush)
         self.item.setTextColor(0, Qt.QColor(59,  66,  76))
         self.item.setItemSelected(self.item)
         #show info
         infoWidget = self.item.treeWidget().infoWidget
         infoWidget.infoGeneratorUTF8(self.item)
         event.accept()
コード例 #6
0
ファイル: signal.py プロジェクト: cmft/taurus
def baseSignal(name, *args):
    """Signal class for non-Qobject objects.

    :param name: signal name (unlike pyqtSignal, name has
                 to be specified explicitely)
    :param args: arguments passed to the pyqtSignal
    """
    main_lock = Lock()
    lock_dict = WeakKeyDictionary()
    classname = name.capitalize() + "Signaller"
    attrs = {name: Qt.pyqtSignal(*args, name=name)}
    signaller_type = type(classname, (Qt.QObject,), attrs)

    def get_lock(self):
        with main_lock:
            if self not in lock_dict:
                lock_dict[self] = Lock()
        return lock_dict[self]

    def get_signaller(self):
        with get_lock(self):
            if not hasattr(self, '_signallers'):
                self._signallers = {}
            if (name, args) not in self._signallers:
                self._signallers[name, args] = signaller_type()
        return self._signallers[name, args]

    def get_signal(self):
        return getattr(get_signaller(self), name)

    doc = "Base signal {}".format(name)
    return property(get_signal, doc=doc)
コード例 #7
0
    def toHippo(self, Qimage):
      dv = 255.0
      vmin = 1.0
      for i in range(2, 256):
        r = 1.0
        g = 1.0
        b = 1.0
        v = 1.0 * i
        if (v < (vmin + 0.25 * dv)):
          r = 0;
          if dv != 0:
            g = 4 * (v - vmin) / dv;
        elif (v < (vmin + 0.5 * dv)):
          r = 0;
          if dv != 0:
            b = 1 + 4 * (vmin + 0.25 * dv - v) / dv;
        elif (v < (vmin + 0.75 * dv)):
          b = 0;
          if dv != 0:
            r = 4 * (v - vmin - 0.5 * dv) / dv;
        else: 
          b = 0;
          if dv != 0:
            g = 1 + 4 * (vmin + 0.75 * dv - v) / dv;
          else:
            r = 0
        red   = int ( r * 255. )
        green = int ( g * 255. )
        blue  = int ( b * 255. )
# the following call will use the previous computations to
# set up a hippo-like color display
        Qimage.setColor(i, Qt.qRgb(red, green, blue))
コード例 #8
0
ファイル: about.py プロジェクト: diegomvh/prymatex
 def fillVersionInfo(self):
     pmx_url = prymatex.__url__
     pmx_source = prymatex.__source__
     commandline = ' '.join(sys.argv) 
     pmx_version = "%s (%s)" % ('.'.join(map(str, prymatex.VERSION)), self.getGitVersion())
     zmq_version = self.getZMQVersion()
     pony_version = self.getPonygurumaVersion()
     pyqt_version = Qt.qVersion()
     ipython_version = self.getIPythonVersion()
     self.textInformation.setHtml('''
         <style>
             dt {{ font-weight: bold; }}
             
         </style>
         <dl>
             <dt>Home Page</dt><dd><a href="{pmx_url}">{pmx_url}</a></dd>
             <dt>Source</dt><dd><a href="{pmx_url}">{pmx_source}</a></dd>
             <dt>Version</dt><dd>{pmx_version}</dd>
             <dt>Command Line</dt><dd>{commandline}</dd>
             <dt>PyQt4</dt><dd>{pyqt_version}</dd>
             <dt>Ponyguruma Regex Library</dt><dd>{pony_version}</dd>
             <dt>IPython</dt><dd>{ipython_version}</dd>
             <dt>ZMQ Version</dt><dd>{zmq_version}</dd>
        </dl>
     '''.format(**locals()))
コード例 #9
0
 def _createReport(self):
     """
     Create an exception report.
     """
     openlp_version = get_application_version()
     description = self.descriptionTextEdit.toPlainText()
     traceback = self.exceptionTextEdit.toPlainText()
     system = translate('OpenLP.ExceptionForm', 'Platform: %s\n') % platform.platform()
     libraries = u'Python: %s\n' % platform.python_version() + \
         u'Qt4: %s\n' % Qt.qVersion() + \
         u'Phonon: %s\n' % PHONON_VERSION + \
         u'PyQt4: %s\n' % Qt.PYQT_VERSION_STR + \
         u'QtWebkit: %s\n' % WEBKIT_VERSION + \
         u'SQLAlchemy: %s\n' % sqlalchemy.__version__ + \
         u'SQLAlchemy Migrate: %s\n' % MIGRATE_VERSION + \
         u'BeautifulSoup: %s\n' % BeautifulSoup.__version__ + \
         u'lxml: %s\n' % etree.__version__ + \
         u'Chardet: %s\n' % CHARDET_VERSION + \
         u'PyEnchant: %s\n' % ENCHANT_VERSION + \
         u'PySQLite: %s\n' % SQLITE_VERSION + \
         u'Mako: %s\n' % MAKO_VERSION + \
         u'pyUNO bridge: %s\n' % UNO_VERSION
     if platform.system() == u'Linux':
         if os.environ.get(u'KDE_FULL_SESSION') == u'true':
             system += u'Desktop: KDE SC\n'
         elif os.environ.get(u'GNOME_DESKTOP_SESSION_ID'):
             system += u'Desktop: GNOME\n'
     return (openlp_version, description, traceback, system, libraries)
コード例 #10
0
  def do_print(self, is_single=True, is_complex=False):
    """Sends plots in this window to the printer.
    """
    printer = Qt.QPrinter(Qt.QPrinter.HighResolution)

    printer.setOutputFileName('image-plot-%s.ps' % Qt.qVersion())

#   printer.setCreator('Bode example')
    printer.setOrientation(Qt.QPrinter.Landscape)
    printer.setColorMode(Qt.QPrinter.Color)

    docName = self.plotter.title().text()
    if not docName.isEmpty():
#       docName.replace(Qt.QRegExp(Qt.QString.fromLatin1('\n')), self.tr(' -- '))
        printer.setDocName(docName)

    dialog = Qt.QPrintDialog(printer)
    if dialog.exec_():
        filter = printfilter_qt4.PrintFilter()
        if (Qt.QPrinter.GrayScale == printer.colorMode()):
            filter.setOptions(
                Qwt.QwtPlotPrintFilter.PrintAll
                & ~Qwt.QwtPlotPrintFilter.PrintBackground
                | Qwt.QwtPlotPrintFilter.PrintFrameWithScales)
            filter.setOptions(Qwt.QwtPlotPrintFilter.PrintAll)
# we have 'two' horizontal widgets - colorbar(s) and the display area
        hor_widgets = 2
        if is_single:
          hor_widgets = 1
        self._print_plots(printer, filter, hor_widgets, 1, is_complex)
コード例 #11
0
ファイル: __init__.py プロジェクト: crossroadchurch/paul
def create_separated_list(string_list):
    """
    Returns a string that represents a join of a list of strings with a localized separator. This function corresponds

    to QLocale::createSeparatedList which was introduced in Qt 4.8 and implements the algorithm from
    http://www.unicode.org/reports/tr35/#ListPatterns

     :param string_list: List of unicode strings
    """
    if LooseVersion(Qt.PYQT_VERSION_STR) >= LooseVersion('4.9') and LooseVersion(Qt.qVersion()) >= LooseVersion('4.8'):
        return QtCore.QLocale().createSeparatedList(string_list)
    if not string_list:
        return ''
    elif len(string_list) == 1:
        return string_list[0]
    elif len(string_list) == 2:
        return translate('OpenLP.core.lib', '%s and %s',
                         'Locale list separator: 2 items') % (string_list[0], string_list[1])
    else:
        merged = translate('OpenLP.core.lib', '%s, and %s',
                           'Locale list separator: end') % (string_list[-2], string_list[-1])
        for index in reversed(list(range(1, len(string_list) - 2))):
            merged = translate('OpenLP.core.lib', '%s, %s',
                               'Locale list separator: middle') % (string_list[index], merged)
        return translate('OpenLP.core.lib', '%s, %s', 'Locale list separator: start') % (string_list[0], merged)
コード例 #12
0
    def to_QImage(self, image):
# convert to 8 bit image
      image_for_display = None
      if image.dtype == numpy.complex64 or image.dtype == numpy.complex128:
        self.complex = True
        real_array =  image.real
        if self.log_scale:
          temp_array = self.convert_to_log(real_array)
          temp_array = self.convert_to_log(real_array)
          if not self.r_cmin is None and not self.r_cmax is None:
            limits = self.convert_limits([self.r_cmin,self.r_cmax])
          else:
            limits = [self.r_cmin, self.r_cmax] 
          byte_image = bytescale(temp_array,limits)
        else:
          limits = [self.r_cmin,self.r_cmax]
          byte_image = bytescale(real_array,limits)
        (nx,ny) = real_array.shape
        image_for_display = numpy.empty(shape=(nx*2,ny),dtype=byte_image.dtype);
        image_for_display[:nx,:] = byte_image
        imag_array =  image.imag
        if self.log_scale:
          temp_array = self.convert_to_log(imag_array)
          if not self.i_cmin is None and not self.i_cmax is None:
            limits = self.convert_limits([self.i_cmin,self.i_cmax])
          else:
            limits = [self.i_cmin, self.i_cmax] 
          byte_image = bytescale(temp_array,limits)
        else:
          limits = [self.i_cmin,self.i_cmax]
          byte_image = bytescale(imag_array,limits)
        image_for_display[nx:,:] = byte_image
      else:
        if self.log_scale:
          temp_array = self.convert_to_log(image)
          if not self.r_cmin is None and not self.r_cmax is None:
            limits = self.convert_limits([self.r_cmin,self.r_cmax])
          else:
            limits = [self.r_cmin, self.r_cmax] 
          #print 'to_QImage log limits = ', limits
          image_for_display = bytescale(temp_array,limits)
        else:
          limits = [self.r_cmin,self.r_cmax]
          #print 'to_QImage real limits = ', limits
          image_for_display = bytescale(image,limits)
      # turn image into a QImage, and return result   
      if not self._nan_flags_array is None:
        if self.complex:
          image_for_display[:nx,:] = numpy.where(self._nan_flags_array,1,image_for_display[:nx,:])
          image_for_display[nx:,:] = numpy.where(self._nan_flags_array,1,image_for_display[nx:,:])
        else:
          image_for_display = numpy.where(self._nan_flags_array,1,image_for_display)
      self._image_for_display = image_for_display
#     result = Qwt.toQImage(image_for_display).mirrored(0, 1)
      result = convertToQImage(image_for_display,True).mirrored(0, 1)
      # always suppress NaNs
      if not self._nan_flags_array is None:
        result.setColor(1, Qt.qRgb(self.nan_colour, self.nan_colour, self.nan_colour))
      return result
コード例 #13
0
ファイル: OkListItem.py プロジェクト: ghold/OneKeySql
 def leaveEvent(self, event):
     if not self.item.state:
         image = Qt.QImage(1, 41, Qt.QImage.Format_RGB32)
         image.fill(Qt.QColor(238,  238,  238))
         image.setPixel(0, 40, Qt.qRgba(255, 255, 255, 255))
         brush = Qt.QBrush()
         brush.setTextureImage(image)
         self.item.setBackground(0, brush)
         self.item.setTextColor(0, Qt.QColor(110,  110,  110))
         event.accept()
コード例 #14
0
ファイル: OkListItem.py プロジェクト: ghold/OneKeySql
 def setItemSelected(self, item):
     if self.treeWidget().selectedItem is not None:
         self.treeWidget().selectedItem.state = False
         image = Qt.QImage(1, 41, Qt.QImage.Format_RGB32)
         image.fill(Qt.QColor(238,  238,  238))
         image.setPixel(0, 40, Qt.qRgba(255, 255, 255, 255))
         brush = Qt.QBrush()
         brush.setTextureImage(image)
         self.treeWidget().selectedItem.setBackground(0, brush)
         self.treeWidget().selectedItem.setTextColor(0, Qt.QColor(110,  110,  110))
     self.state = True
     self.treeWidget().selectedItem = item
コード例 #15
0
ファイル: ui2.py プロジェクト: evenator/senior-project
def getMapData(self, a):
	
	img = Qt.QImage(450, 450, Qt.QImage.Format_RGB32) #creates qImage
	value = Qt.qRgb(122, 163, 39)  #color of pixel to be drawn
	
	#arr = numpy.fromstring(a, numpy.uint8)
   	img = Qt.QImage(a, 450, 450, Qt.QImage.Format_RGB32)

   	pixmap = Qt.QPixmap.fromImage(img)
   	scene = Qt.QGraphicsScene()
   	scene.addPixmap(pixmap)
   	self.ui.Map.setScene(scene)
コード例 #16
0
ファイル: plot_image.py プロジェクト: geogradient/meris_ts
    def setData(self, xyz, xRange = None, yRange = None, isMask=False):
        '''Fixing a false maximum in the four cornes'''
        xyz[0, 0]=256
        xyz[0, 1134]=256
        xyz[664, 0]=256
        xyz[664, 1134]=256
        
        self.xyz = np.swapaxes(xyz, 0, 1)
        
        shape = xyz.shape
        if not xRange:
            xRange = (0, shape[1])
        if not yRange:
            yRange = (0, shape[0])

        print(xyz.max(), xyz.min())
        
        
        self.xMap = Qwt.QwtScaleMap(0, xyz.shape[1], *xRange)
        self.plot().setAxisScale(Qwt.QwtPlot.xBottom, *xRange)
        self.yMap = Qwt.QwtScaleMap(0, xyz.shape[0], *yRange)
        self.plot().setAxisScale(Qwt.QwtPlot.yLeft, *yRange)
          
       
        self.raster = Qwt.toQImage((self.xyz).astype(np.uint8))#.mirrored(True, True)
       
        
        for i in range(0, 256):
            if i == 0:
                self.raster.setColor(i, Qt.qRgb(0, 0, 0))
            else:
                #self.raster.setColor(i, Qt.qRgb(i, 75, (i-256)*-1))
                if isMask:
                    self.raster.setColor(i, Qt.qRgb(255, 255,0))
                else:
                    self.raster.setColor(i, Qt.qRgb(i, 30, (i-256)*-1))
                '''
コード例 #17
0
ファイル: OkListItem.py プロジェクト: ghold/OneKeySql
 def enterEvent(self, event):
     if not self.item.state:
         image = Qt.QImage(1, 41, Qt.QImage.Format_RGB32)
         image.fill(Qt.QColor(77,  166,  234))
         image.setPixel(0, 40, Qt.qRgba(255, 255, 255, 255))
         brush = Qt.QBrush()
         brush.setTextureImage(image)
         self.item.setBackground(0, brush)
         self.item.setTextColor(0, Qt.QColor(255,  255,  255))
         
         #point = self.mapTo(self.topLevelWidget(), self.geometry().topLeft())
         #self.toolTip.setParent(self.topLevelWidget())
         #self.toolTip.setGeometry(point.x() - 10, (point.y() + 42 - 2*10)/2,
                 #self.geometry().width() + 20, self.geometry().height() + 20)
         #self.toolTip.show()
         event.accept()
コード例 #18
0
ファイル: ImagePlotDemo.py プロジェクト: CaptainAL/Spyder
    def setData(self, xyzs, xRange = None, yRange = None):
        self.xyzs = xyzs
        shape = xyzs.shape
        if not xRange:
            xRange = (0, shape[0])
        if not yRange:
            yRange = (0, shape[1])

        self.xMap = Qwt.QwtScaleMap(0, xyzs.shape[0], *xRange)
        self.plot().setAxisScale(Qwt.QwtPlot.xBottom, *xRange)
        self.yMap = Qwt.QwtScaleMap(0, xyzs.shape[1], *yRange)
        self.plot().setAxisScale(Qwt.QwtPlot.yLeft, *yRange)

        self.image = Qwt.toQImage(bytescale(self.xyzs)).mirrored(False, True)
        for i in range(0, 256):
            self.image.setColor(i, Qt.qRgb(i, 0, 255-i))
コード例 #19
0
ファイル: OkListItem.py プロジェクト: ghold/OneKeySql
 def __init__(self, text, parent=None,  type=Qt.QListWidgetItem.UserType):
     Qt.QListWidgetItem.__init__(self, text, parent, type)
     
     #set background
     image = Qt.QImage(1, 41, Qt.QImage.Format_RGB32)
     image.fill(Qt.QColor(238,  238,  238))
     image.setPixel(0, 40, Qt.qRgba(255, 255, 255, 255))
     brush = Qt.QBrush()
     brush.setTextureImage(image)
     self.setBackground(brush)
     
     self.setFlags(Qt.Qt.ItemIsUserCheckable|Qt.Qt.ItemIsEnabled|Qt.Qt.ItemIsDragEnabled)
     self.setFont(Qt.QFont("微软雅黑", 12))
     self.setTextColor(Qt.QColor(110,  110,  110))
     self.setSizeHint(QtCore.QSize(200, 41))
     self.state = False
コード例 #20
0
ファイル: top_block.py プロジェクト: begemannjg/arch_implGRC
def main(top_block_cls=top_block, options=None):

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_()
コード例 #21
0
ファイル: top_block.py プロジェクト: viraptor/ook
def main(top_block_cls=top_block, options=None):
    if options is None:
        options, _ = argument_parser().parse_args()

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls(large_sig_len=options.large_sig_len, signal_mult=options.signal_mult, freq=options.freq)
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_()
コード例 #22
0
 def __init__(self, prjFileName, env, extRefs):
     super(LmmsProject, self).__init__()
     self.prjFileName = prjFileName
     self.env = env
     self.extRefs = extRefs
     self.fileCnt = 0
     self.prjPacked = (self.prjFileName[-4:].lower() == 'mmpz') 
     # load project file
     pfile = QtCore.QFile(self.prjFileName)
     if not pfile.open(QtCore.QIODevice.ReadOnly):  ## | QtCore.QIODevice.Text):
         print("Error opening LMMS Project file %(fileDesc)s!" % {'fileDesc' : self.prjFileName}) 
         self.prjContent = None
         return
     self.prjContent = pfile.readAll()
     if self.prjPacked:
         self.prjContent = Qt.qUncompress(self.prjContent)
     pfile.close()
     if optVerbose:
         print("Project file %(fileDesc)s loaded." % {'fileDesc' : self.prjFileName})
コード例 #23
0
    def printplot(self):
      # taken from PyQwt Bode demo

      printer = Qt.QPrinter(Qt.QPrinter.HighResolution)

      printer.setOutputFileName('histogram-example-%s.ps' % Qt.qVersion())

      printer.setOrientation(Qt.QPrinter.Landscape)
      printer.setColorMode(Qt.QPrinter.Color)

      dialog = Qt.QPrintDialog(printer)
      if dialog.exec_():
          filter = printfilter_qt4.PrintFilter()
          if (Qt.QPrinter.GrayScale == printer.colorMode()):
              filter.setOptions(
                  QwtPlotPrintFilter.PrintAll
                  & ~QwtPlotPrintFilter.PrintBackground
                  | QwtPlotPrintFilter.PrintFrameWithScales)
          self.print_(printer, filter)
コード例 #24
0
ファイル: RX_2017.py プロジェクト: kit-cel/gr-fbmc
def main(top_block_cls=RX_2017, options=None):
    if gr.enable_realtime_scheduling() != gr.RT_OK:
        print "Error: failed to enable real-time scheduling."

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_()
コード例 #25
0
def main(top_block_cls=upsat_transceiver_qt, options=None):
    if options is None:
        options, _ = argument_parser().parse_args()

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls(bind_addr=options.bind_addr, dest_addr=options.dest_addr, lo_offset=options.lo_offset, recv_port=options.recv_port, rx_sdr_device=options.rx_sdr_device, send_port=options.send_port, tx_sdr_device=options.tx_sdr_device, wod_port=options.wod_port)
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_()
コード例 #26
0
def main(top_block_cls=bladeRF_loopback, options=None):
    if options is None:
        options, _ = argument_parser().parse_args()

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls(instance=options.instance, loopback=options.loopback, rx_bandwidth=options.rx_bandwidth, rx_frequency=options.rx_frequency, rx_lna_gain=options.rx_lna_gain, rx_num_buffers=options.rx_num_buffers, rx_num_xfers=options.rx_num_xfers, rx_sample_rate=options.rx_sample_rate, rx_vga_gain=options.rx_vga_gain, serial=options.serial, tx_bandwidth=options.tx_bandwidth, tx_frequency=options.tx_frequency, tx_num_buffers=options.tx_num_buffers, tx_num_xfers=options.tx_num_xfers, tx_sample_rate=options.tx_sample_rate, tx_vga1=options.tx_vga1, tx_vga2=options.tx_vga2, verbosity=options.verbosity)
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_()
コード例 #27
0
def main(top_block_cls=inets_transceiver_test_client, options=None):

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    rssi_probe = rssi_test(tb)
    rssi_thread = threading.Thread(target=rssi_probe.run_test)
    rssi_thread.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_()
コード例 #28
0
 def exportToFolder(self, exportFolder, exportMode):
     # check/prepare/create destination folder
     self.dExpFolder = QtCore.QDir(exportFolder)
     self.optExportMode = exportMode
     if not self.dExpFolder.exists():
         if not self.dExpFolder.mkpath("."):    # using dExpFolder.path() or exportFolder instead of "." creates a duplicate folder with the same name within the just created folder
             print("Error creating destination folder %(folderName)s!" % {'folderName' : self.dExpFolder.cleanPath(exportFolder)}) 
             return
     # create project file info objects
     fiPrjSource = QtCore.QFileInfo(self.prjFileName)
     fnam = self.dExpFolder.absolutePath() + QtCore.QDir.separator() + fiPrjSource.completeBaseName()
     if self.dExpFolder.absolutePath() == fiPrjSource.absolutePath():
         fnam += 'Export'
     if self.prjPacked and optCompress == CM_UNCOMPRESS:
         fnam += '.mmp'
     elif not self.prjPacked and optCompress == CM_COMPRESS:
         fnam += '.mmpz'
     else:
         fnam += '.' + fiPrjSource.suffix()
     fiPrjDest = QtCore.QFileInfo(fnam)
     # read project file into xml dom
     self.doc = QtXml.QDomDocument();
     if not self.doc.setContent(self.prjContent):
         print("Malformed XML within LMMS Project file %(fileDesc)s!" % {'fileDesc' : fiPrjSource.absoluteFilePath()}) 
         return
     # copy files of this extRef type and modify their external file paths within the xml doc object
     for extRef in self.extRefs:
         if extRef.usedBy.find('R') >= 0: 
             self.copyAndModifyExtFilePaths(extRef)
     # save changed content back to new project file
     pfile = QtCore.QFile(fiPrjDest.absoluteFilePath())
     if not pfile.open(QtCore.QIODevice.Truncate | QtCore.QIODevice.WriteOnly):
         print("Error opening LMMS Project export file %(fileDesc)s for writing!" % {'fileDesc' : pfile.fileName()}) 
     else:
         xml = self.doc.toByteArray()
         if (self.prjPacked and optCompress <> CM_UNCOMPRESS) or optCompress == CM_COMPRESS:
             xml = Qt.qCompress(xml)
         pfile.write(xml)
         pfile.close()
         if optVerbose:
             print("Created new LMMS Project file %(fileDesc)s." % {'fileDesc' : pfile.fileName()})   ##fiPrjDest.absoluteFilePath()})
コード例 #29
0
ファイル: top_block.py プロジェクト: m-alizadeh/gr-my_lte
def main(top_block_cls=top_block, options=None):
    if options is None:
        options, _ = argument_parser().parse_args()
    if gr.enable_realtime_scheduling() != gr.RT_OK:
        print "Error: failed to enable real-time scheduling."

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls(MCS=options.MCS, N_CCE=options.N_CCE, N_dl_prb=options.N_dl_prb, RB_start_UE_1=options.RB_start_UE_1, RB_start_UE_2=options.RB_start_UE_2, aggregation1=options.aggregation1, aggregation2=options.aggregation2, allocation_len_UE_1=options.allocation_len_UE_1, allocation_len_UE_2=options.allocation_len_UE_2, cfi_val=options.cfi_val, n_pdcch=options.n_pdcch)
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_()
コード例 #30
0
def oldToQImage(array):
    """Converts a numpy array to a QImage 
    A Python version of PyQt4.Qwt5.toQImage(array) in PyQwt < 5.2.
    Function written by Gerard Vermeulen 
    """
    if array.ndim != 2:
        raise RuntimeError('array must be 2-D')
    nx, ny = array.shape # width, height
    xstride, ystride = array.strides
    if array.dtype == numpy.uint8:
        image = Qt.QImage(nx, ny, Qt.QImage.Format_Indexed8)
        f_array = numpy.reshape(array,(nx*ny,),order='F')
        for j in xrange(ny):
            pointer = image.scanLine(j)
            pointer.setsize(nx*array.itemsize)
            memory = numpy.frombuffer(pointer, numpy.uint8)
            first_value = j*nx
            last_value = (j+1)*nx 
            memory[:] = f_array[first_value:last_value]
        image.setNumColors(256)
        for i in range(256):
            image.setColor(i, Qt.qRgb(i, i, i))
        return image
    elif array.dtype == numpy.uint32:
        image = Qt.QImage(
            array.tostring(), width, height, Qt.QImage.Format_ARGB32)
        f_array = numpy.reshape(array,(nx*ny,),order='F')
        for j in xrange(ny):
            pointer = image.scanLine(j)
            pointer.setsize(nx*array.itemsize)
            memory = numpy.frombuffer(pointer, numpy.uint32)
            first_value = j*nx
            last_value = (j+1)*nx 
            memory[:] = f_array[first_value:last_value]
        return image
    else:
        raise RuntimeError('array.dtype must be uint8 or uint32')
コード例 #31
0
ファイル: SDR_2_usrp.py プロジェクト: davidcandal/gr-tfg
 def set_Endpoint_src(self, Endpoint_src):
     self.Endpoint_src = Endpoint_src
     Qt.QMetaObject.invokeMethod(
         self._Endpoint_src_line_edit, "setText",
         Qt.Q_ARG("QString", str(self.Endpoint_src)))
     self.tfg_Aplication_0.setEndpointSrc(self.Endpoint_src)
コード例 #32
0
ファイル: SDR_2_usrp.py プロジェクト: davidcandal/gr-tfg
 def set_Endpoint_dst(self, Endpoint_dst):
     self.Endpoint_dst = Endpoint_dst
     Qt.QMetaObject.invokeMethod(
         self._Endpoint_dst_line_edit, "setText",
         Qt.Q_ARG("QString", str(self.Endpoint_dst)))
     self.tfg_Aplication_0.setEndpointDst(self.Endpoint_dst)
コード例 #33
0
ファイル: SDR_2_usrp.py プロジェクト: davidcandal/gr-tfg
 def set_label_nwk_dst(self, label_nwk_dst):
     self.label_nwk_dst = label_nwk_dst
     Qt.QMetaObject.invokeMethod(
         self._label_nwk_dst_label, "setText",
         Qt.Q_ARG("QString", str(self.label_nwk_dst)))
コード例 #34
0
            'exercitationem ullam corporis suscipit laboriosam, nisi ut '
            'aliquid ex ea commodi consequatur? Quis autem vel eum iure '
            'reprehenderit qui in ea voluptate velit esse quam nihil molestiae'
            ' consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla'
            ' pariatur?')
        message.add(paragraph)
        message.add(Message(
            Text('This shows how you can create '),
            ImportantText('content inline when you create a message'),
            ' ',
            EmphasizedText('including different styles and so on.')))

        dispatcher.send(
            signal=STATIC_MESSAGE_SIGNAL,
            sender=self,
            message=message)

        impact_function1 = ImpactFunction1()
        impact_function2 = ImpactFunction2()
        # Run some tasks that will spawn dynamic messages
        for i in range(1, 10):
            _ = i
            impact_function1.run()
            impact_function2.run()

if __name__ == '__main__':
    app = Qt.QApplication(sys.argv)
    dock = Dock()
    dock.run()
    sys.exit(app.exec_())
コード例 #35
0
ファイル: SDR_2_usrp.py プロジェクト: davidcandal/gr-tfg
 def set_clusterID(self, clusterID):
     self.clusterID = clusterID
     Qt.QMetaObject.invokeMethod(self._clusterID_line_edit, "setText",
                                 Qt.Q_ARG("QString", str(self.clusterID)))
     self.tfg_Aplication_0.setCluster(self.clusterID)
コード例 #36
0
ファイル: SDR_2_usrp.py プロジェクト: davidcandal/gr-tfg
 def set_cluster(self, cluster):
     self.cluster = cluster
     Qt.QMetaObject.invokeMethod(self._cluster_label, "setText",
                                 Qt.Q_ARG("QString", str(self.cluster)))
コード例 #37
0
    def __init__(self):
        gr.top_block.__init__(self, "Vector averaging and median comparison")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Vector averaging and median comparison")
        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", "vectordemo")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.variable_1 = variable_1 = 0
        self.variable_0 = variable_0 = 0
        self.samp_rate = samp_rate = 1e6
        self.fftsize = fftsize = 1024

        ##################################################
        # Blocks
        ##################################################
        self.radio_astro_ra_vmedian_0_0 = radio_astro.ra_vmedian(fftsize, 4)
        self.radio_astro_ra_vmedian_0 = radio_astro.ra_vmedian(fftsize, 4)
        self.radio_astro_ra_vave_0_0 = radio_astro.ra_vave(fftsize, 4)
        self.radio_astro_ra_vave_0 = radio_astro.ra_vave(fftsize, 4)
        self.qtgui_vector_sink_f_0 = qtgui.vector_sink_f(
            fftsize,
            0,
            1.0,
            "x-Axis",
            "y-Axis",
            "",
            3 # Number of inputs
        )
        self.qtgui_vector_sink_f_0.set_update_time(0.10)
        self.qtgui_vector_sink_f_0.set_y_axis(0, 150)
        self.qtgui_vector_sink_f_0.enable_autoscale(False)
        self.qtgui_vector_sink_f_0.enable_grid(True)
        self.qtgui_vector_sink_f_0.set_x_axis_units("")
        self.qtgui_vector_sink_f_0.set_y_axis_units("")
        self.qtgui_vector_sink_f_0.set_ref_level(0)
        
        labels = ['One in 4', 'Average', 'Median', '', '',
                  '', '', '', '', '']
        widths = [1, 2, 2, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["black", "blue", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(3):
            if len(labels[i]) == 0:
                self.qtgui_vector_sink_f_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_vector_sink_f_0.set_line_label(i, labels[i])
            self.qtgui_vector_sink_f_0.set_line_width(i, widths[i])
            self.qtgui_vector_sink_f_0.set_line_color(i, colors[i])
            self.qtgui_vector_sink_f_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_vector_sink_f_0_win = sip.wrapinstance(self.qtgui_vector_sink_f_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_vector_sink_f_0_win)
        self.fft_vxx_0 = fft.fft_vcc(fftsize, True, (window.blackmanharris(1024)), False, 1)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*fftsize, samp_rate,True)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fftsize)
        self.blocks_keep_one_in_n_0_0 = blocks.keep_one_in_n(gr.sizeof_float*fftsize, 4)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_float*fftsize, 4)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(fftsize)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blocks_add_const_vxx_0_1 = blocks.add_const_vff(([100.]*fftsize))
        self.blocks_add_const_vxx_0_0 = blocks.add_const_vff(([0.]*fftsize))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff(([50.]*fftsize))
        self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 2e5, .05, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 3e5, .1, 0)
        self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 2))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.blocks_add_const_vxx_0, 0), (self.qtgui_vector_sink_f_0, 1))    
        self.connect((self.blocks_add_const_vxx_0_0, 0), (self.qtgui_vector_sink_f_0, 2))    
        self.connect((self.blocks_add_const_vxx_0_1, 0), (self.qtgui_vector_sink_f_0, 0))    
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_stream_to_vector_0, 0))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_keep_one_in_n_0_0, 0))    
        self.connect((self.blocks_keep_one_in_n_0_0, 0), (self.blocks_add_const_vxx_0_1, 0))    
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_keep_one_in_n_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.radio_astro_ra_vave_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.radio_astro_ra_vmedian_0, 0))    
        self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.radio_astro_ra_vave_0, 0), (self.radio_astro_ra_vave_0_0, 0))    
        self.connect((self.radio_astro_ra_vave_0_0, 0), (self.blocks_add_const_vxx_0, 0))    
        self.connect((self.radio_astro_ra_vmedian_0, 0), (self.radio_astro_ra_vmedian_0_0, 0))    
        self.connect((self.radio_astro_ra_vmedian_0_0, 0), (self.blocks_add_const_vxx_0_0, 0))    
コード例 #38
0
ファイル: csma_80211_I.py プロジェクト: difdenk/gr-inets
    def __init__(self):
        gr.top_block.__init__(self, "csma_80211_I")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("csma_80211_I")
        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", "csma_80211_I")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.usrp_device_address = usrp_device_address = "addr=10.0.0.6"
        self.tx_center_frequency = tx_center_frequency = 3.9e8
        self.timeout_duration_ms = timeout_duration_ms = 1000
        self.system_time_granularity_us = system_time_granularity_us = 10
        self.source_address = source_address = 2
        self.samp_rate = samp_rate = 400000
        self.rx_gain = rx_gain = 0
        self.rx_center_frequency = rx_center_frequency = 3.9e8

        self.rrc = rrc = firdes.root_raised_cosine(1.0, sps, 1, 0.5, 11*sps)

        self.mu = mu = 0.6
        self.diff_preamble_128 = diff_preamble_128 = [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0,0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0,0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1,1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0][0:128]
        self.destination_address = destination_address = 1
        self.cs_threshold = cs_threshold = 0.005

        ##################################################
        # Blocks
        ##################################################
        self.inets_timeout_0 = inets.timeout(0, 10, 100, 1000, 0)
        self.inets_sending_0 = inets.sending(develop_mode=0, block_id=11, constellation=gnuradio.digital.constellation_qpsk().base(), preamble=diff_preamble_128, samp_rate=samp_rate, sps=sps, system_time_granularity_us=system_time_granularity_us, usrp_device_address=usrp_device_address, center_frequency=tx_center_frequency, interframe_interval_s=0.005, t_pretx_interval_s=0, file_name_extension_t_control="t1TXs", file_name_extension_pending="Tfr", record_on=0, name_with_timestamp=0, tx_gain=0)
        self.inets_run_0 = inets.run(5, 10)
        self.inets_resend_check_0 = inets.resend_check(0, 24, 6)
        self.inets_receiving_0 = inets.receiving(0, 21, gnuradio.digital.constellation_qpsk().base(), rrc, mu, diff_preamble_128, rx_gain, samp_rate, sps, 30, usrp_device_address, rx_center_frequency)
        self.inets_general_timer_0_1_0 = inets.general_timer(0, 3, 0, 8, 10, 0)
        self.inets_general_timer_0_1 = inets.general_timer(0, 3, 0, 18, 10, 0)
        self.inets_general_timer_0_0 = inets.general_timer(0, 1, 0, 1000000, 10, 0)
        self.inets_general_timer_0 = inets.general_timer(0, 3, 3, 100, 10, 0)
        self.inets_framing_0_0 = inets.framing(0, 17, 2, 1, 0, 1, destination_address, 1, source_address, 1, 318, 2, 524, 2, 2, 1, 1, 0, ([2, 3]), ([1000, 1000]), 2, 0, 300, 1)
        self.inets_framing_0 = inets.framing(0, 17, 1, 1, 0, 1, destination_address, 1, source_address, 1, 318, 2, 524, 2, 2, 1, 1, 0, ([2, 3]), ([1000, 1000]), 2, 0, 300, 1)
        self.inets_frame_type_check_0_0 = inets.frame_type_check(0, 25, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1)
        self.inets_frame_type_check_0 = inets.frame_type_check(0, 25, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1)
        self.inets_frame_path_1_0_1 = inets.frame_path(0, 39)
        self.inets_frame_path_1_0_0_0 = inets.frame_path(0, 39)
        self.inets_frame_path_1_0_0 = inets.frame_path(0, 39)
        self.inets_frame_path_1_0 = inets.frame_path(0, 39)
        self.inets_frame_path_1 = inets.frame_path(0, 39)
        self.inets_frame_check_0 = inets.frame_check(0, 9)
        self.inets_frame_buffer_1 = inets.frame_buffer(0, 16, 10, 1, 1, 1)
        self.inets_frame_buffer_0 = inets.frame_buffer(0, 16, 1000, 1, 1, 0)
        self.inets_frame_analysis_0 = inets.frame_analysis(0, 7, 1, 1, 1, 1, 1, 2, 2, 2, 1, source_address)
        self.inets_dummy_source_0 = inets.dummy_source(0, 23, 837, 3, 1)
        self.inets_counter_0 = inets.counter(1, 100, 1)
        self.inets_carrier_sensing_0 = inets.carrier_sensing(0, 11, 4, 100, 0.005, system_time_granularity_us, 100)
        self.inets_backoff_1 = inets.backoff(0, 11, 3, 10, 50, 100, 1, 0.005, 10, 1)
        self.inets_backoff_0 = inets.backoff(0, 11, 1, 5, 10, 400, 1, 0.005, 10, 1)
        self.inets_address_check_0 = inets.address_check(0, 17, source_address)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.inets_address_check_0, 'address_check_pass_out'), (self.inets_frame_type_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_backoff_0, 'frame_info_out'), (self.inets_resend_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_backoff_1, 'frame_info_out'), (self.inets_counter_0, 'message_in'))
        self.msg_connect((self.inets_backoff_1, 'frame_info_out'), (self.inets_frame_buffer_0, 'dequeue'))
        self.msg_connect((self.inets_carrier_sensing_0, 'frame_info_fail_out'), (self.inets_backoff_0, 'frame_info_in'))
        self.msg_connect((self.inets_carrier_sensing_0, 'frame_info_pass_out'), (self.inets_frame_buffer_1, 'enqueue'))
        self.msg_connect((self.inets_dummy_source_0, 'output'), (self.inets_framing_0, 'data_in'))
        self.msg_connect((self.inets_frame_analysis_0, 'frame_info_out'), (self.inets_frame_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_buffer_0, 'dequeue_element'), (self.inets_frame_path_1_0, 'frame_in'))
        self.msg_connect((self.inets_frame_buffer_1, 'dequeue_element'), (self.inets_sending_0, 'in'))
        self.msg_connect((self.inets_frame_check_0, 'good_frame_info_out'), (self.inets_address_check_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_path_1, 'frame_out'), (self.inets_general_timer_0, 'active_in'))
        self.msg_connect((self.inets_frame_path_1_0, 'frame_out'), (self.inets_carrier_sensing_0, 'info_in'))
        self.msg_connect((self.inets_frame_path_1_0, 'frame_out'), (self.inets_general_timer_0_1, 'active_in'))
        self.msg_connect((self.inets_frame_path_1_0_0, 'frame_out'), (self.inets_frame_buffer_1, 'enqueue'))
        self.msg_connect((self.inets_frame_path_1_0_0_0, 'frame_out'), (self.inets_frame_buffer_1, 'dequeue'))
        self.msg_connect((self.inets_frame_path_1_0_1, 'frame_out'), (self.inets_backoff_0, 'frame_info_in'))
        self.msg_connect((self.inets_frame_type_check_0, 'data_frame_info_out'), (self.inets_framing_0_0, 'data_in'))
        self.msg_connect((self.inets_frame_type_check_0, 'ack_frame_info_out'), (self.inets_timeout_0, 'ack_frame_info_in'))
        self.msg_connect((self.inets_frame_type_check_0_0, 'ack_frame_info_out'), (self.inets_backoff_1, 'frame_info_in'))
        self.msg_connect((self.inets_frame_type_check_0_0, 'data_frame_info_out'), (self.inets_frame_path_1_0_1, 'frame_in'))
        self.msg_connect((self.inets_framing_0, 'frame_out'), (self.inets_frame_buffer_0, 'enqueue'))
        self.msg_connect((self.inets_framing_0_0, 'frame_out'), (self.inets_general_timer_0_1_0, 'active_in'))
        self.msg_connect((self.inets_general_timer_0, 'expire_signal_out'), (self.inets_dummy_source_0, 'trigger'))
        self.msg_connect((self.inets_general_timer_0, 'expire_signal_out'), (self.inets_frame_path_1, 'frame_in'))
        self.msg_connect((self.inets_general_timer_0_0, 'expire_signal_out'), (self.inets_general_timer_0, 'disable_timer_in'))
        self.msg_connect((self.inets_general_timer_0_1, 'expire_signal_out'), (self.inets_carrier_sensing_0, 'stop_in'))
        self.msg_connect((self.inets_general_timer_0_1_0, 'expire_signal_out'), (self.inets_frame_path_1_0_0, 'frame_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_power_out'), (self.inets_carrier_sensing_0, 'power_in'))
        self.msg_connect((self.inets_receiving_0, 'rx_frame_out'), (self.inets_frame_analysis_0, 'frame_in'))
        self.msg_connect((self.inets_resend_check_0, 'resend_check_fail_out'), (self.inets_frame_buffer_0, 'dequeue'))
        self.msg_connect((self.inets_resend_check_0, 'resend_check_pass_out'), (self.inets_frame_path_1_0, 'frame_in'))
        self.msg_connect((self.inets_run_0, 'trigger_out'), (self.inets_general_timer_0, 'active_in'))
        self.msg_connect((self.inets_run_0, 'trigger_out'), (self.inets_general_timer_0_0, 'active_in'))
        self.msg_connect((self.inets_sending_0, 'rx_control_out'), (self.inets_frame_path_1_0_0_0, 'frame_in'))
        self.msg_connect((self.inets_sending_0, 'data_frame_out'), (self.inets_timeout_0, 'data_frame_info_in'))
        self.msg_connect((self.inets_timeout_0, 'frame_info_out'), (self.inets_frame_type_check_0_0, 'frame_info_in'))
コード例 #39
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()

        # create buttons
        self.buttonQPSK = Qt.QPushButton('QPSK Gen', self.top_widget)
        self.buttonQPSK.clicked.connect(self.handle_QPSK)

        self.buttonBPSK = Qt.QPushButton('BPSK Gen', self.top_widget)
        self.buttonBPSK.clicked.connect(self.handle_BPSK)

        self.buttonQAM16 = Qt.QPushButton('QAM16 Gen', self.top_widget)
        self.buttonQAM16.clicked.connect(self.handle_QAM16)

        self.buttonQAM64 = Qt.QPushButton('QAM64 Gen', self.top_widget)
        self.buttonQAM64.clicked.connect(self.handle_QAM64)

        self.button8PSK = Qt.QPushButton('8PSK Gen', self.top_widget)
        self.button8PSK.clicked.connect(self.handle_8PSK)

        self.buttonPAM4 = Qt.QPushButton('PAM4 Gen', self.top_widget)
        self.buttonPAM4.clicked.connect(self.handle_PAM4)

        self.buttonAMDSB = Qt.QPushButton('AMDSB Gen', self.top_widget)
        self.buttonAMDSB.clicked.connect(self.handle_AMBDSB)

        self.buttonCPFSK = Qt.QPushButton('CPFSK Gen', self.top_widget)
        self.buttonCPFSK.clicked.connect(self.handle_CPFSK)

        self.buttonGFSK = Qt.QPushButton('GFSK Gen', self.top_widget)
        self.buttonGFSK.clicked.connect(self.handle_GFSK)

        self.buttonAMSSB = Qt.QPushButton('AMSSB Gen', self.top_widget)
        self.buttonAMSSB.clicked.connect(self.handle_AMSSB)

        self.buttonWBFM = Qt.QPushButton('WBFM Gen', self.top_widget)
        self.buttonWBFM.clicked.connect(self.handle_WBFM)

        self.statusLabel = Qt.QLabel("Status: ", self.top_widget)

        # create SNR slider
        self.SNRSlider = Qt.QSlider(1, self.top_widget)
        self.SNRSlider.setTickPosition(Qt.QSlider.TicksBelow)
        self.SNRSlider.setMinimum(-20)
        self.SNRSlider.setMaximum(20)
        self.SNRSlider.setSingleStep(2)
        self.SNRLabel = Qt.QLabel("SNR: -20:20 dB", self.top_widget)

        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)

        self.top_grid_layout = Qt.QGridLayout()

        # add buttons to container
        self.top_grid_layout.addWidget(self.buttonQPSK, 0, 0)
        self.top_grid_layout.addWidget(self.buttonBPSK, 0, 1)
        self.top_grid_layout.addWidget(self.buttonQAM16, 0, 2)
        self.top_grid_layout.addWidget(self.button8PSK, 1, 0)
        self.top_grid_layout.addWidget(self.buttonPAM4, 1, 1)
        self.top_grid_layout.addWidget(self.buttonQAM64, 1, 2)
        self.top_grid_layout.addWidget(self.buttonGFSK, 2, 0)
        self.top_grid_layout.addWidget(self.buttonAMSSB, 2, 1)
        self.top_grid_layout.addWidget(self.buttonWBFM, 2, 2)
        self.top_grid_layout.addWidget(self.buttonCPFSK, 3, 0)
        self.top_grid_layout.addWidget(self.buttonAMDSB, 3, 1)
        self.top_layout.addWidget(self.statusLabel)
        self.top_layout.addWidget(self.SNRLabel)
        self.top_layout.addWidget(self.SNRSlider)

        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 800e3

        ##################################################
        # Blocks
        ##################################################

        ##################################
        # Freq sink block
        ##################################
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            512,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(True)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(0.1)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)

        ##################################
        # Noise model block
        ##################################
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=10**(-20 / 10),
            frequency_offset=0.0,
            epsilon=1.0,  # 1 means no difference
            taps=(1.0 + 1.0j, ),  # taps=(0,), 
            noise_seed=0,
            block_tags=False)

        ##################################
        # Null sink block
        ##################################
        #self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*2)

        #self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 250e3, 1, 0)

        ##################################
        # Initial modulator block
        ##################################
        self.channel_prop = {
            'sample_rate': self.samp_rate,  # Input sample rate in Hz
            'sro_std_dev':
            0.01,  # sample rate drift process standard deviation per sample in Hz
            'sro_max_dev': 50,  # maximum sample rate offset in Hz
            'cfo_std_dev':
            0.01,  # carrier frequnecy drift process standard deviation per sample in Hz
            'cfo_max_dev': 500,  # maximum carrier frequency offset in Hz
            'N_sinusoids':
            8,  # number of sinusoids used in frequency selective fading simulation
            'fD': 1,  # doppler frequency
            'LOS_model':
            True,  # defines whether the fading model should include a line of site component. LOS->Rician, NLOS->Rayleigh
            'K_factor':
            4,  # Rician K-factor, the ratio of specular to diffuse power in the model
            'delays': [
                0.0, 0.9, 1.7
            ],  # A list of fractional sample delays making up the power delay profile
            'mags': [
                1, 0.8, 0.3
            ],  # A list of magnitudes corresponding to each delay time in the power delay profile
            'ntaps':
            8,  # The length of the filter to interpolate the power delay profile over. Delays in the PDP must lie between 0 and ntaps_mpath, fractional delays will be sinc-interpolated only to the width of this filter.
            'snr': 20
        }

        src, mod, chan = gen_gfsk(self.channel_prop)

        src = self.create_rand_block('digital')

        self.blocks_head_0 = blocks.head(gr.sizeof_gr_complex * 1, 2048 * 10)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1,
                                                   "offline/gfsk.dat", False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        # self.connect((src, 0), (mod, 0), (self.channels_channel_model_0, 0))
        # self.connect((self.channels_channel_model_0, 0),  (self.qtgui_freq_sink_x_0, 0))
        # self.connect((self.channels_channel_model_0, 0), (self.uhd_usrp_sink_0, 0))

        self.connect((src, 0), (mod, 0))
        self.connect((mod, 0), (self.qtgui_freq_sink_x_0, 0))
        self.connect((mod, 0), (self.blocks_head_0, 0))
        self.connect((self.blocks_head_0, 0), (self.blocks_file_sink_0, 0))
コード例 #40
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1000000
        self.center_fre_ch2 = center_fre_ch2 = 2429000000
        self.center_fre = center_fre = 2437000000
        self.file2 = file2 = "/home/ite367/Documents/traffic_data/" + "Home_CH" + str(
            center_fre_ch2) + "at" + str(datetime.datetime.now().hour) + str(
                datetime.datetime.now().minute) + ".txt"
        self.file1 = file1 = "/home/ite367/Documents/traffic_data/" + "Home_CH" + str(
            center_fre) + "at" + str(datetime.datetime.now().hour) + str(
                datetime.datetime.now().minute) + ".txt"

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join(("", "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(2),
            ),
        )
        self.uhd_usrp_source_0.set_subdev_spec('A:A A:B', 0)
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(center_fre, 0)
        self.uhd_usrp_source_0.set_gain(80, 0)
        self.uhd_usrp_source_0.set_antenna('RX2', 0)
        self.uhd_usrp_source_0.set_center_freq(center_fre_ch2, 1)
        self.uhd_usrp_source_0.set_gain(80, 1)
        self.uhd_usrp_source_0.set_antenna('RX2', 1)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            102400,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-5, 2)

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

        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                    qtgui.TRIG_SLOPE_POS, 0.0,
                                                    0, 0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            102400,  #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(-5, 2)

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

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.blocks_nlog10_ff_0_0 = blocks.nlog10_ff(1, 1, 0)
        self.blocks_nlog10_ff_0 = blocks.nlog10_ff(1, 1, 0)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_moving_average_xx_0_0 = blocks.moving_average_ff(
            40, 1, 4000, 1)
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(
            40, 1, 4000, 1)
        self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_float * 1,
                                                     file2, False)
        self.blocks_file_sink_0_0.set_unbuffered(False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float * 1, file1,
                                                   False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_conjugate_cc_0_0 = blocks.conjugate_cc()
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_moving_average_xx_0, 0))
        self.connect((self.blocks_complex_to_real_0_0, 0),
                     (self.blocks_moving_average_xx_0_0, 0))
        self.connect((self.blocks_conjugate_cc_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_conjugate_cc_0_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_moving_average_xx_0, 0),
                     (self.blocks_nlog10_ff_0, 0))
        self.connect((self.blocks_moving_average_xx_0_0, 0),
                     (self.blocks_nlog10_ff_0_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.blocks_complex_to_real_0_0, 0))
        self.connect((self.blocks_nlog10_ff_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_nlog10_ff_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_nlog10_ff_0_0, 0),
                     (self.blocks_file_sink_0_0, 0))
        self.connect((self.blocks_nlog10_ff_0_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.blocks_conjugate_cc_0, 0))
        self.connect((self.uhd_usrp_source_0, 1),
                     (self.blocks_conjugate_cc_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.uhd_usrp_source_0, 1),
                     (self.blocks_multiply_xx_0_0, 0))
コード例 #41
0
ファイル: top_block.py プロジェクト: Leostayner/Brunardo
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 45
        self.nfilts = nfilts = 25
        self.sps_slider = sps_slider = 45
        self.samp_rate_0 = samp_rate_0 = 44.1E3
        self.samp_rate = samp_rate = 32000
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), 0.35, 45*nfilts)
        self.fc_slider = fc_slider = 2200
        self.BPSK = BPSK = digital.constellation_calcdist(([-1, 1]), ([0, 1]), 4, 1).base()
        self.A_slider = A_slider = 1

        ##################################################
        # Blocks
        ##################################################
        self._sps_slider_range = Range(0, 100, 5, 45, 200)
        self._sps_slider_win = RangeWidget(self._sps_slider_range, self.set_sps_slider, "sps", "counter_slider", float)
        self.top_layout.addWidget(self._sps_slider_win)
        self._fc_slider_range = Range(0, 18200, 200, 2200, 150)
        self._fc_slider_win = RangeWidget(self._fc_slider_range, self.set_fc_slider, "fc", "counter_slider", float)
        self.top_layout.addWidget(self._fc_slider_win)
        self._A_slider_range = Range(0, 20, 1, 1, 200)
        self._A_slider_win = RangeWidget(self._A_slider_range, self.set_A_slider, "A", "counter_slider", int)
        self.top_layout.addWidget(self._A_slider_win)
        self.qtgui_time_sink_x_1 = qtgui.time_sink_c(
        	1024, #size
        	samp_rate, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1.set_y_axis(-2, 2)
        
        self.qtgui_time_sink_x_1.set_y_label("Amplitude", "")
        
        self.qtgui_time_sink_x_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_1.enable_autoscale(False)
        self.qtgui_time_sink_x_1.enable_grid(False)
        self.qtgui_time_sink_x_1.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_1.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(2*1):
            if len(labels[i]) == 0:
                if(i % 2 == 0):
                    self.qtgui_time_sink_x_1.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_1.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            else:
                self.qtgui_time_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_1_win = sip.wrapinstance(self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	1024, #size
        	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(-2, 2)
        
        self.qtgui_time_sink_x_0.set_y_label("Amplitude", "")
        
        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_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_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(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_freq_sink_x_1 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_1.enable_grid(False)
        self.qtgui_freq_sink_x_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_1.enable_control_panel(False)
        
        if not True:
          self.qtgui_freq_sink_x_1.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_1.set_plot_pos_half(not True)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_1_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_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_control_panel(False)
        
        if not True:
          self.qtgui_freq_sink_x_0.disable_legend()
        
        if "float" == "float" or "float" == "msg_float":
          self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
        	1024, #size
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0.enable_grid(False)
        
        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.digital_constellation_modulator_0 = digital.generic_mod(
          constellation=BPSK,
          differential=True,
          samples_per_symbol=sps_slider,
          pre_diff_code=True,
          excess_bw=0.25,
          verbose=False,
          log=False,
          )
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_real_1 = blocks.complex_to_real(1)
        self.blks2_tcp_source_0 = grc_blks2.tcp_source(
        	itemsize=gr.sizeof_char*1,
        	addr="127.0.0.1",
        	port=1240,
        	server=True,
        )
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=False,
        	),
        	payload_length=1,
        )
        self.audio_sink_0 = audio.sink(44100, "", True)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, fc_slider, A_slider, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_constellation_modulator_0, 0))    
        self.connect((self.blks2_tcp_source_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.blocks_complex_to_real_1, 0), (self.audio_sink_0, 0))    
        self.connect((self.blocks_complex_to_real_1, 0), (self.qtgui_freq_sink_x_0, 0))    
        self.connect((self.blocks_complex_to_real_1, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_real_1, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.qtgui_const_sink_x_0, 0))    
        self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.digital_constellation_modulator_0, 0), (self.qtgui_freq_sink_x_1, 0))    
        self.connect((self.digital_constellation_modulator_0, 0), (self.qtgui_time_sink_x_1, 0))    
コード例 #42
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.time_preamble = time_preamble = [
            0.125000 + 0.000000j, 0.522104 - 0.148216j, -0.495528 + 0.114832j,
            -0.267916 + 0.091700j, 0.236544 - 0.138456j, -0.098500 + 0.473800j,
            0.476480 - 0.225344j, -0.187516 + 0.035372j, 0.051776 - 0.353552j,
            -0.104936 + 0.059916j, 0.228684 + 0.117504j, -0.530912 + 0.560756j,
            0.359128 + 0.015872j, -0.132852 + 0.632840j, -0.105164 - 0.368872j,
            0.368272 - 0.032412j, 0.125000 + 0.750000j, 0.463968 + 0.457792j,
            0.151476 - 0.430948j, 0.685052 + 0.238524j, 0.494428 + 0.119428j,
            -0.557540 - 0.050056j, 0.416348 + 0.017368j, 0.104256 - 0.568836j,
            -0.301776 - 0.353552j, 0.079812 + 0.451516j, 0.439152 + 0.528072j,
            0.642060 + 0.178484j, -0.090096 + 0.465096j, -0.446492 + 0.305776j,
            -0.111440 - 0.093688j, -0.538848 - 0.320228j, 0.125000 + 0.000000j,
            -0.538848 + 0.320228j, -0.111440 + 0.093688j,
            -0.446492 - 0.305776j, -0.090096 - 0.465096j, 0.642060 - 0.178484j,
            0.439152 - 0.528072j, 0.079812 - 0.451516j, -0.301776 + 0.353552j,
            0.104256 + 0.568836j, 0.416348 - 0.017368j, -0.557540 + 0.050056j,
            0.494428 - 0.119428j, 0.685052 - 0.238524j, 0.151476 + 0.430948j,
            0.463968 - 0.457792j, 0.125000 - 0.750000j, 0.368272 + 0.032412j,
            -0.105164 + 0.368872j, -0.132852 - 0.632840j, 0.359128 - 0.015872j,
            -0.530912 - 0.560756j, 0.228684 - 0.117504j, -0.104936 - 0.059916j,
            0.051776 + 0.353552j, -0.187516 - 0.035372j, 0.476480 + 0.225344j,
            -0.098500 - 0.473800j, 0.236544 + 0.138456j, -0.267916 - 0.091700j,
            -0.495528 - 0.114832j, 0.522104 + 0.148216j
        ]
        self.samp_rate = samp_rate = 2000000
        self.preamble_len = preamble_len = 64
        self.padding = padding = 12
        self.packet_len = packet_len = 1024 * 4
        self.length = length = 96
        self.gain = gain = 0.6850
        self.freq = freq = 3550e6

        ##################################################
        # Blocks
        ##################################################
        self._gain_range = Range(0, 1, 0.001, 0.6850, 200)
        self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain",
                                     "counter_slider", float)
        self.top_layout.addWidget(self._gain_win)
        self.uhd_usrp_sink_0_0 = uhd.usrp_sink(
            ",".join(("", "serial= 30C6272")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0_0.set_subdev_spec("A:A", 0)
        self.uhd_usrp_sink_0_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0_0.set_center_freq(freq, 0)
        self.uhd_usrp_sink_0_0.set_normalized_gain(gain, 0)
        self.uhd_usrp_sink_0_0.set_antenna("TX/RX", 0)
        self.qtgui_freq_sink_x_0_1 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Virtual spectrum 2 at Tx",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_1.set_y_axis(-95, -25)
        self.qtgui_freq_sink_x_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0,
                                                    0, "")
        self.qtgui_freq_sink_x_0_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_1.enable_grid(False)
        self.qtgui_freq_sink_x_0_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_1.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_1.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0_1.set_plot_pos_half(not True)

        labels = ["MySVL Tx", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_1.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_1_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_1_win, 2, 1,
                                       1, 1)
        self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Real Spectrum at the Transmitter",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0.set_y_axis(-95, -25)
        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(False)
        self.qtgui_freq_sink_x_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True)

        labels = ["MySVL Tx", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_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, 3, 0,
                                       1, 2)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Virtual spectrum 1 at Tx",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-95, -25)
        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_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ["MySVL Tx", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 2, 0, 1,
                                       1)
        self.mysvl_svl_0 = mysvl.svl(
            gr.sizeof_gr_complex * 1, 1,
            "/home/jonathan/Dropbox/repos/gr-mysvl/demo/inputs/maps/demo1b_tx.txt",
            "/home/jonathan/Dropbox/repos/gr-mysvl/demo/inputs/params/demo1b_tx.txt"
        )
        self.mysvl_stream_demux_0 = mysvl.stream_demux(
            gr.sizeof_gr_complex * 1, (1, packet_len - 2, 1), False)
        self.low_pass_filter_1_0 = filter.interp_fir_filter_ccf(
            4,
            firdes.low_pass(1, samp_rate, samp_rate / 8 - samp_rate / 32,
                            samp_rate / 32, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_0 = filter.interp_fir_filter_ccf(
            1,
            firdes.low_pass(1, samp_rate, samp_rate / 2 - samp_rate / 32,
                            samp_rate / 32, firdes.WIN_HAMMING, 6.76))
        self.foo_packet_pad_0_0 = foo.packet_pad(False, False, 0.001, 1000, 0)
        self.foo_burst_tagger_0_0 = foo.burst_tagger(pmt.intern("len"), 1)
        self.digital_ofdm_tx_0 = digital.ofdm_tx(
            fft_len=64,
            cp_len=16,
            packet_length_tag_key="length",
            bps_header=1,
            bps_payload=1,
            rolloff=0,
            debug_log=False,
            scramble_bits=False)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=2,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.blocks_vector_source_x_0 = blocks.vector_source_c(
            time_preamble, True, 1, [])
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_char * 1,
                                                     "127.0.0.1", 3000, 1472,
                                                     True)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(
            gr.sizeof_char, 1, length, "length")
        self.blocks_stream_mux_1 = blocks.stream_mux(
            gr.sizeof_gr_complex * 1,
            (padding + 1, packet_len - 2, padding + 1))
        self.blocks_stream_mux_0 = blocks.stream_mux(
            gr.sizeof_gr_complex * 1, (preamble_len, packet_len + padding * 2))
        self.blocks_repeat_0_0 = blocks.repeat(gr.sizeof_gr_complex * 1,
                                               padding + 1)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1,
                                             padding + 1)
        self.blocks_multiply_const_vxx_0_0_0 = blocks.multiply_const_vcc(
            (0.3, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.025, ))
        self.blocks_file_source_0_0_1 = blocks.file_source(
            gr.sizeof_char * 1,
            "/home/jonathan/Dropbox/repos/gr-mysvl/examples/inputs/Memory_and_Forgetting.mp3",
            True)
        self.blks2_packet_encoder_1 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=1,
                preamble="",
                access_code="",
                pad_for_usrp=False,
            ),
            payload_length=0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_1, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_file_source_0_0_1, 0),
                     (self.blks2_packet_encoder_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_0, 0),
                     (self.low_pass_filter_1_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.blocks_stream_mux_1, 2))
        self.connect((self.blocks_repeat_0_0, 0),
                     (self.blocks_stream_mux_1, 0))
        self.connect((self.blocks_stream_mux_0, 0),
                     (self.qtgui_freq_sink_x_0_0, 0))
        self.connect((self.blocks_stream_mux_0, 0),
                     (self.uhd_usrp_sink_0_0, 0))
        self.connect((self.blocks_stream_mux_1, 0),
                     (self.blocks_stream_mux_0, 1))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.digital_ofdm_tx_0, 0))
        self.connect((self.blocks_udp_source_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blocks_stream_mux_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0_0_0, 0))
        self.connect((self.digital_ofdm_tx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.foo_burst_tagger_0_0, 0),
                     (self.foo_packet_pad_0_0, 0))
        self.connect((self.foo_packet_pad_0_0, 0), (self.mysvl_svl_0, 1))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.foo_burst_tagger_0_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.low_pass_filter_1_0, 0), (self.mysvl_svl_0, 0))
        self.connect((self.low_pass_filter_1_0, 0),
                     (self.qtgui_freq_sink_x_0_1, 0))
        self.connect((self.mysvl_stream_demux_0, 2), (self.blocks_repeat_0, 0))
        self.connect((self.mysvl_stream_demux_0, 0),
                     (self.blocks_repeat_0_0, 0))
        self.connect((self.mysvl_stream_demux_0, 1),
                     (self.blocks_stream_mux_1, 1))
        self.connect((self.mysvl_svl_0, 0), (self.mysvl_stream_demux_0, 0))
コード例 #43
0
ファイル: alice.py プロジェクト: andrehoracio97/investigacao
    def __init__(self, puncpat='11'):
        gr.top_block.__init__(self, "Alice")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Alice")
        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", "alice")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.puncpat = puncpat

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.samp_rate_array_MCR = samp_rate_array_MCR = [
            7500000, 5000000, 3750000, 3000000, 2500000, 2000000, 1500000,
            1000000, 937500, 882352, 833333, 714285, 533333, 500000, 421052,
            400000, 380952, 200000, 100000, 50000
        ]
        self.punc_sizes = punc_sizes = [11, 20, 22, 25, 44, 50, 55]
        self.punc_patterns = punc_patterns = [
            2046, 1048574, 4194302, 33554430, 17592186044414, 1125899906842622,
            36028797018963966
        ]
        self.nfilts = nfilts = 32
        self.index = index = 0
        self.headers = headers = [
            [
                0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x1, 0x1,
                0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0,
                0x1, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x1,
                0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1,
                0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x1,
                0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0,
                0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1,
                0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
            ],
            [
                0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0,
                0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
                0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1,
                0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x1,
                0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
                0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0,
                0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
            ],
            [
                0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x0,
                0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0,
                0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1,
                0x0, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0,
                0x0, 0x1, 0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x1,
                0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0,
                0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0,
                0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
            ],
            [
                0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1,
                0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1,
                0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0,
                0x1, 0x1, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0,
                0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x1,
                0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0,
                0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1,
                0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
            ],
            [
                0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                0x1, 0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1, 0x1, 0x0,
                0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0,
                0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0,
                0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x1,
                0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0,
                0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1,
                0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
            ],
            [
                0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                0x1, 0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1, 0x1, 0x0,
                0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0,
                0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0,
                0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x1,
                0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0,
                0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1,
                0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
            ],
            [
                0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1,
                0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0,
                0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x0,
                0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x0, 0x0, 0x1,
                0x0, 0x1, 0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x1,
                0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1,
                0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0,
                0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1,
                0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
            ]
        ]
        self.erros = erros = [100, 55, 50, 44, 25, 22, 20]
        self.eb = eb = 0.22
        self.H = H = fec.ldpc_H_matrix(
            '/usr/local/share/gnuradio/fec/ldpc/n_1100_k_0442_gap_24.alist',
            24)
        self.vector = vector = [
            int(random.random() * 4) for i in range(396800)
        ]
        self.variable_qtgui_range_0_0 = variable_qtgui_range_0_0 = 55

        self.tx_rrc_taps = tx_rrc_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0, eb, 11 * sps * nfilts)

        self.samp_rate = samp_rate = samp_rate_array_MCR[15]
        self.punc_size = punc_size = punc_sizes[index]
        self.punc_pattern = punc_pattern = punc_patterns[index]

        self.pld_enc = pld_enc = map(
            (lambda a: fec.ldpc_par_mtrx_encoder_make_H(H)), range(0, 4))
        self.pld_const = pld_const = digital.constellation_rect(([
            0.707 + 0.707j, -0.707 + 0.707j, -0.707 - 0.707j, 0.707 - 0.707j
        ]), ([0, 1, 2, 3]), 4, 2, 2, 1, 1).base()
        self.pld_const.gen_soft_dec_lut(8)
        self.header = header = headers[index]
        self.frequencia_usrp = frequencia_usrp = 24e8
        self.erro = erro = erros[index]
        self.MCR = MCR = "master_clock_rate=60e6"

        ##################################################
        # Blocks
        ##################################################
        self._variable_qtgui_range_0_0_range = Range(0, 90, 1, 55, 200)
        self._variable_qtgui_range_0_0_win = RangeWidget(
            self._variable_qtgui_range_0_0_range,
            self.set_variable_qtgui_range_0_0, 'Gain_TX', "counter_slider",
            float)
        self.top_grid_layout.addWidget(self._variable_qtgui_range_0_0_win, 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.uhd_usrp_sink_0_0 = uhd.usrp_sink(
            ",".join(("serial=F5EAE1", MCR)),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0_0.set_time_now(uhd.time_spec(time.time()),
                                            uhd.ALL_MBOARDS)
        self.uhd_usrp_sink_0_0.set_center_freq(frequencia_usrp, 0)
        self.uhd_usrp_sink_0_0.set_gain(variable_qtgui_range_0_0, 0)
        self.uhd_usrp_sink_0_0.set_antenna('TX/RX', 0)
        self.scrambler_cpp_additive_scrambler_0 = scrambler_cpp.additive_scrambler(
            0x8A, 0x7F, 7, 440 - 8)
        self.qtgui_time_sink_x_1 = qtgui.time_sink_c(
            1024,  #size
            samp_rate,  #samp_rate
            "TX USRP",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1.set_y_axis(-1, 1)

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

        self.qtgui_time_sink_x_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_1.enable_autoscale(False)
        self.qtgui_time_sink_x_1.enable_grid(False)
        self.qtgui_time_sink_x_1.enable_axis_labels(True)
        self.qtgui_time_sink_x_1.enable_control_panel(False)
        self.qtgui_time_sink_x_1.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_1.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2):
            if len(labels[i]) == 0:
                if (i % 2 == 0):
                    self.qtgui_time_sink_x_1.set_line_label(
                        i, "Re{{Data {0}}}".format(i / 2))
                else:
                    self.qtgui_time_sink_x_1.set_line_label(
                        i, "Im{{Data {0}}}".format(i / 2))
            else:
                self.qtgui_time_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_1_win, 1, 3, 1,
                                       1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(3, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 0, 3, 1,
                                       1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(3, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_const_sink_x_0_0_0_0 = qtgui.const_sink_c(
            1024,  #size
            "TX Const",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0_0_0_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0_0_0_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0_0_0_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
        self.qtgui_const_sink_x_0_0_0_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0_0_0_0.enable_grid(False)
        self.qtgui_const_sink_x_0_0_0_0.enable_axis_labels(True)

        if not True:
            self.qtgui_const_sink_x_0_0_0_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "red", "red", "red", "red", "red", "red", "red",
            "red"
        ]
        styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_0_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_0_0_0_0.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_0_0_0_0.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_0_0_0_0.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_0_0_0_0.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_0_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_0_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_const_sink_x_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_0_0_0_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.puncture64_cpp_puncture64_0 = puncture64_cpp.puncture64(
            punc_size, punc_pattern)
        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(
            sps, taps=(tx_rrc_taps), flt_size=nfilts)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.insert_vec_cpp_new_vec_0 = insert_vec_cpp.new_vec((vector))
        self.fec_extended_encoder_0 = fec.extended_encoder(
            encoder_obj_list=pld_enc, threading='capillary', puncpat=puncpat)
        self.digital_diff_encoder_bb_0 = digital.diff_encoder_bb(
            pld_const.arity())
        self.digital_chunks_to_symbols_xx_0_0 = digital.chunks_to_symbols_bc(
            (pld_const.points()), 1)
        self.blocks_vector_source_x_0_1 = blocks.vector_source_b(
            header, True, 1, [])
        self.blocks_vector_source_x_0_0 = blocks.vector_source_b([0], True, 1,
                                                                 [])
        self.blocks_stream_mux_0_1_0_0 = blocks.stream_mux(
            gr.sizeof_char * 1, (155, 1100 - erro))
        self.blocks_stream_mux_0_0 = blocks.stream_mux(gr.sizeof_char * 1,
                                                       (440, 2))
        self.blocks_repack_bits_bb_1_0_0_1 = blocks.repack_bits_bb(
            8, 1, '', False, gr.GR_MSB_FIRST)
        self.blocks_repack_bits_bb_1_0_0_0 = blocks.repack_bits_bb(
            1, pld_const.bits_per_symbol(), '', False, gr.GR_MSB_FIRST)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0.7, ))
        self.blocks_file_source_0_0_1_0_0_0_1 = blocks.file_source(
            gr.sizeof_char * 1, '/home/andre/ELI/sequence54_8000.txt', False)
        self.blocks_file_source_0_0_1_0_0_0_1.set_begin_tag(pmt.PMT_NIL)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0_0_1_0_0_0_1, 0),
                     (self.blocks_repack_bits_bb_1_0_0_1, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.qtgui_const_sink_x_0_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.qtgui_time_sink_x_1, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.uhd_usrp_sink_0_0, 0))
        self.connect((self.blocks_repack_bits_bb_1_0_0_0, 0),
                     (self.insert_vec_cpp_new_vec_0, 0))
        self.connect((self.blocks_repack_bits_bb_1_0_0_1, 0),
                     (self.scrambler_cpp_additive_scrambler_0, 0))
        self.connect((self.blocks_stream_mux_0_0, 0),
                     (self.fec_extended_encoder_0, 0))
        self.connect((self.blocks_stream_mux_0_1_0_0, 0),
                     (self.blocks_repack_bits_bb_1_0_0_0, 0))
        self.connect((self.blocks_vector_source_x_0_0, 0),
                     (self.blocks_stream_mux_0_0, 1))
        self.connect((self.blocks_vector_source_x_0_1, 0),
                     (self.blocks_stream_mux_0_1_0_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0_0, 0),
                     (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.digital_diff_encoder_bb_0, 0),
                     (self.digital_chunks_to_symbols_xx_0_0, 0))
        self.connect((self.fec_extended_encoder_0, 0),
                     (self.puncture64_cpp_puncture64_0, 0))
        self.connect((self.insert_vec_cpp_new_vec_0, 0),
                     (self.digital_diff_encoder_bb_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.puncture64_cpp_puncture64_0, 0),
                     (self.blocks_stream_mux_0_1_0_0, 1))
        self.connect((self.scrambler_cpp_additive_scrambler_0, 0),
                     (self.blocks_stream_mux_0_0, 0))
コード例 #44
0
ファイル: SDR_2_usrp.py プロジェクト: davidcandal/gr-tfg
 def set_NWK_add_dst(self, NWK_add_dst):
     self.NWK_add_dst = NWK_add_dst
     Qt.QMetaObject.invokeMethod(self._NWK_add_dst_line_edit, "setText",
                                 Qt.Q_ARG("QString", str(self.NWK_add_dst)))
     self.tfg_Aplication_0.setNWKDst(self.NWK_add_dst)
コード例 #45
0
ファイル: top_block.py プロジェクト: yeasoon/gr-ccsds
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            0  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

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

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(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.dslwp_ccsds_turbo_decode_0 = dslwp.ccsds_turbo_decode(
            223, 1, 2, 2, 0.707, 1)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu(
            blocks.float_t, 'packet_len')
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(
            gr.sizeof_float, 1, 3576, "packet_len")
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, 'packet_len')
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char * 1)
        self.analog_noise_source_x_0 = analog.noise_source_f(
            analog.GR_GAUSSIAN, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'),
                         (self.dslwp_ccsds_turbo_decode_0, 'in'))
        self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'),
                         (self.qtgui_time_sink_x_0, 'in'))
        self.msg_connect((self.dslwp_ccsds_turbo_decode_0, 'out'),
                         (self.blocks_pdu_to_tagged_stream_0, 'pdus'))
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.blocks_null_sink_0, 0))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.blocks_tagged_stream_to_pdu_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
コード例 #46
0
ファイル: SDR_2_usrp.py プロジェクト: davidcandal/gr-tfg
 def set_endpoint_src(self, endpoint_src):
     self.endpoint_src = endpoint_src
     Qt.QMetaObject.invokeMethod(
         self._endpoint_src_label, "setText",
         Qt.Q_ARG("QString", str(self.endpoint_src)))
コード例 #47
0
ファイル: SDR_2_usrp.py プロジェクト: davidcandal/gr-tfg
 def set_NWK_add_src(self, NWK_add_src):
     self.NWK_add_src = NWK_add_src
     Qt.QMetaObject.invokeMethod(self._NWK_add_src_line_edit, "setText",
                                 Qt.Q_ARG("QString", str(self.NWK_add_src)))
     self.tfg_Aplication_0.setNWKSrc(self.NWK_add_src)
コード例 #48
0
    def __init__(self, parent=None):

        Qt.QWidget.__init__(self, parent)

        self.xmlvalues = {}

        self.xmlvalues['working directory'] = '%s'%current_directory
        self.xmlvalues['file to open'] = '071016_0108.txt'
        self.xmlvalues['first angle'] = '-10'
        self.xmlvalues['last angle'] = '10'
        self.xmlvalues['low energy'] = '150'
        self.xmlvalues['high_energy'] = '152'
        self.xmlvalues['times_delta_e'] ='5'
        self.xmlvalues['cut_file_output'] = 'output_file.dat'
        self.xmlvalues['window_size'] = '11'
        self.xmlvalues['order'] = '4'

        self.layout_name = self.setLayout(Qt.QGridLayout())

        self.Ressonant = Qt.QPushButton('PLOT')
        self.layout().addWidget(self.Ressonant, 0, 0)
        self.connect(self.Ressonant, Qt.SIGNAL('clicked()'), self.doRessonant)

        self.plot_image = Qt.QPushButton('PLOT all intensities')
        self.layout().addWidget(self.plot_image, 30, 0)
        self.connect(self.plot_image, Qt.SIGNAL('clicked()'), self.plot_all_intensities_and_filtering)

        self.plot_image_bis = Qt.QPushButton('PLOT image intensities')
        self.layout().addWidget(self.plot_image_bis, 30, 1)
        self.connect(self.plot_image_bis, Qt.SIGNAL('clicked()'), self.plot_image_all_intensities_and_cut)

        self.plot_image_3 = Qt.QPushButton('PLOT 3D')
        self.layout().addWidget(self.plot_image_3, 30, 2)
        self.connect(self.plot_image_3, Qt.SIGNAL('clicked()'), self.plot_3D)

        self.save_data_file = Qt.QPushButton('Save Data')
        self.layout().addWidget(self.save_data_file, 19, 2)
        self.connect(self.save_data_file, Qt.SIGNAL('clicked()'), self.save_data)

        self.update_data = Qt.QPushButton('Update')
        self.layout().addWidget(self.update_data, 7, 2)
        self.connect(self.update_data, Qt.SIGNAL('clicked()'), self.read_update_data)
        self.update_data.setEnabled(False)


        self.textEdit = Qt.QLineEdit()
        #self.layout().addWidget(self.textEdit, 0,3)
        self.layout().addWidget(self.textEdit, 0,3)

        self.search_path = Qt.QPushButton('Search File')
        self.layout().addWidget(self.search_path, 0,2)
        self.connect(self.search_path, Qt.SIGNAL('clicked()'), self.openFileDialog)
        #self.textEdit.setGeometry(QtCore.QRect(20,180,301,181))



        # POPULATE THE 'QUICKGRID'
        self.value_widgets = []
        last_diffplan_row = 1
        last_expcond_row = 1
        last_sample_row = 1




        # short list
        short_list = [

            'working directory',
            'file to open',
            'first angle',
            'last angle',
            'low energy',
            'high_energy',
            'times_delta_e',
            'cut_file_output',
            'window_size',
            'order'

        ]

        for k in short_list:

            print k

            v = self.xmlvalues[k]

            # PARAMS.append(k+"  "+v)
            PARAMS.append(k)
            PARAMS_values.append(v)

            #PARAMS_total.append(k + " " + v)

            w_label = Qt.QLabel(k)
            w_value = Qt.QLineEdit()
            w_value.setObjectName(k)
            w_value.setText(v)

            self.value_widgets.append(w_value)
            self.connect(w_value, Qt.SIGNAL('textChanged(QString)'), self.updateXMLValues)


            #if k.startswith('path'):
            self.layout().addWidget(w_label, last_expcond_row, 0)
            self.layout().addWidget(w_value, last_expcond_row, 1)
            last_expcond_row += 1
コード例 #49
0
class RingImageQLabel(QtGui.QLabel):
    clicked = Qt.pyqtSignal()
    lineUpdated = Qt.pyqtSignal()
    linePicked = Qt.pyqtSignal()

    def __init__(self, parent, file=None):
        QtGui.QLabel.__init__(self, parent)
        self.selected = True
        self._file = file
        self.nucleiSelected = None
        self.dataHasChanged = False
        self.resolution = None
        self.imagePixmap = None
        self.dwidth = 0
        self.dheight = 0
        self.nd = None

        self.images = None
        self.pix_per_um = None
        self.um_per_pix = None
        self.dt = None
        self.dl = 0.05
        self.nFrames = None
        self.nChannels = None
        self.nZstack = None
        self._zstack = 0

        self._dnach = 0
        self._actch = 0
        self._activeCh = "dna"

        self._dnaimage = None
        self._actimage = None
        self._boudaries = None

        self._render = True
        self.selNuc = None
        self.measurements = None
        self.mousePos = Qt.QPoint(0, 0)
        self._selectedLine = None
        self.measureLocked = False

        self.setMouseTracking(True)
        self.clear()

    @property
    def activeCh(self):
        return self._activeCh

    @activeCh.setter
    def activeCh(self, value):
        if value is not None:
            self._activeCh = value
            self._repaint()

    @property
    def selectedLine(self):
        # return self._selectedLine['n'] if self._selectedLine is not None else None
        return self._selectedLine

    @selectedLine.setter
    def selectedLine(self, value):
        if type(value) == dict:
            self._selectedLine = value
        elif type(value) == int:
            self._selectedLine = None
            for me in self.measurements:
                if me['n'] == value:
                    self._selectedLine = me
                    self._repaint()
        else:
            self._selectedLine = None

    @property
    def render(self):
        return self._render

    @render.setter
    def render(self, value):
        if value is not None:
            self._render = value
            self._repaint()
            self.setMouseTracking(self._render)

    @property
    def zstack(self):
        return self._zstack

    @zstack.setter
    def zstack(self, value):
        if value is not None:
            self._zstack = int(value)
            self._boudaries = None
            if self.images is not None:
                self._dnaimage = retrieve_image(
                    self.images,
                    channel=self._dnach,
                    number_of_channels=self.nChannels,
                    zstack=self.zstack,
                    number_of_zstacks=self.nZstack,
                    frame=0)
                self._actimage = retrieve_image(
                    self.images,
                    channel=self._actch,
                    number_of_channels=self.nChannels,
                    zstack=self.zstack,
                    number_of_zstacks=self.nZstack,
                    frame=0)
            if self.selNuc is not None:
                p = self.selNuc.centroid
                self._measure(p.x, p.y)
            self._repaint()

    @property
    def dnaChannel(self):
        return self._dnach

    @dnaChannel.setter
    def dnaChannel(self, value):
        if value is not None:
            self._dnach = int(value)

            if self.file is not None:
                self._dnaimage = retrieve_image(
                    self.images,
                    channel=self._dnach,
                    number_of_channels=self.nChannels,
                    zstack=self.zstack,
                    number_of_zstacks=self.nZstack,
                    frame=0)
                self._boudaries = None
                if self.selNuc is not None:
                    p = self.selNuc.centroid
                    self._measure(p.x, p.y)
                    if self.activeCh == "dna":
                        self._repaint()

    @property
    def actChannel(self):
        return self._actch

    @actChannel.setter
    def actChannel(self, value):
        if value is not None:
            self._actch = int(value)

            if self.file is not None:
                self._actimage = retrieve_image(
                    self.images,
                    channel=self._actch,
                    number_of_channels=self.nChannels,
                    zstack=self.zstack,
                    number_of_zstacks=self.nZstack,
                    frame=0)
                if self.activeCh == "act":
                    self._repaint()

    @property
    def file(self):
        return self._file

    @file.setter
    def file(self, file):
        if file is not None:
            logger.info('Loading %s' % file)
            self._file = file
            self.images, self.pix_per_um, self.dt, self.nFrames, self.nChannels = find_image(
                file)
            self.um_per_pix = 1 / self.pix_per_um
            self.nZstack = int(
                len(self.images) / self.nFrames / self.nChannels)
            self._repaint()
            logger.info("pixels per um: %0.4f" % self.pix_per_um)

    def clear(self):
        imgarr = np.zeros(shape=(512, 512), dtype=np.uint32)
        qtimage = QtGui.QImage(imgarr.data, imgarr.shape[1], imgarr.shape[0],
                               imgarr.strides[0], QtGui.QImage.Format_RGB32)
        self.imagePixmap = QtGui.QPixmap(qtimage)
        self.setPixmap(self.imagePixmap)

    def _repaint(self):
        self.dataHasChanged = True
        self.repaint()

    def _measure(self, x, y):
        self.measurements = None
        if self._dnaimage is not None and self._boudaries is None:
            logger.debug("computing nuclei boundaries")
            lbl, self._boudaries = m.nuclei_segmentation(
                self._dnaimage, simp_px=self.pix_per_um / 4)

        if self._boudaries is not None:
            pt = Point(x, y)

            for nucleus in self._boudaries:
                if nucleus["boundary"].contains(pt):
                    self.selNuc = nucleus["boundary"]

            if self.selNuc is None: return
            lines = m.measure_lines_around_polygon(self._actimage,
                                                   self.selNuc,
                                                   rng_thick=4,
                                                   dl=self.dl,
                                                   n_lines=_nlin,
                                                   pix_per_um=self.pix_per_um)
            self.measurements = list()
            for k, ((ls, l),
                    colr) in enumerate(zip(lines, itertools.cycle(_colors))):
                self.measurements.append({
                    'n': k,
                    'x': x,
                    'y': y,
                    'l': l,
                    'c': colr,
                    'ls0': ls.coords[0],
                    'ls1': ls.coords[1],
                    'd': max(l) - min(l),
                    'sum': np.sum(l)
                })

    def mouseMoveEvent(self, event):
        # logger.debug('mouseMoveEvent')
        if not self.measureLocked and event.type(
        ) == QtCore.QEvent.MouseMove and self.measurements is not None:
            if event.buttons() == QtCore.Qt.NoButton:
                pos = event.pos()
                # convert to image pixel coords
                x = pos.x() * self.dwidth / self.width()
                y = pos.y() * self.dheight / self.height()
                self.mousePos = Qt.QPoint(x, y)

                # print("------------------------------------------------------")
                for me in self.measurements:
                    pts = [Qt.QPoint(x, y) for x, y in [me['ls0'], me['ls1']]]
                    # print("X %d %d %d | Y %d %d %d" % (
                    #     min(pts[0].x(), pts[1].x()), self.mouse_pos.x(), max(pts[0].x(), pts[1].x()),
                    #     min(pts[0].y(), pts[1].y()), self.mouse_pos.y(), max(pts[0].y(), pts[1].y())))
                    if is_between(self.mousePos, pts[0], pts[1]):
                        if me != self.selectedLine:
                            self.selectedLine = me
                            self.emit(QtCore.SIGNAL('lineUpdated()'))
                            self._repaint()
                            break

    def mouseReleaseEvent(self, ev):
        pos = ev.pos()
        # convert to image pixel coords
        x = pos.x() * self.dwidth / self.width()
        y = pos.y() * self.dheight / self.height()
        logger.debug('clicked! X%d Y%d' % (x, y))

        anyLineSelected = False
        lineChanged = False
        if self.measurements is not None:
            for me in self.measurements:
                pts = [Qt.QPoint(x, y) for x, y in [me['ls0'], me['ls1']]]
                if is_between(self.mousePos, pts[0], pts[1]):
                    anyLineSelected = True
                    if me != self.selectedLine:
                        lineChanged = True
                        break

        if anyLineSelected and not lineChanged and not self.measureLocked:
            self.clicked.emit()
            self.measureLocked = True
            self.emit(QtCore.SIGNAL('linePicked()'))
        else:
            self.measureLocked = False
            self.selectedLine = None
            self.selNuc = None
            self._measure(x, y)
            self._repaint()
            self.clicked.emit()

    def paint_measures(self):
        logger.debug("painting measurement")
        data = retrieve_image(self.images,
                              channel=self._actch,
                              number_of_channels=self.nChannels,
                              zstack=self.zstack,
                              number_of_zstacks=self.nZstack,
                              frame=0)
        self.dwidth, self.dheight = data.shape
        # print(data.shape, self.dwidth, self.dheight)

        # map the data range to 0 - 255
        img8bit = ((data - data.min()) / (data.ptp() / 255.0)).astype(np.uint8)

        for me in self.measurements:
            r0, c0, r1, c1 = np.array(list(me['ls0']) +
                                      list(me['ls1'])).astype(int)
            rr, cc = draw.line(r0, c0, r1, c1)
            img8bit[cc, rr] = 255
            rr, cc = draw.circle(r0, c0, 3)
            img8bit[cc, rr] = 255

        qtimage = QtGui.QImage(img8bit.repeat(4), self.dwidth, self.dheight,
                               QtGui.QImage.Format_RGB32)
        self.imagePixmap = QPixmap(qtimage)
        self.setPixmap(self.imagePixmap)
        return

    def resizeEvent(self, QResizeEvent):
        # this is a hack to resize everithing when the user resizes the main window
        if self.dwidth == 0: return
        ratio = self.dheight / self.dwidth
        self.setFixedWidth(self.width())
        self.setFixedHeight(int(self.width()) * ratio)

    def paintEvent(self, event):
        if self.dataHasChanged:
            self.dataHasChanged = False
            ch = self.actChannel if self.activeCh == "act" else self.dnaChannel
            data = retrieve_image(self.images,
                                  channel=ch,
                                  number_of_channels=self.nChannels,
                                  zstack=self.zstack,
                                  number_of_zstacks=self.nZstack,
                                  frame=0)
            self.dwidth, self.dheight = data.shape

            # map the data range to 0 - 255
            img_8bit = ((data - data.min()) / (data.ptp() / 255.0)).astype(
                np.uint8)
            qtimage = QtGui.QImage(img_8bit.repeat(4), self.dwidth,
                                   self.dheight, QtGui.QImage.Format_RGB32)
            self.imagePixmap = QPixmap(qtimage)
            if self.render:
                self._drawMeasurements()
            self.setPixmap(self.imagePixmap)

        return QtGui.QLabel.paintEvent(self, event)

    def _drawMeasurements(self):
        if self.selNuc is None: return

        painter = QPainter()
        painter.begin(self.imagePixmap)
        painter.setRenderHint(QPainter.Antialiasing)

        rng_thick = 3
        rng_thick *= self.pix_per_um

        if self.activeCh == "dna":
            # get nuclei boundary as a polygon
            nucb_qpoints_e = [
                Qt.QPoint(x, y)
                for x, y in self.selNuc.buffer(rng_thick).exterior.coords
            ]
            nucb_qpoints_i = [
                Qt.QPoint(x, y) for x, y in self.selNuc.exterior.coords
            ]

            painter.setPen(QPen(QBrush(QColor('white')), 3))
            painter.drawPolygon(Qt.QPolygon(nucb_qpoints_i))
            painter.drawPolygon(Qt.QPolygon(nucb_qpoints_e))

            nucb_poly = Qt.QPolygon(nucb_qpoints_e).subtracted(
                Qt.QPolygon(nucb_qpoints_i))
            brush = QBrush(QtCore.Qt.BDiagPattern)
            brush.setColor(QColor('white'))
            painter.setBrush(brush)
            painter.setPen(QPen(QBrush(QColor('transparent')), 0))

            painter.drawPolygon(nucb_poly)

        elif self.activeCh == "act":
            nuc_pen = QPen(QBrush(QColor('red')), 2)
            nuc_pen.setStyle(QtCore.Qt.DotLine)
            painter.setPen(nuc_pen)
            for n in [e["boundary"] for e in self._boudaries]:
                # get nuclei boundary as a polygon
                nucb_qpoints = [Qt.QPoint(x, y) for x, y in n.exterior.coords]
                painter.drawPolygon(Qt.QPolygon(nucb_qpoints))

        for me in self.measurements:
            painter.setPen(
                QPen(
                    QBrush(QColor(me['c'])), 2 * self.pix_per_um
                    if me == self.selectedLine else self.pix_per_um))
            pts = [Qt.QPoint(x, y) for x, y in [me['ls0'], me['ls1']]]
            painter.drawLine(pts[0], pts[1])

        painter.end()

    def drawMeasurements(self, ax, pal):
        if self.selNuc is None: return
        from matplotlib import cm
        from shapely import affinity
        import plots as p

        act_img = retrieve_image(self.images,
                                 channel=self.actChannel,
                                 number_of_channels=self.nChannels,
                                 zstack=self.zstack,
                                 number_of_zstacks=self.nZstack,
                                 frame=0)

        ext = [
            0, self.dwidth / self.pix_per_um, self.dheight / self.pix_per_um, 0
        ]

        ax.imshow(act_img, interpolation='none', extent=ext, cmap=cm.gray_r)

        for n in [e["boundary"] for e in self._boudaries]:
            n_um = affinity.scale(n,
                                  xfact=self.um_per_pix,
                                  yfact=self.um_per_pix,
                                  origin=(0, 0, 0))
            p.render_polygon(n_um, zorder=10, ax=ax)

        for me, c in zip(self.measurements, pal):
            ax.plot([
                me['ls0'][0] / self.pix_per_um, me['ls1'][0] / self.pix_per_um
            ], [
                me['ls0'][1] / self.pix_per_um, me['ls1'][1] / self.pix_per_um
            ],
                    linewidth=1,
                    linestyle='-',
                    color=c,
                    alpha=1)

        w = 20
        c = self.selNuc.centroid
        x0, y0 = c.x / self.pix_per_um - w, c.y / self.pix_per_um - w
        ax.set_xlim([x0, x0 + 2 * w])
        ax.set_ylim([y0, y0 + 2 * w])

        ax.plot([x0 + 2, x0 + 12], [y0 + 2, y0 + 2], c='w', lw=4)
        ax.text(x0 + 5, y0 + 3.5, '10 um', color='w', fontdict={'size': 7})
コード例 #50
0
    def __init__(self):
        gr.top_block.__init__(self, "Simulator Fmcw")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Simulator Fmcw")
        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", "simulator_fmcw")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_up = samp_up = 2**14
        self.samp_rate = samp_rate = 10000000
        self.sweep_freq = sweep_freq = samp_rate / 2
        self.samp_down = samp_down = samp_up
        self.samp_cw = samp_cw = 2**14
        self.center_freq = center_freq = 5.9e9
        self.velocity = velocity = 50
        self.value_range = value_range = 200
        self.v_res = v_res = samp_rate / samp_cw * 3e8 / 2 / center_freq
        self.threshold = threshold = -120
        self.range_res = range_res = 3e8 / 2 / sweep_freq
        self.protect_samp = protect_samp = 1
        self.min_output_buffer = min_output_buffer = int(
            (samp_up + samp_down + samp_cw) * 2)
        self.meas_duration = meas_duration = (samp_cw + samp_up +
                                              samp_down) / float(samp_rate)
        self.max_output_buffer = max_output_buffer = 0
        self.decim_fac = decim_fac = 2**5

        ##################################################
        # Blocks
        ##################################################
        self._velocity_range = Range(0, 100, 1, 50, 200)
        self._velocity_win = RangeWidget(self._velocity_range,
                                         self.set_velocity, "velocity",
                                         "counter_slider", float)
        self.top_grid_layout.addWidget(self._velocity_win)
        self._value_range_range = Range(0, 1000, 1, 200, 200)
        self._value_range_win = RangeWidget(self._value_range_range,
                                            self.set_value_range, 'range',
                                            "counter_slider", float)
        self.top_grid_layout.addWidget(self._value_range_win)
        self._threshold_range = Range(-120, 0, 1, -120, 200)
        self._threshold_win = RangeWidget(self._threshold_range,
                                          self.set_threshold, "threshold",
                                          "counter_slider", float)
        self.top_grid_layout.addWidget(self._threshold_win)
        self._protect_samp_range = Range(0, 100, 1, 1, 200)
        self._protect_samp_win = RangeWidget(self._protect_samp_range,
                                             self.set_protect_samp,
                                             "protect_samp", "counter_slider",
                                             float)
        self.top_grid_layout.addWidget(self._protect_samp_win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=1,
            decimation=decim_fac,
            taps=None,
            fractional_bw=None,
        )
        self.radar_ts_fft_cc_0_1 = radar.ts_fft_cc(samp_down / decim_fac,
                                                   "packet_len")
        self.radar_ts_fft_cc_0_0 = radar.ts_fft_cc(samp_up / decim_fac,
                                                   "packet_len")
        self.radar_ts_fft_cc_0 = radar.ts_fft_cc(samp_cw / decim_fac,
                                                 "packet_len")
        self.radar_static_target_simulator_cc_0 = radar.static_target_simulator_cc(
            (value_range, ), (velocity, ), (1e16, ), (0, ), (0, ), samp_rate,
            center_freq, -10, True, True, "packet_len")
        (self.radar_static_target_simulator_cc_0).set_min_output_buffer(98304)
        self.radar_split_cc_0_0_0 = radar.split_cc(
            2, ((samp_cw / decim_fac, samp_up / decim_fac,
                 samp_down / decim_fac)), "packet_len")
        (self.radar_split_cc_0_0_0).set_min_output_buffer(98304)
        self.radar_split_cc_0_0 = radar.split_cc(
            1, ((samp_cw / decim_fac, samp_up / decim_fac,
                 samp_down / decim_fac)), "packet_len")
        (self.radar_split_cc_0_0).set_min_output_buffer(98304)
        self.radar_split_cc_0 = radar.split_cc(
            0, ((samp_cw / decim_fac, samp_up / decim_fac,
                 samp_down / decim_fac)), "packet_len")
        (self.radar_split_cc_0).set_min_output_buffer(98304)
        self.radar_signal_generator_fmcw_c_0 = radar.signal_generator_fmcw_c(
            samp_rate, samp_up, samp_down, samp_cw, -sweep_freq / 2,
            sweep_freq, 1, "packet_len")
        (self.radar_signal_generator_fmcw_c_0).set_min_output_buffer(98304)
        self.radar_print_results_0 = radar.print_results(False, "")
        self.radar_find_max_peak_c_0_0_0 = radar.find_max_peak_c(
            samp_rate / decim_fac, threshold, protect_samp, (), False,
            "packet_len")
        self.radar_find_max_peak_c_0_0 = radar.find_max_peak_c(
            samp_rate / decim_fac, threshold, protect_samp, (), False,
            "packet_len")
        self.radar_find_max_peak_c_0 = radar.find_max_peak_c(
            samp_rate / decim_fac, threshold, protect_samp, (), False,
            "packet_len")
        self.radar_estimator_fmcw_0 = radar.estimator_fmcw(
            samp_rate / decim_fac, center_freq, sweep_freq,
            samp_up / decim_fac, samp_down / decim_fac, False)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        (self.blocks_throttle_0).set_min_output_buffer(98304)
        self.blocks_tagged_stream_multiply_length_0 = blocks.tagged_stream_multiply_length(
            gr.sizeof_gr_complex * 1, "packet_len", 1.0 / decim_fac)
        (self.blocks_tagged_stream_multiply_length_0
         ).set_min_output_buffer(98304)
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        (self.blocks_multiply_conjugate_cc_0).set_min_output_buffer(98304)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        (self.blocks_add_xx_0).set_min_output_buffer(98304)
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, 0.1, 0)
        (self.analog_noise_source_x_0).set_min_output_buffer(98304)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.radar_estimator_fmcw_0, 'Msg out'),
                         (self.radar_print_results_0, 'Msg in'))
        self.msg_connect((self.radar_find_max_peak_c_0, 'Msg out'),
                         (self.radar_estimator_fmcw_0, 'Msg in CW'))
        self.msg_connect((self.radar_find_max_peak_c_0_0, 'Msg out'),
                         (self.radar_estimator_fmcw_0, 'Msg in UP'))
        self.msg_connect((self.radar_find_max_peak_c_0_0_0, 'Msg out'),
                         (self.radar_estimator_fmcw_0, 'Msg in DOWN'))
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_tagged_stream_multiply_length_0, 0),
                     (self.radar_split_cc_0, 0))
        self.connect((self.blocks_tagged_stream_multiply_length_0, 0),
                     (self.radar_split_cc_0_0, 0))
        self.connect((self.blocks_tagged_stream_multiply_length_0, 0),
                     (self.radar_split_cc_0_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.radar_static_target_simulator_cc_0, 0))
        self.connect((self.radar_signal_generator_fmcw_c_0, 0),
                     (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.radar_signal_generator_fmcw_c_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.radar_split_cc_0, 0), (self.radar_ts_fft_cc_0, 0))
        self.connect((self.radar_split_cc_0_0, 0),
                     (self.radar_ts_fft_cc_0_0, 0))
        self.connect((self.radar_split_cc_0_0_0, 0),
                     (self.radar_ts_fft_cc_0_1, 0))
        self.connect((self.radar_static_target_simulator_cc_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.radar_ts_fft_cc_0, 0),
                     (self.radar_find_max_peak_c_0, 0))
        self.connect((self.radar_ts_fft_cc_0_0, 0),
                     (self.radar_find_max_peak_c_0_0, 0))
        self.connect((self.radar_ts_fft_cc_0_1, 0),
                     (self.radar_find_max_peak_c_0_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_tagged_stream_multiply_length_0, 0))
コード例 #51
0
ファイル: SDR_2_usrp.py プロジェクト: davidcandal/gr-tfg
 def set_endpoint_dst(self, endpoint_dst):
     self.endpoint_dst = endpoint_dst
     Qt.QMetaObject.invokeMethod(
         self._endpoint_dst_label, "setText",
         Qt.Q_ARG("QString", str(self.endpoint_dst)))
コード例 #52
0
ファイル: top_block.py プロジェクト: Leostayner/Brunardo
 def closeEvent(self, event):
     self.settings = Qt.QSettings("GNU Radio", "top_block")
     self.settings.setValue("geometry", self.saveGeometry())
     event.accept()
コード例 #53
0
ファイル: infos_frame.py プロジェクト: pducharme/pytoutv
    def _setup_thumb_fetching(self):
        self._fetch_thumb_thread = Qt.QThread()
        self._fetch_thumb_thread.start()

        self._thumb_fetcher = _QThumbFetcher()
        self._thumb_fetcher.moveToThread(self._fetch_thumb_thread)
コード例 #54
0
    def __init__(self):
        gr.top_block.__init__(self, "Simulator Sync Pulse")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Simulator Sync Pulse")
        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", "simulator_sync_pulse")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 250000
        self.num_skip = num_skip = 50
        self.num_corr = num_corr = 75

        ##################################################
        # Blocks
        ##################################################
        self._num_corr_range = Range(0, 100, 1, 75, 200)
        self._num_corr_win = RangeWidget(self._num_corr_range,
                                         self.set_num_corr, "num_corr",
                                         "counter_slider", float)
        self.top_grid_layout.addWidget(self._num_corr_win)
        self.radar_signal_generator_sync_pulse_c_0 = radar.signal_generator_sync_pulse_c(
            2**12, ((300, 50, 200)), ((100, 200, 50)), 0.5, "packet_len")
        self.radar_print_results_0 = radar.print_results(False, "")
        self.radar_estimator_sync_pulse_c_0 = radar.estimator_sync_pulse_c(
            int(num_corr), "packet_len")
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_gr_complex * 1,
                                                 num_skip)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.radar_estimator_sync_pulse_c_0, 'Msg out'),
                         (self.radar_print_results_0, 'Msg in'))
        self.connect((self.blocks_skiphead_0, 0),
                     (self.radar_estimator_sync_pulse_c_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.radar_estimator_sync_pulse_c_0, 1))
        self.connect((self.radar_signal_generator_sync_pulse_c_0, 0),
                     (self.blocks_skiphead_0, 0))
        self.connect((self.radar_signal_generator_sync_pulse_c_0, 0),
                     (self.blocks_throttle_0, 0))
コード例 #55
0
ファイル: infos_frame.py プロジェクト: pducharme/pytoutv
 def _set_no_thumb(self):
     self.thumb_value_label.setPixmap(Qt.QPixmap())
コード例 #56
0
 def __init__(self, author, app_name):
     self.settings = Qt.QSettings(author, app_name)
     return
コード例 #57
0
ファイル: csma_80211_I.py プロジェクト: difdenk/gr-inets
 def closeEvent(self, event):
     self.settings = Qt.QSettings("GNU Radio", "csma_80211_I")
     self.settings.setValue("geometry", self.saveGeometry())
     event.accept()
コード例 #58
0
ファイル: infos_frame.py プロジェクト: pducharme/pytoutv
 def _setup_none_label(self):
     self.none_label = Qt.QLabel()
     self.none_label.setText('Please select an item in the list above')
     font = Qt.QFont()
     font.setItalic(True)
     self.none_label.setFont(font)
コード例 #59
0
 def closeEvent(self, event):
     self.settings = Qt.QSettings("GNU Radio", "simulator_sync_pulse")
     self.settings.setValue("geometry", self.saveGeometry())
     event.accept()
コード例 #60
0
    def initUI(self):

        ######################################################################
        # Create the widgets which control the clk divider module:
        # Needs: clk_divider_modulus, bDividerOn, bPulses or Square Wave
        ######################################################################
        self.qgroupbox_divider = Qt.QGroupBox(
            'Clk divider settings (Triggers the PRBS generator on DOUT2), enter to accept changes'
        )
        self.qgroupbox_divider.setAutoFillBackground(True)

        if self.bPulses:
            output_freq = 2 * self.sl.fs / (self.clk_divider_modulus)
        else:
            # square wave mode:
            output_freq = 2 * self.sl.fs / (2 * (self.clk_divider_modulus))

        self.qlbl_modulus = Qt.QLabel(
            'Modulus [2, 2^32-1], [samples at 200 MHz]:')
        self.qedit_modulus = Qt.QLineEdit(
            str(int(self.clk_divider_modulus + 1)))
        self.qedit_modulus.editingFinished.connect(self.updateClicked)

        self.qlbl_phaseinc = Qt.QLabel(
            'Time increment [-Period, Period], [seconds]:')
        self.qedit_phaseinc = Qt.QLineEdit('0')
        #        self.qedit_phaseinc.editingFinished.connect(self.phaseIncrement)
        self.qbtn_phaseinc = Qt.QPushButton('Apply')
        self.qbtn_phaseinc.clicked.connect(self.phaseIncrement)

        # Modulation frequency:
        self.qlbl_freq = Qt.QLabel('Actual frequency [Hz]:')
        self.qlbl_actual_frequency = Qt.QLabel(str(output_freq))
        #        self.qlbl_actual_frequency.setMaximumWidth(60)

        # Sine/Square wave
        self.qradio_pulses = Qt.QRadioButton('5 ns pulses')
        self.qradio_square_wave = Qt.QRadioButton('Square wave')
        self.qsign_group = Qt.QButtonGroup(self)
        self.qsign_group.addButton(self.qradio_pulses)
        self.qsign_group.addButton(self.qradio_square_wave)

        self.qradio_pulses.setChecked(bool(self.bPulses))
        self.qradio_square_wave.setChecked(not bool(self.bPulses))
        self.qradio_pulses.clicked.connect(self.updateClicked)
        self.qradio_square_wave.clicked.connect(self.updateClicked)

        # On/Off button
        self.qbtn_divider_on = QtGui.QPushButton('Activate output')
        self.qbtn_divider_on.clicked.connect(self.updateClicked)
        self.qbtn_divider_on.setCheckable(True)
        self.qbtn_divider_on.setChecked(bool(self.bDividerOn))

        # Put all the widgets into a grid layout
        grid = QtGui.QGridLayout()

        grid.addWidget(self.qlbl_modulus, 0, 0)
        grid.addWidget(self.qedit_modulus, 0, 1, 1, 2)

        grid.addWidget(self.qlbl_phaseinc, 1, 0)
        grid.addWidget(self.qedit_phaseinc, 1, 1)
        grid.addWidget(self.qbtn_phaseinc, 1, 2)

        grid.addWidget(self.qlbl_freq, 2, 0)
        grid.addWidget(self.qlbl_actual_frequency, 2, 1, 1, 2)
        grid.addWidget(self.qradio_pulses, 3, 0)
        grid.addWidget(self.qradio_square_wave, 3, 1, 1, 2)

        grid.addWidget(self.qbtn_divider_on, 4, 0, 1, 3)

        self.qgroupbox_divider.setLayout(grid)

        ######################################################################
        # Create the widgets which control the residuals streaming module:
        # Needs: data_delay, trigger_delay, boxcar_filter_size
        ######################################################################
        self.qgroupbox_streaming = Qt.QGroupBox('Residuals streaming settings')
        self.qgroupbox_streaming.setAutoFillBackground(True)

        if self.bPulses:
            output_freq = 2 * self.sl.fs / (self.clk_divider_modulus)
        else:
            # square wave mode:
            output_freq = 2 * self.sl.fs / (2 * (self.clk_divider_modulus))

        self.qlbl_data_delay = Qt.QLabel('Data delay, [samples at 100 MHz]:')
        self.qedit_data_delay = Qt.QLineEdit('1')
        self.qedit_data_delay.textChanged.connect(self.residualsClicked)
        self.qedit_data_delay.setMaximumWidth(60)

        self.qlbl_trigger_delay = Qt.QLabel(
            'Trigger delay, [samples at 100 MHz]:')
        self.qedit_trigger_delay = Qt.QLineEdit('1')
        self.qedit_trigger_delay.textChanged.connect(self.residualsClicked)
        self.qedit_trigger_delay.setMaximumWidth(60)

        self.qlbl_boxcar_size = Qt.QLabel(
            'Boxcar filter size, [samples at 100 MHz]:')
        self.qedit_boxcar_size = Qt.QLineEdit('10')
        self.qedit_boxcar_size.textChanged.connect(self.residualsClicked)
        self.qedit_boxcar_size.setMaximumWidth(60)

        # Saturated or modulo phase 0:
        self.qlbl_phase0 = Qt.QLabel('Phase residuals 0:')
        self.qchk_Saturation0 = Qt.QRadioButton('Saturation')
        self.qchk_Modulo0 = Qt.QRadioButton('Modulo')
        self.qphase0_group = Qt.QButtonGroup(self)
        self.qphase0_group.addButton(self.qchk_Saturation0)
        self.qphase0_group.addButton(self.qchk_Modulo0)

        self.qchk_Saturation0.setChecked(True)
        self.qchk_Modulo0.setChecked(False)

        self.qchk_Saturation0.clicked.connect(self.residualsClicked)
        self.qchk_Modulo0.clicked.connect(self.residualsClicked)

        # Saturated or modulo phase 1:
        self.qlbl_phase1 = Qt.QLabel('Phase residuals 1:')
        self.qchk_Saturation1 = Qt.QRadioButton('Saturation')
        self.qchk_Modulo1 = Qt.QRadioButton('Modulo')
        self.qphase1_group = Qt.QButtonGroup(self)
        self.qphase1_group.addButton(self.qchk_Saturation1)
        self.qphase1_group.addButton(self.qchk_Modulo1)

        self.qchk_Saturation1.setChecked(True)
        self.qchk_Modulo1.setChecked(False)

        self.qchk_Saturation1.clicked.connect(self.residualsClicked)
        self.qchk_Modulo1.clicked.connect(self.residualsClicked)

        # Put all the widgets into a grid layout
        grid = QtGui.QGridLayout()

        grid.addWidget(self.qlbl_data_delay, 0, 0, 1, 1)
        grid.addWidget(self.qedit_data_delay, 0, 1, 1, 2)
        grid.addWidget(self.qlbl_trigger_delay, 1, 0, 1, 1)
        grid.addWidget(self.qedit_trigger_delay, 1, 1, 1, 2)
        grid.addWidget(self.qlbl_boxcar_size, 2, 0, 1, 1)
        grid.addWidget(self.qedit_boxcar_size, 2, 1, 1, 2)

        grid.addWidget(self.qlbl_phase0, 3, 0)
        grid.addWidget(self.qchk_Saturation0, 3, 1)
        grid.addWidget(self.qchk_Modulo0, 3, 2)

        grid.addWidget(self.qlbl_phase1, 4, 0)
        grid.addWidget(self.qchk_Saturation1, 4, 1)
        grid.addWidget(self.qchk_Modulo1, 4, 2)

        self.qgroupbox_streaming.setLayout(grid)

        ######################################################################
        # Create the widgets which control the DDC settings
        ######################################################################
        self.qgroupbox_ddc = Qt.QGroupBox('DDC settings')
        self.qgroupbox_ddc.setAutoFillBackground(True)

        # Wideband/narrowband DDC0:
        self.qlbl_ddc0 = Qt.QLabel('DDC 0 filter BW:')
        self.qchk_Wideband0 = Qt.QRadioButton('Wideband (25 MHz)')
        self.qchk_Narrowband0 = Qt.QRadioButton('Narrowband (6 MHz)')
        self.qchk_WidebandFIR0 = Qt.QRadioButton('Wideband FIR (50 MHz)')
        self.qddc0_group = Qt.QButtonGroup(self)
        self.qddc0_group.addButton(self.qchk_Wideband0)
        self.qddc0_group.addButton(self.qchk_Narrowband0)
        self.qddc0_group.addButton(self.qchk_WidebandFIR0)

        self.qchk_Wideband0.setChecked(True)
        self.qchk_Narrowband0.setChecked(False)
        self.qchk_WidebandFIR0.setChecked(False)

        self.qchk_Wideband0.clicked.connect(self.ddcClicked)
        self.qchk_Narrowband0.clicked.connect(self.ddcClicked)
        self.qchk_WidebandFIR0.clicked.connect(self.ddcClicked)

        # DDC0 CORDIC or Quadrature
        self.qlbl_ddc0angle = Qt.QLabel('DDC 0 CORDIC or Quadrature:')
        self.qchk_cordic0 = Qt.QRadioButton('CORDIC')
        self.qchk_quadrature_msb0 = Qt.QRadioButton('Quadrature MSB')
        self.qchk_quadrature_lsb0 = Qt.QRadioButton('Quadrature LSB')
        self.qchk_inphase_msb0 = Qt.QRadioButton('In-Phase MSB')
        self.qchk_inphase_lsb0 = Qt.QRadioButton('In-Phase LSB')
        self.qddc0_group = Qt.QButtonGroup(self)
        self.qddc0_group.addButton(self.qchk_cordic0)
        self.qddc0_group.addButton(self.qchk_quadrature_msb0)
        self.qddc0_group.addButton(self.qchk_quadrature_lsb0)
        self.qddc0_group.addButton(self.qchk_inphase_msb0)
        self.qddc0_group.addButton(self.qchk_inphase_lsb0)

        self.qchk_cordic0.setChecked(True)
        self.qchk_quadrature_msb0.setChecked(False)
        self.qchk_quadrature_lsb0.setChecked(False)

        self.qchk_cordic0.clicked.connect(self.ddcClicked)
        self.qchk_quadrature_msb0.clicked.connect(self.ddcClicked)
        self.qchk_quadrature_lsb0.clicked.connect(self.ddcClicked)
        self.qchk_inphase_msb0.clicked.connect(self.ddcClicked)
        self.qchk_inphase_lsb0.clicked.connect(self.ddcClicked)

        # Wideband/narrowband DDC1:
        self.qlbl_ddc1 = Qt.QLabel('DDC 1 filter BW:')
        self.qchk_Wideband1 = Qt.QRadioButton('Wideband (31 MHz)')
        self.qchk_Narrowband1 = Qt.QRadioButton('Narrowband (7.5 MHz)')
        self.qchk_WidebandFIR1 = Qt.QRadioButton('Wideband FIR (62 MHz)')
        self.qddc1_group = Qt.QButtonGroup(self)
        self.qddc1_group.addButton(self.qchk_Wideband1)
        self.qddc1_group.addButton(self.qchk_Narrowband1)
        self.qddc1_group.addButton(self.qchk_WidebandFIR1)

        self.qchk_Wideband1.setChecked(True)
        self.qchk_Narrowband1.setChecked(False)
        self.qchk_WidebandFIR1.setChecked(False)

        self.qchk_Wideband1.clicked.connect(self.ddcClicked)
        self.qchk_Narrowband1.clicked.connect(self.ddcClicked)
        self.qchk_WidebandFIR1.clicked.connect(self.ddcClicked)

        # DDC1 CORDIC or Quadrature
        self.qlbl_ddc1angle = Qt.QLabel('DDC 1 CORDIC or Quadrature:')
        self.qchk_cordic1 = Qt.QRadioButton('CORDIC')
        self.qchk_quadrature_msb1 = Qt.QRadioButton('Quadrature MSB')
        self.qchk_quadrature_lsb1 = Qt.QRadioButton('Quadrature LSB')
        self.qchk_inphase_msb1 = Qt.QRadioButton('In-Phase MSB')
        self.qchk_inphase_lsb1 = Qt.QRadioButton('In-Phase LSB')
        self.qddc1_group = Qt.QButtonGroup(self)
        self.qddc1_group.addButton(self.qchk_cordic1)
        self.qddc1_group.addButton(self.qchk_quadrature_msb1)
        self.qddc1_group.addButton(self.qchk_quadrature_lsb1)
        self.qddc1_group.addButton(self.qchk_inphase_msb1)
        self.qddc1_group.addButton(self.qchk_inphase_lsb1)

        self.qchk_cordic1.setChecked(True)
        self.qchk_quadrature_msb1.setChecked(False)
        self.qchk_quadrature_lsb1.setChecked(False)

        self.qchk_cordic1.clicked.connect(self.ddcClicked)
        self.qchk_quadrature_msb1.clicked.connect(self.ddcClicked)
        self.qchk_quadrature_lsb1.clicked.connect(self.ddcClicked)
        self.qchk_inphase_msb1.clicked.connect(self.ddcClicked)
        self.qchk_inphase_lsb1.clicked.connect(self.ddcClicked)

        # Put all the widgets into a grid layout
        grid = QtGui.QGridLayout()

        grid.addWidget(self.qlbl_ddc0, 0, 0)
        grid.addWidget(self.qchk_Wideband0, 0, 1)
        grid.addWidget(self.qchk_Narrowband0, 0, 2)
        grid.addWidget(self.qchk_WidebandFIR0, 0, 3)

        #FEATURE
        grid.addWidget(self.qlbl_ddc0angle, 1, 0)
        grid.addWidget(self.qchk_cordic0, 1, 1)
        grid.addWidget(self.qchk_quadrature_msb0, 1, 2)
        grid.addWidget(self.qchk_quadrature_lsb0, 1, 3)
        grid.addWidget(self.qchk_inphase_msb0, 2, 2)
        grid.addWidget(self.qchk_inphase_lsb0, 2, 3)

        grid.addWidget(self.qlbl_ddc1, 3, 0)
        grid.addWidget(self.qchk_Wideband1, 3, 1)
        grid.addWidget(self.qchk_Narrowband1, 3, 2)
        grid.addWidget(self.qchk_WidebandFIR1, 3, 3)

        #FEATURE
        grid.addWidget(self.qlbl_ddc1angle, 4, 0)
        grid.addWidget(self.qchk_cordic1, 4, 1)
        grid.addWidget(self.qchk_quadrature_msb1, 4, 2)
        grid.addWidget(self.qchk_quadrature_lsb1, 4, 3)
        grid.addWidget(self.qchk_inphase_msb1, 5, 2)
        grid.addWidget(self.qchk_inphase_lsb1, 5, 3)

        self.qgroupbox_ddc.setLayout(grid)

        vbox = Qt.QVBoxLayout()
        #FEATURE
        # vbox.addWidget(self.qgroupbox_divider)
        # vbox.addWidget(self.qgroupbox_streaming)
        vbox.addWidget(self.qgroupbox_ddc)
        vbox.addStretch(1)
        self.setLayout(vbox)

        # Adjust the size and position of the window
        #        self.resize(800, 600)
        self.center()
        self.setWindowTitle(self.custom_shorthand + ': Peripherals settings')
        self.show()