Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- ##################################################
- # Gnuradio Python Flow Graph
- # Title: Top Block
- # Generated: Tue Oct 29 16:09:12 2013
- ##################################################
- from gnuradio import analog
- from gnuradio import blocks
- from gnuradio import eng_notation
- from gnuradio import gr
- from gnuradio import wxgui
- from gnuradio.eng_option import eng_option
- from gnuradio.filter import firdes
- from gnuradio.wxgui import scopesink2
- from grc_gnuradio import wxgui as grc_wxgui
- from optparse import OptionParser
- import test
- import wx
- class top_block(grc_wxgui.top_block_gui):
- def __init__(self):
- grc_wxgui.top_block_gui.__init__(self, title="Top Block")
- ##################################################
- # Variables
- ##################################################
- self.samp_rate = samp_rate = 32000
- ##################################################
- # Blocks
- ##################################################
- self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
- self.GetWin(),
- title="Scope Plot",
- sample_rate=samp_rate,
- v_scale=0,
- v_offset=0,
- t_scale=0,
- ac_couple=False,
- xy_mode=False,
- num_inputs=1,
- trig_mode=wxgui.TRIG_MODE_AUTO,
- y_axis_label="Counts",
- )
- self.Add(self.wxgui_scopesink2_0.win)
- self.test_square3_ff_0 = test.square3_ff()
- self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate)
- self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)
- ##################################################
- # Connections
- ##################################################
- self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0))
- self.connect((self.blocks_throttle_0, 0), (self.test_square3_ff_0, 0))
- self.connect((self.test_square3_ff_0, 0), (self.wxgui_scopesink2_0, 0))
- # QT sink close method reimplementation
- def get_samp_rate(self):
- return self.samp_rate
- def set_samp_rate(self, samp_rate):
- self.samp_rate = samp_rate
- self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
- self.blocks_throttle_0.set_sample_rate(self.samp_rate)
- self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate)
- if __name__ == '__main__':
- import ctypes
- import os
- if os.name == 'posix':
- try:
- x11 = ctypes.cdll.LoadLibrary('libX11.so')
- x11.XInitThreads()
- except:
- print "Warning: failed to XInitThreads()"
- parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
- (options, args) = parser.parse_args()
- tb = top_block()
- tb.Start(True)
- tb.Wait()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement