Advertisement
Guest User

Bug

a guest
Mar 18th, 2013
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.02 KB | None | 0 0
  1. #!/usr/bin/env python
  2. ##################################################
  3. # Gnuradio Python Flow Graph
  4. # Title: Top Block
  5. # Generated: Mon Mar 18 20:21:59 2013
  6. ##################################################
  7.  
  8. from gnuradio import digital
  9. from gnuradio import eng_notation
  10. from gnuradio import gr
  11. from gnuradio.eng_option import eng_option
  12. from gnuradio.gr import firdes
  13. from gnuradio.wxgui import scopesink2
  14. from grc_gnuradio import blks2 as grc_blks2
  15. from grc_gnuradio import wxgui as grc_wxgui
  16. from optparse import OptionParser
  17. import numpy
  18. import wx
  19.  
  20. class top_block(grc_wxgui.top_block_gui):
  21.  
  22.     def __init__(self):
  23.         grc_wxgui.top_block_gui.__init__(self, title="Top Block")
  24.         _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
  25.         self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
  26.  
  27.         ##################################################
  28.         # Variables
  29.         ##################################################
  30.         self.samp_rate = samp_rate = 32000
  31.  
  32.         ##################################################
  33.         # Blocks
  34.         ##################################################
  35.         self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
  36.             self.GetWin(),
  37.             title="Scope Plot",
  38.             sample_rate=samp_rate,
  39.             v_scale=0,
  40.             v_offset=0,
  41.             t_scale=0,
  42.             ac_couple=False,
  43.             xy_mode=False,
  44.             num_inputs=1,
  45.             trig_mode=gr.gr_TRIG_MODE_AUTO,
  46.             y_axis_label="Counts",
  47.         )
  48.         self.Add(self.wxgui_scopesink2_0.win)
  49.         self.throttle = gr.throttle(gr.sizeof_char*1, samp_rate)
  50.         self.random_source_x_0 = gr.vector_source_b(map(int, numpy.random.randint(0, 256, pow(10,5))), True)
  51.         self.digital_dxpsk_mod_0 = digital.dbpsk_mod(
  52.             samples_per_symbol=16,
  53.             excess_bw=0.35,
  54.             gray_coded=True,
  55.             verbose=False,
  56.             log=False)
  57.            
  58.         self.digital_dxpsk_demod_0 = digital.dbpsk_demod(
  59.             samples_per_symbol=16,
  60.             excess_bw=0.35,
  61.             freq_bw=6.28/100.0,
  62.             phase_bw=6.28/100.0,
  63.             timing_bw=6.28/100.0,
  64.             gray_coded=True,
  65.             verbose=False,
  66.             log=False
  67.         )
  68.         self.blks2_error_rate_0 = grc_blks2.error_rate(
  69.             type='BER',
  70.             win_size=100,
  71.             bits_per_symbol=1,
  72.         )
  73.  
  74.         ##################################################
  75.         # Connections
  76.         ##################################################
  77.         self.connect((self.digital_dxpsk_demod_0, 0), (self.blks2_error_rate_0, 1))
  78.         self.connect((self.blks2_error_rate_0, 0), (self.wxgui_scopesink2_0, 0))
  79.         self.connect((self.random_source_x_0, 0), (self.throttle, 0))
  80.         self.connect((self.throttle, 0), (self.digital_dxpsk_mod_0, 0))
  81.         self.connect((self.throttle, 0), (self.blks2_error_rate_0, 0))
  82.         self.connect((self.digital_dxpsk_mod_0, 0), (self.digital_dxpsk_demod_0, 0))
  83.  
  84.  
  85.     def get_samp_rate(self):
  86.         return self.samp_rate
  87.  
  88.     def set_samp_rate(self, samp_rate):
  89.         self.samp_rate = samp_rate
  90.         self.throttle.set_sample_rate(self.samp_rate)
  91.         self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate)
  92.  
  93. if __name__ == '__main__':
  94.     parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
  95.     (options, args) = parser.parse_args()
  96.     tb = top_block()
  97.     tb.Run(True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement