Dear All:
OS: Ubuntu 14.01.1
gnu-radio: 3.7.6
Dell Optiplex 765
I want to use the moving_average_vff block from specest, which is
not available in GRC. I tried installing gr-specest using pybombs
(gnuradio was already installed on this system using
"/usr/local/build-gnuradio -m ").
The pybombs installation of gr-specest seemed to go OK, but top_block.py
fails at the “import specest” line nonetheless. The error trace and
the top_block.py that I am using appear below (the top_block.py was
generated from GRC and then slightly modified to included the
moving_average_vff block). A linux “find” command reveals that the
apparently missing .so is in /usr/local/lib/libgnuradio-specest.so.
Should it be somewhere else?
Any help would be greatly appreciated.
Sincerely,
Dan Marlow
marlow@phy-gr5:~/gnuradio/TVRX2$ python top_block.py
Traceback (most recent call last):
File “top_block.py”, line 7, in
import specest
File “/usr/local/lib/python2.7/dist-packages/specest/init.py”,
line 45, in
from specest_swig import *
File “/usr/local/lib/python2.7/dist-packages/specest/specest_swig.py”,
line 28, in
_specest_swig = swig_import_helper()
File “/usr/local/lib/python2.7/dist-packages/specest/specest_swig.py”,
line 24, in swig_import_helper
_mod = imp.load_module(’_specest_swig’, fp, pathname, description)
ImportError: libgnuradio-specest.so: cannot open shared object file: No
such file or directory
marlow@phy-gr5:~/gnuradio/TVRX2$
#!/usr/bin/env python
##################################################
Gnuradio Python Flow Graph
Title: Top Block
Generated: Mon Dec 22 13:34:46 2014
##################################################
import specest
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import fft
from gnuradio import gr
from gnuradio import uhd
from gnuradio.eng_option import eng_option
from gnuradio.fft import window
from gnuradio.filter import firdes
from gnuradio.wxgui import forms
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import time
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.samp_rate = samp_rate = int(5.0e6)
self.gain = gain = 20
self.freq = freq = 400e6
self.N_average = N_average = 4096
self.FFT_size = FFT_size = 128
self.BW = BW = 1700000
##################################################
# Blocks
##################################################
self._gain_text_box = forms.text_box(
parent=self.GetWin(),
value=self.gain,
callback=self.set_gain,
label="RF Gain",
converter=forms.float_converter(),
)
self.Add(self._gain_text_box)
self._freq_text_box = forms.text_box(
parent=self.GetWin(),
value=self.freq,
callback=self.set_freq,
label="Center Frequency",
converter=forms.float_converter(),
)
self.Add(self._freq_text_box)
self.uhd_usrp_source_0 = uhd.usrp_source(
",".join(("addr=192.168.10.2", "")),
uhd.stream_args(
cpu_format="fc32",
channels=range(1),
),
)
self.uhd_usrp_source_0.set_time_source("gpsdo", 0)
self.uhd_usrp_source_0.set_subdev_spec("A:RX1", 0)
self.uhd_usrp_source_0.set_time_now(uhd.time_spec(time.time()),
uhd.ALL_MBOARDS)
self.uhd_usrp_source_0.set_samp_rate(samp_rate)
self.uhd_usrp_source_0.set_center_freq(freq, 0)
self.uhd_usrp_source_0.set_gain(gain, 0)
self.uhd_usrp_source_0.set_bandwidth(BW, 0)
self.fft_vxx_0 = fft.fft_vcc(FFT_size, True,
(window.blackmanharris(FFT_size)), True, 1)
self.blocks_vector_to_stream_0 =
blocks.vector_to_stream(gr.sizeof_float1, FFT_size)
self.blocks_stream_to_vector_0 =
blocks.stream_to_vector(gr.sizeof_gr_complex1, 128)
self.blocks_keep_one_in_n_0 =
blocks.keep_one_in_n(gr.sizeof_float128, N_average)
self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float1,
“./testfile.dat”, False)
self.blocks_file_sink_0.set_unbuffered(False)
self.blocks_complex_to_mag_squared_0 =
blocks.complex_to_mag_squared(FFT_size)
self.vectorAverage=specest.moving_average_vff(N_average,FFT_size,2000)
##################################################
# Connections
##################################################
self.connect((self.fft_vxx_0, 0),
(self.blocks_complex_to_mag_squared_0, 0))
self.connect((self.uhd_usrp_source_0, 0),
(self.blocks_stream_to_vector_0, 0))
self.connect((self.blocks_stream_to_vector_0, 0),
(self.fft_vxx_0, 0))
#self.connect((self.blocks_complex_to_mag_squared_0, 0),
(self.blocks_keep_one_in_n_0, 0))
self.connect((self.blocks_complex_to_mag_squared_0, 0),
(self.vectorAverage, 0))
self.connect((self.vectorAverage, 0), (self.blocks_keep_one_in_n_0,
0))
self.connect((self.blocks_keep_one_in_n_0, 0),
(self.blocks_vector_to_stream_0, 0))
self.connect((self.blocks_vector_to_stream_0, 0),
(self.blocks_file_sink_0, 0))
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.uhd_usrp_source_0.set_samp_rate(self.samp_rate)
def get_gain(self):
return self.gain
def set_gain(self, gain):
self.gain = gain
self._gain_text_box.set_value(self.gain)
self.uhd_usrp_source_0.set_gain(self.gain, 0)
self.uhd_usrp_source_0.set_gain(self.gain, 1)
def get_freq(self):
return self.freq
def set_freq(self, freq):
self.freq = freq
self._freq_text_box.set_value(self.freq)
self.uhd_usrp_source_0.set_center_freq(self.freq, 0)
def get_N_average(self):
return self.N_average
def set_N_average(self, N_average):
self.N_average = N_average
self.blocks_keep_one_in_n_0.set_n(self.N_average)
def get_FFT_size(self):
return self.FFT_size
def set_FFT_size(self, FFT_size):
self.FFT_size = FFT_size
def get_BW(self):
return self.BW
def set_BW(self, BW):
self.BW = BW
self.uhd_usrp_source_0.set_bandwidth(self.BW, 0)
self.uhd_usrp_source_0.set_bandwidth(self.BW, 1)
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()
self.uhd_usrp_source_0.set_gain(self.gain, 1)
def get_freq(self):
return self.freq
def set_freq(self, freq):
self.freq = freq
self._freq_text_box.set_value(self.freq)
self.uhd_usrp_source_0.set_center_freq(self.freq, 0)
def get_N_average(self):
return self.N_average
def set_N_average(self, N_average):
self.N_average = N_average