text
stringlengths
1
93.6k
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())
##################################################
# Blocks
##################################################
self.qtgui_sink_x_0 = qtgui.sink_f(
256, #fftsize
firdes.WIN_HANN, #wintype
50, #fc
250, #bw
"", #name
True, #plotfreq
True, #plotwaterfall
True, #plottime
True, #plotconst
)
self.qtgui_sink_x_0.set_update_time(1.0/100)
self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
self.top_layout.addWidget(self._qtgui_sink_x_0_win)
#test_source = TestSource()
test_source = blocks.udp_source(gr.sizeof_float*1, "127.0.0.1", 9999, 1472, True)
src = UDPSource()
# Signal Conditioning: DC Block and 50 Hz Notch Filter
ch1 = NotchFilter(src.channel1)
#ch1 = src.channel1
#ch1 = NotchFilter(ch1, freq=100)
ch1 = DCBlock(ch1)
#ch1 = BandPass(ch1, 1, 40)
#notched = NotchFilter(notched)
#notched = NotchFilter(notched)
alpha = BandPass(ch1, 8, 12)
alpha.color = 'green'
alpha = RMS(alpha, 0.02)
#alpha = ExponentialAverage(alpha, 5.1)
smr = BandPass(ch1, 9.5, 12.5)
sigs = alpha, smr
rmss = map(RMS, sigs)
#threshold = Threshold(rmss[1], 'increase')
#oscclient = OSCSend(threshold.ratio, '/0x00/filter')
#oscclient = OSCSend(rmss[1], '/0x00/filter')
audio = BandPass(ch1, 7, 12)
audio = ch1
#osci = Oscilloscope(rmss[1])
#osci = Oscilloscope(threshold.ratio)
spec = BarSpectrogram(ch1, lo=0, hi=127, bins=256)
vec = Stream2Vector(ch1)
fft = FFT(vec)
waterfall = WaterfallLines(fft.bins)
#fft = FFT(Stream2Vector(ch1))
osci = Oscilloscope(ch1)
#self.top_layout.addWidget(waterfall.widget)
waterfall.widget.show()
self.top_layout.addWidget(osci.widget)
audiosink = AudioSink(audio)
hlayout = Qt.QHBoxLayout()
hlayout.addWidget(osci.widget)
#\hlayout.addWidget(threshold.widget)
#widget = Qt.QWidget()
#widget.addLayout(hlayout)
#self.top_layout.addLayout(hlayout)
self.top_layout.addWidget(spec.widget)