Tue Sep 18 11:09:06 2018 options author window_size category [GRC Hier Blocks] comment description _enabled True _coordinate (24, 12) _rotation 0 generate_options qt_gui hier_block_src_path .: id dsp_basics_tutorial max_nouts 0 qt_qss_theme realtime_scheduling run_command {python} -u {filename} run_options prompt run True sizing_mode fixed thread_safe_setters title placement (0,0) variable comment _enabled True _coordinate (200, 12) _rotation 0 id samp_rate value 32000 blocks_throttle alias comment affinity _enabled True _coordinate (184, 140) _rotation 0 id blocks_throttle_0 ignoretag True maxoutbuf 0 minoutbuf 0 samples_per_second samp_rate type complex vlen 1 epy_block alias _io_cache ('On Off Keying Tx', 'blk', [], [], [('0', 'complex', 1)], '', []) _source_code """ Embedded Python Blocks: Each time this file is saved, GRC will instantiate the first class it finds to get ports and parameters of your block. The arguments to __init__ will be the parameters. All of them are required to have default values! """ import numpy as np from gnuradio import gr class blk(gr.sync_block): # other base classes are basic_block, decim_block, interp_block def __init__(self): # only default arguments here gr.sync_block.__init__( self, name='On Off Keying Tx', # will show up in GRC in_sig= None, out_sig=[np.complex64] ) self.samples_per_pulse = 15 def work(self, input_items, output_items): if len(output_items[0]) >= self.samples_per_pulse: output_items[0][0:self.samples_per_pulse] = [np.random.randint(2)]*self.samples_per_pulse return self.samples_per_pulse else: return 0 comment _enabled True _coordinate (24, 144) _rotation 0 id epy_block_0 qtgui_freq_sink_x autoscale False average 0.2 axislabels True bw samp_rate alias fc 0 comment ctrlpanel False affinity _enabled 1 fftsize 1024 _coordinate (400, 196) gui_hint _rotation 0 grid False id qtgui_freq_sink_x_0 legend True alpha1 1.0 color1 "blue" label1 width1 1 alpha10 1.0 color10 "dark blue" label10 width10 1 alpha2 1.0 color2 "red" label2 width2 1 alpha3 1.0 color3 "green" label3 width3 1 alpha4 1.0 color4 "black" label4 width4 1 alpha5 1.0 color5 "cyan" label5 width5 1 alpha6 1.0 color6 "magenta" label6 width6 1 alpha7 1.0 color7 "yellow" label7 width7 1 alpha8 1.0 color8 "dark red" label8 width8 1 alpha9 1.0 color9 "dark green" label9 width9 1 maxoutbuf 0 minoutbuf 0 name "" nconnections 1 showports True freqhalf True tr_chan 0 tr_level 0.0 tr_mode qtgui.TRIG_MODE_FREE tr_tag "" type complex update_time 0.10 wintype firdes.WIN_BLACKMAN_hARRIS label Relative Gain ymax 10 ymin -140 units dB qtgui_time_sink_x autoscale False axislabels True alias comment ctrlpanel False affinity entags True _enabled True _coordinate (400, 60) gui_hint _rotation 0 grid False id qtgui_time_sink_x_0 legend True alpha1 1.0 color1 "blue" label1 marker1 -1 style1 1 width1 1 alpha10 1.0 color10 "blue" label10 marker10 -1 style10 1 width10 1 alpha2 1.0 color2 "red" label2 marker2 -1 style2 1 width2 1 alpha3 1.0 color3 "green" label3 marker3 -1 style3 1 width3 1 alpha4 1.0 color4 "black" label4 marker4 -1 style4 1 width4 1 alpha5 1.0 color5 "cyan" label5 marker5 -1 style5 1 width5 1 alpha6 1.0 color6 "magenta" label6 marker6 -1 style6 1 width6 1 alpha7 1.0 color7 "yellow" label7 marker7 -1 style7 1 width7 1 alpha8 1.0 color8 "dark red" label8 marker8 -1 style8 1 width8 1 alpha9 1.0 color9 "dark green" label9 marker9 -1 style9 1 width9 1 name "" nconnections 1 size 200 srate samp_rate stemplot False tr_chan 0 tr_delay 0 tr_level 0.0 tr_mode qtgui.TRIG_MODE_FREE tr_slope qtgui.TRIG_SLOPE_POS tr_tag "" type complex update_time 0.10 ylabel Amplitude yunit "" ymax 1 ymin -1 blocks_throttle_0 qtgui_freq_sink_x_0 0 0 blocks_throttle_0 qtgui_time_sink_x_0 0 0 epy_block_0 blocks_throttle_0 0 0