Hi! I have an error with fosphor_display:
Generating: '/home/cruiz/repositorios/sample_rfnoc.py' Executing: /usr/bin/python -u /home/cruiz/repositorios/sample_rfnoc.py File "/home/cruiz/repositorios/sample_rfnoc.py", line 147 self.uhd_rfnoc_fosphor_display = Template error: #set $win = 'self._%s_win'%$id ^ SyntaxError: invalid syntax >>> Done (return code 1) My UHD version: [INFO] [UHD] linux; GNU C++ version 7.3.0; Boost_106501; UHD_4.0.0.rfnoc-devel-788-g1f8463cc I have attached my grc. Thank you.
sample_rfnoc.grc
Description: application/gnuradio-grc
#!/usr/bin/env python2 # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph # Title: Sample Rfnoc # Generated: Fri Jun 22 10:56:04 2018 ################################################## from distutils.version import StrictVersion if __name__ == '__main__': import ctypes import sys if sys.platform.startswith('linux'): try: x11 = ctypes.cdll.LoadLibrary('libX11.so') x11.XInitThreads() except: print "Warning: failed to XInitThreads()" from PyQt4 import Qt from PyQt5 import Qt, QtCore from gnuradio import blocks from gnuradio import eng_notation from gnuradio import fft from gnuradio import gr from gnuradio import uhd from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from optparse import OptionParser import ettus import sip import sys from gnuradio import qtgui class sample_rfnoc(gr.top_block, Qt.QWidget): def __init__(self): gr.top_block.__init__(self, "Sample Rfnoc") Qt.QWidget.__init__(self) self.setWindowTitle("Sample Rfnoc") 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", "sample_rfnoc") if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry(self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Variables ################################################## self.device3 = variable_uhd_device3_0 = ettus.device3(uhd.device_addr_t( ",".join(('type=x300', "")) )) self.trise = trise = 1024 self.tdecay = tdecay = 4096 self.samp_rate = samp_rate = 56e6 self.gain = gain = 32 self.freq = freq = 2.45e9 self.fft_size = fft_size = 1024 ################################################## # Blocks ################################################## self.uhd_rfnoc_streamer_window_0 = ettus.rfnoc_window_cci( ([int(round(32767 * x)) for x in fft.window_blackman_harris(fft_size)]), self.device3, -1, -1 ) self.uhd_rfnoc_streamer_radio_0 = ettus.rfnoc_radio( self.device3, uhd.stream_args( # Tx Stream Args cpu_format="fc32", otw_format="sc16", args="", # empty ), uhd.stream_args( # Rx Stream Args cpu_format="fc32", otw_format="sc16", args='spp=1024', ), 0, -1 ) self.uhd_rfnoc_streamer_radio_0.set_rate(samp_rate) for i in xrange(1): self.uhd_rfnoc_streamer_radio_0.set_rx_freq(freq, i) self.uhd_rfnoc_streamer_radio_0.set_rx_gain(gain, i) self.uhd_rfnoc_streamer_radio_0.set_rx_dc_offset(False, i) self.uhd_rfnoc_streamer_radio_0.set_rx_bandwidth(56e6, 0) self.uhd_rfnoc_streamer_radio_0.set_rx_antenna("RX1", 0) self.uhd_rfnoc_streamer_radio_0.set_clock_source("internal") self.uhd_rfnoc_streamer_fosphor_0 = ettus.rfnoc_fosphor_c( fft_size, self.device3, -1, -1, ) self.uhd_rfnoc_streamer_fosphor_0.set_arg("enable", 3 if (0 >= 0) else 1) self.uhd_rfnoc_streamer_fosphor_0.set_arg("decim", max(2, int(samp_rate / (15 * 64 * fft_size)))) self.uhd_rfnoc_streamer_fosphor_0.set_arg("offset", 0) self.uhd_rfnoc_streamer_fosphor_0.set_arg("scale", 256) self.uhd_rfnoc_streamer_fosphor_0.set_arg("trise", int(trise)) self.uhd_rfnoc_streamer_fosphor_0.set_arg("tdecay", int(tdecay)) self.uhd_rfnoc_streamer_fosphor_0.set_arg("alpha", 63000) self.uhd_rfnoc_streamer_fosphor_0.set_arg("epsilon", 0) self.uhd_rfnoc_streamer_fosphor_0.set_arg("wf_ctrl", {0:0x00, 1:0x81, 2:0x82, 3:0x83}.get(0, 0)) self.uhd_rfnoc_streamer_fosphor_0.set_arg("wf_decim", {0:64, 1:8, 2:64, 3:256}.get(0, 16)) self.uhd_rfnoc_streamer_fft_0 = ettus.rfnoc_generic( self.device3, uhd.stream_args( # TX Stream Args cpu_format="fc32", # TODO: This must be made an option otw_format="sc16", args="", ), uhd.stream_args( # RX Stream Args cpu_format="fc32", # TODO: This must be made an option otw_format="sc16", args="", ), "FFT", -1, -1, ) self.uhd_rfnoc_streamer_fft_0.set_arg("spp", 1024) self.uhd_rfnoc_streamer_fft_0.set_arg("direction", "forward") self.uhd_rfnoc_streamer_fft_0.set_arg("scaling", 1706) self.uhd_rfnoc_streamer_fft_0.set_arg("shift", "normal") self.uhd_rfnoc_streamer_fft_0.set_arg("magnitude_out", "COMPLEX") self.uhd_rfnoc_fosphor_display = Template error: #set $win = 'self._%s_win'%$id ettus.fosphor_display($fft_bins, $pwr_bins, $wf_lines) self.$(id).set_frame_rate($frame_rate) self.$(id).set_frequency_range($center_freq, $samp_rate) self.$(id).set_waterfall($wf_enabled) self.$(id).set_grid($grid_enabled) self.$(id).set_palette("$palette") self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget) $(gui_hint()($win)) 'str' object is not callable self.blocks_copy_0_0 = blocks.copy(gr.sizeof_char*fft_size) self.blocks_copy_0_0.set_enabled(True) self.blocks_copy_0 = blocks.copy(gr.sizeof_char*fft_size) self.blocks_copy_0.set_enabled(True) ################################################## # Connections ################################################## self.connect((self.blocks_copy_0, 0), (self.uhd_rfnoc_fosphor_display, 0)) self.connect((self.blocks_copy_0_0, 0), (self.uhd_rfnoc_fosphor_display, 1)) self.connect((self.uhd_rfnoc_streamer_fosphor_0, 0), (self.blocks_copy_0, 0)) self.connect((self.uhd_rfnoc_streamer_fosphor_0, 1), (self.blocks_copy_0_0, 0)) self.device3.connect(self.uhd_rfnoc_streamer_fft_0.get_block_id(), 0, self.uhd_rfnoc_streamer_fosphor_0.get_block_id(), 0) self.device3.connect(self.uhd_rfnoc_streamer_radio_0.get_block_id(), 0, self.uhd_rfnoc_streamer_window_0.get_block_id(), 0) self.device3.connect(self.uhd_rfnoc_streamer_window_0.get_block_id(), 0, self.uhd_rfnoc_streamer_fft_0.get_block_id(), 0) def closeEvent(self, event): self.settings = Qt.QSettings("GNU Radio", "sample_rfnoc") self.settings.setValue("geometry", self.saveGeometry()) event.accept() def get_variable_uhd_device3_0(self): return self.variable_uhd_device3_0 def set_variable_uhd_device3_0(self, variable_uhd_device3_0): self.variable_uhd_device3_0 = variable_uhd_device3_0 def get_trise(self): return self.trise def set_trise(self, trise): self.trise = trise self.uhd_rfnoc_streamer_fosphor_0.set_arg("trise", int(self.trise)) def get_tdecay(self): return self.tdecay def set_tdecay(self, tdecay): self.tdecay = tdecay self.uhd_rfnoc_streamer_fosphor_0.set_arg("tdecay", int(self.tdecay)) def get_samp_rate(self): return self.samp_rate def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.uhd_rfnoc_streamer_radio_0.set_rate(self.samp_rate) self.uhd_rfnoc_streamer_fosphor_0.set_arg("decim", max(2, int(self.samp_rate / (15 * 64 * self.fft_size)))) self.uhd_rfnoc_fosphor_display.set_frequency_range(self.freq, self.samp_rate) def get_gain(self): return self.gain def set_gain(self, gain): self.gain = gain for i in xrange(1): self.uhd_rfnoc_streamer_radio_0.set_rx_gain(self.gain, i) def get_freq(self): return self.freq def set_freq(self, freq): self.freq = freq for i in xrange(1): self.uhd_rfnoc_streamer_radio_0.set_rx_freq(self.freq, i) self.uhd_rfnoc_fosphor_display.set_frequency_range(self.freq, self.samp_rate) def get_fft_size(self): return self.fft_size def set_fft_size(self, fft_size): self.fft_size = fft_size self.uhd_rfnoc_streamer_window_0.set_window(([int(round(32767 * x)) for x in fft.window_blackman_harris(self.fft_size)])) self.uhd_rfnoc_streamer_fosphor_0.set_arg("decim", max(2, int(self.samp_rate / (15 * 64 * self.fft_size)))) def main(top_block_cls=sample_rfnoc, options=None): if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.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.aboutToQuit.connect(quitting) qapp.exec_() if __name__ == '__main__': main()
_______________________________________________ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com