Skip to content

Instantly share code, notes, and snippets.

@hamsolodev
Last active August 29, 2015 14:22
Show Gist options
  • Save hamsolodev/989173238a49b1664be6 to your computer and use it in GitHub Desktop.
Save hamsolodev/989173238a49b1664be6 to your computer and use it in GitHub Desktop.
<?xml version='1.0' encoding='ASCII'?>
<?grc format='1' created='3.7.5'?>
<flow_graph>
<timestamp>Thu May 28 11:48:27 2015</timestamp>
<block>
<key>options</key>
<param>
<key>id</key>
<value>top_block</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>title</key>
<value></value>
</param>
<param>
<key>author</key>
<value></value>
</param>
<param>
<key>description</key>
<value></value>
</param>
<param>
<key>window_size</key>
<value>1280, 1024</value>
</param>
<param>
<key>generate_options</key>
<value>wx_gui</value>
</param>
<param>
<key>category</key>
<value>Custom</value>
</param>
<param>
<key>run_options</key>
<value>prompt</value>
</param>
<param>
<key>run</key>
<value>True</value>
</param>
<param>
<key>max_nouts</key>
<value>0</value>
</param>
<param>
<key>realtime_scheduling</key>
<value></value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>_coordinate</key>
<value>(10, 10)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>variable</key>
<param>
<key>id</key>
<value>samp_rate</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>value</key>
<value>2000000</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>_coordinate</key>
<value>(10, 170)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>rational_resampler_xxx</key>
<param>
<key>id</key>
<value>rational_resampler_xxx_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>type</key>
<value>ccc</value>
</param>
<param>
<key>interp</key>
<value>1</value>
</param>
<param>
<key>decim</key>
<value>4</value>
</param>
<param>
<key>taps</key>
<value></value>
</param>
<param>
<key>fbw</key>
<value>0</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>_coordinate</key>
<value>(112, 471)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>analog_wfm_rcv</key>
<param>
<key>id</key>
<value>analog_wfm_rcv_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>quad_rate</key>
<value>500000</value>
</param>
<param>
<key>audio_decimation</key>
<value>1</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>_coordinate</key>
<value>(368, 301)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>rational_resampler_xxx</key>
<param>
<key>id</key>
<value>rational_resampler_xxx_1</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>type</key>
<value>fff</value>
</param>
<param>
<key>interp</key>
<value>48</value>
</param>
<param>
<key>decim</key>
<value>500</value>
</param>
<param>
<key>taps</key>
<value></value>
</param>
<param>
<key>fbw</key>
<value>0</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>_coordinate</key>
<value>(576, 191)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>low_pass_filter</key>
<param>
<key>id</key>
<value>low_pass_filter_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>type</key>
<value>fir_filter_ccf</value>
</param>
<param>
<key>decim</key>
<value>1</value>
</param>
<param>
<key>interp</key>
<value>1</value>
</param>
<param>
<key>gain</key>
<value>2</value>
</param>
<param>
<key>samp_rate</key>
<value>samp_rate</value>
</param>
<param>
<key>cutoff_freq</key>
<value>100000</value>
</param>
<param>
<key>width</key>
<value>1000000</value>
</param>
<param>
<key>win</key>
<value>firdes.WIN_HAMMING</value>
</param>
<param>
<key>beta</key>
<value>6.76</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>_coordinate</key>
<value>(376, 434)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>audio_sink</key>
<param>
<key>id</key>
<value>audio_sink_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>samp_rate</key>
<value>48000</value>
</param>
<param>
<key>device_name</key>
<value></value>
</param>
<param>
<key>ok_to_block</key>
<value>True</value>
</param>
<param>
<key>num_inputs</key>
<value>1</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_coordinate</key>
<value>(600, 364)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>variable_slider</key>
<param>
<key>id</key>
<value>variable_slider_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>label</key>
<value></value>
</param>
<param>
<key>value</key>
<value>87.5e6</value>
</param>
<param>
<key>min</key>
<value>87.5</value>
</param>
<param>
<key>max</key>
<value>108e6</value>
</param>
<param>
<key>num_steps</key>
<value>1000</value>
</param>
<param>
<key>style</key>
<value>wx.SL_HORIZONTAL</value>
</param>
<param>
<key>converver</key>
<value>float_converter</value>
</param>
<param>
<key>grid_pos</key>
<value></value>
</param>
<param>
<key>notebook</key>
<value></value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>_coordinate</key>
<value>(624, 8)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>osmosdr_source</key>
<param>
<key>id</key>
<value>osmosdr_source_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>type</key>
<value>fc32</value>
</param>
<param>
<key>args</key>
<value></value>
</param>
<param>
<key>nchan</key>
<value>1</value>
</param>
<param>
<key>sample_rate</key>
<value>samp_rate</value>
</param>
<param>
<key>freq0</key>
<value>variable_slider_0</value>
</param>
<param>
<key>corr0</key>
<value>0</value>
</param>
<param>
<key>dc_offset_mode0</key>
<value>0</value>
</param>
<param>
<key>iq_balance_mode0</key>
<value>0</value>
</param>
<param>
<key>gain_mode0</key>
<value>False</value>
</param>
<param>
<key>gain0</key>
<value>10</value>
</param>
<param>
<key>if_gain0</key>
<value>20</value>
</param>
<param>
<key>bb_gain0</key>
<value>20</value>
</param>
<param>
<key>ant0</key>
<value></value>
</param>
<param>
<key>bw0</key>
<value>0</value>
</param>
<param>
<key>freq1</key>
<value>100e6</value>
</param>
<param>
<key>corr1</key>
<value>0</value>
</param>
<param>
<key>dc_offset_mode1</key>
<value>0</value>
</param>
<param>
<key>iq_balance_mode1</key>
<value>0</value>
</param>
<param>
<key>gain_mode1</key>
<value>False</value>
</param>
<param>
<key>gain1</key>
<value>10</value>
</param>
<param>
<key>if_gain1</key>
<value>20</value>
</param>
<param>
<key>bb_gain1</key>
<value>20</value>
</param>
<param>
<key>ant1</key>
<value></value>
</param>
<param>
<key>bw1</key>
<value>0</value>
</param>
<param>
<key>freq2</key>
<value>100e6</value>
</param>
<param>
<key>corr2</key>
<value>0</value>
</param>
<param>
<key>dc_offset_mode2</key>
<value>0</value>
</param>
<param>
<key>iq_balance_mode2</key>
<value>0</value>
</param>
<param>
<key>gain_mode2</key>
<value>False</value>
</param>
<param>
<key>gain2</key>
<value>10</value>
</param>
<param>
<key>if_gain2</key>
<value>20</value>
</param>
<param>
<key>bb_gain2</key>
<value>20</value>
</param>
<param>
<key>ant2</key>
<value></value>
</param>
<param>
<key>bw2</key>
<value>0</value>
</param>
<param>
<key>freq3</key>
<value>100e6</value>
</param>
<param>
<key>corr3</key>
<value>0</value>
</param>
<param>
<key>dc_offset_mode3</key>
<value>0</value>
</param>
<param>
<key>iq_balance_mode3</key>
<value>0</value>
</param>
<param>
<key>gain_mode3</key>
<value>False</value>
</param>
<param>
<key>gain3</key>
<value>10</value>
</param>
<param>
<key>if_gain3</key>
<value>20</value>
</param>
<param>
<key>bb_gain3</key>
<value>20</value>
</param>
<param>
<key>ant3</key>
<value></value>
</param>
<param>
<key>bw3</key>
<value>0</value>
</param>
<param>
<key>freq4</key>
<value>100e6</value>
</param>
<param>
<key>corr4</key>
<value>0</value>
</param>
<param>
<key>dc_offset_mode4</key>
<value>0</value>
</param>
<param>
<key>iq_balance_mode4</key>
<value>0</value>
</param>
<param>
<key>gain_mode4</key>
<value>False</value>
</param>
<param>
<key>gain4</key>
<value>10</value>
</param>
<param>
<key>if_gain4</key>
<value>20</value>
</param>
<param>
<key>bb_gain4</key>
<value>20</value>
</param>
<param>
<key>ant4</key>
<value></value>
</param>
<param>
<key>bw4</key>
<value>0</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>_coordinate</key>
<value>(104, 100)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<block>
<key>wxgui_fftsink2</key>
<param>
<key>id</key>
<value>wxgui_fftsink2_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>type</key>
<value>complex</value>
</param>
<param>
<key>title</key>
<value>FFT Plot</value>
</param>
<param>
<key>samp_rate</key>
<value>samp_rate</value>
</param>
<param>
<key>baseband_freq</key>
<value>0</value>
</param>
<param>
<key>y_per_div</key>
<value>10</value>
</param>
<param>
<key>y_divs</key>
<value>10</value>
</param>
<param>
<key>ref_level</key>
<value>0</value>
</param>
<param>
<key>ref_scale</key>
<value>2.0</value>
</param>
<param>
<key>fft_size</key>
<value>1024</value>
</param>
<param>
<key>fft_rate</key>
<value>15</value>
</param>
<param>
<key>peak_hold</key>
<value>False</value>
</param>
<param>
<key>average</key>
<value>False</value>
</param>
<param>
<key>avg_alpha</key>
<value>0</value>
</param>
<param>
<key>win</key>
<value>None</value>
</param>
<param>
<key>win_size</key>
<value></value>
</param>
<param>
<key>grid_pos</key>
<value></value>
</param>
<param>
<key>notebook</key>
<value></value>
</param>
<param>
<key>freqvar</key>
<value>None</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_coordinate</key>
<value>(344, 21)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
</block>
<connection>
<source_block_id>low_pass_filter_0</source_block_id>
<sink_block_id>analog_wfm_rcv_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>rational_resampler_xxx_0</source_block_id>
<sink_block_id>low_pass_filter_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_wfm_rcv_0</source_block_id>
<sink_block_id>rational_resampler_xxx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>rational_resampler_xxx_1</source_block_id>
<sink_block_id>audio_sink_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>osmosdr_source_0</source_block_id>
<sink_block_id>rational_resampler_xxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>osmosdr_source_0</source_block_id>
<sink_block_id>wxgui_fftsink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
</flow_graph>
#!/usr/bin/env python2.7
##################################################
# Gnuradio Python Flow Graph
# Title: Top Block
# Generated: Thu May 28 12:18:41 2015
##################################################
from gnuradio import analog
from gnuradio import audio
from gnuradio import eng_notation
from gnuradio import filter
from gnuradio import gr
from gnuradio import wxgui
from gnuradio.eng_option import eng_option
from gnuradio.fft import window
from gnuradio.filter import firdes
from gnuradio.wxgui import fftsink2
from gnuradio.wxgui import forms
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import osmosdr
import wx
class top_block(grc_wxgui.top_block_gui):
def __init__(self):
grc_wxgui.top_block_gui.__init__(self, title="Top Block")
_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
##################################################
# Variables
##################################################
self.variable_slider_0 = variable_slider_0 = 87.5e6
self.samp_rate = samp_rate = 2000000
##################################################
# Blocks
##################################################
_variable_slider_0_sizer = wx.BoxSizer(wx.VERTICAL)
self._variable_slider_0_text_box = forms.text_box(
parent=self.GetWin(),
sizer=_variable_slider_0_sizer,
value=self.variable_slider_0,
callback=self.set_variable_slider_0,
label='variable_slider_0',
converter=forms.float_converter(),
proportion=0,
)
self._variable_slider_0_slider = forms.slider(
parent=self.GetWin(),
sizer=_variable_slider_0_sizer,
value=self.variable_slider_0,
callback=self.set_variable_slider_0,
minimum=87.5,
maximum=108e6,
num_steps=1000,
style=wx.SL_HORIZONTAL,
cast=float,
proportion=1,
)
self.Add(_variable_slider_0_sizer)
self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
self.GetWin(),
baseband_freq=0,
y_per_div=10,
y_divs=10,
ref_level=0,
ref_scale=2.0,
sample_rate=samp_rate,
fft_size=1024,
fft_rate=15,
average=False,
avg_alpha=None,
title="FFT Plot",
peak_hold=False,
)
self.Add(self.wxgui_fftsink2_0.win)
self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
interpolation=48,
decimation=500,
taps=None,
fractional_bw=None,
)
self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
interpolation=1,
decimation=4,
taps=None,
fractional_bw=None,
)
self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
self.osmosdr_source_0.set_sample_rate(samp_rate)
self.osmosdr_source_0.set_center_freq(variable_slider_0, 0)
self.osmosdr_source_0.set_freq_corr(0, 0)
self.osmosdr_source_0.set_dc_offset_mode(0, 0)
self.osmosdr_source_0.set_iq_balance_mode(0, 0)
self.osmosdr_source_0.set_gain_mode(False, 0)
self.osmosdr_source_0.set_gain(10, 0)
self.osmosdr_source_0.set_if_gain(20, 0)
self.osmosdr_source_0.set_bb_gain(20, 0)
self.osmosdr_source_0.set_antenna("", 0)
self.osmosdr_source_0.set_bandwidth(0, 0)
self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
2, samp_rate, 100000, 1000000, firdes.WIN_HAMMING, 6.76))
self.audio_sink_0 = audio.sink(48000, "", True)
self.analog_wfm_rcv_0 = analog.wfm_rcv(
quad_rate=500000,
audio_decimation=1,
)
##################################################
# Connections
##################################################
self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0))
self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_1, 0))
self.connect((self.rational_resampler_xxx_1, 0), (self.audio_sink_0, 0))
self.connect((self.osmosdr_source_0, 0), (self.rational_resampler_xxx_0, 0))
self.connect((self.osmosdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
def get_variable_slider_0(self):
return self.variable_slider_0
def set_variable_slider_0(self, variable_slider_0):
self.variable_slider_0 = variable_slider_0
self._variable_slider_0_slider.set_value(self.variable_slider_0)
self._variable_slider_0_text_box.set_value(self.variable_slider_0)
self.osmosdr_source_0.set_center_freq(self.variable_slider_0, 0)
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.low_pass_filter_0.set_taps(firdes.low_pass(2, self.samp_rate, 100000, 1000000, firdes.WIN_HAMMING, 6.76))
self.osmosdr_source_0.set_sample_rate(self.samp_rate)
self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
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()"
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
(options, args) = parser.parse_args()
tb = top_block()
tb.Start(True)
tb.Wait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment