NOOB needs help with simple.py

Hi all,

I wanna work into this project, as I think its excellent!
My box is a gentoo box running

net-wireless/gnuradio-3.7.3:0/3.7.3 USE=“alsa analog digital examples
fcd filter grc pager qt4 sdl uhd utils wavelet wxwidgets -doc -jack -oss
-performance-counters -portaudio” PYTHON_SINGLE_TARGET=“python2_7”
PYTHON_TARGETS=“python2_7”

For the first experiments I found this page giving a scope and fft
display of the soundcard input,

http://www.funwithelectronics.com/?id=10

the py file looks like this

#!/usr/bin/env python

from gnuradio import gr
from gnuradio.wxgui import stdgui2,fftsink2,scopesink2
import wx

class gnuradioGUI(stdgui2.std_top_block):
def init(self,frame,panel,vbox,argv):
stdgui2.std_top_block.init(self,frame,panel,vbox,argv)

fft = fftsink2.fft_sink_f(panel, title="FFT display", fft_size=512, 

sample_rate=100000)
vbox.Add(fft.win,4,wx.EXPAND)

scope = scopesink2.scope_sink_f(panel, title="Oscilloscope", 

sample_rate=100000)
vbox.Add(scope.win,4,wx.EXPAND)

signal = gr.sig_source_f(100000,gr.GR_SIN_WAVE,20000,1000,0)
throttle = gr.throttle(gr.sizeof_float,100000)
self.connect(signal,throttle)
self.connect(throttle,fft)
self.connect(throttle,scope)

if name == ‘main’:
app = stdgui2.stdapp(gnuradioGUI,“A simple GNU Radio GUI”)
app.MainLoop()

when I try to start this

#python2.7 simple.py

Using Volk machine: avx_32_mmx_orc
Traceback (most recent call last):
File “./simplegui.py”, line 25, in
app = stdgui2.stdapp(gnuradioGUI,“A simple GNU Radio GUI”)
File “/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,
line 46, in init
wx.App.init (self, redirect=False)
File
“/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/_core.py”, line
7981, in init
self._BootstrapApp()
File
“/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/_core.py”, line
7555, in _BootstrapApp
return core.PyApp__BootstrapApp(*args, **kwargs)
File “/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,
line 49, in OnInit
frame = stdframe (self.top_block_maker, self.title, self._nstatus)
File “/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,
line 76, in init
self.panel = stdpanel (self, self, top_block_maker)
File “/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,
line 98, in init
self.top_block = top_block_maker (frame, self, vbox, sys.argv)
File “./simplegui.py”, line 18, in init
signal = gr.sig_source_f(100000,gr.GR_SIN_WAVE,20000,1000,0)
AttributeError: ‘module’ object has no attribute ‘sig_source_f’

but then nothing is displayed

can someone experienced please give me a hint??

Hi Sebastian,
I admit I did not go through your whole post, since that would require
reading someone else’s python. Most likely, that website is for an older
version of GNU Radio, and that’s why you can’t import some stuff;
gr.block_name looks like pre-3.7 GNU Radio.

I always encourage people to start off with the beginners’ tutorials[1]
over at gnuradio.org, since we, as a community, try to make sure that
they don’t become obsolete, and only look at tutorials elsewhere once
they are used to GNU Radio enough to understand what’s going on with a
little research themselves.

So: do not be discouraged to continue learning, it’s really fun and
rewarding!
Happy Hacking,
Marcus

[1] http://gnuradio.org/redmine/projects/gnuradio/wiki/Tutorials
As soon as you reach the WritePythonApplications tutorial, they even
have the signal-to-soundcard example, so no need to look elsewhere :wink:

Hi Marcus,

thanks for your honest words.

I figured out howto do it using the grc. Its an interesting tool, and
results can be achieved quickly, even if the problem requires a rather
complex flow.

I am sure I’ll nag about other problems sooner or later :-))


Marcus M. [email protected] schrieb am Di, 1.7.2014:

Betreff: Re: [Discuss-gnuradio] NOOB needs help with simple.py
An: [email protected]
Datum: Dienstag, 1. Juli, 2014 22:37 Uhr

Hi Sebastian,
I admit I did not go through your whole post,
since that would require
reading someone
else’s python. Most likely, that website is for an
older
version of GNU Radio, and that’s
why you can’t import some stuff;
gr.block_name looks like pre-3.7 GNU Radio.

I always encourage people to
start off with the beginners’ tutorials[1]
over at gnuradio.org, since we, as a community,
try to make sure that
they don’t become
obsolete, and only look at tutorials elsewhere once
they are used to GNU Radio enough to understand
what’s going on with a
little research
themselves.

So: do not be
discouraged to continue learning, it’s really fun and
rewarding!
Happy Hacking,
Marcus

[1] http://gnuradio.org/redmine/projects/gnuradio/wiki/Tutorials
As soon as you reach the
WritePythonApplications tutorial, they even
have the signal-to-soundcard example, so no
need to look elsewhere :wink:

On 01.07.2014 22:20, Sebastian
Heyn wrote:

Hi all,

I wanna work into
this project, as I think its excellent!

My box is a gentoo box running

net-wireless/gnuradio-3.7.3:0/3.7.3
USE=“alsa analog digital examples fcd filter grc pager
qt4 sdl uhd utils wavelet wxwidgets -doc -jack -oss
-performance-counters -portaudio”
PYTHON_SINGLE_TARGET=“python2_7”
PYTHON_TARGETS=“python2_7”

For the first experiments I found this page giving a scope
and fft display of the soundcard input,

Make a simple GNU Radio GUI - Fun With Electronics

the py file looks
like this

#!/usr/bin/env python

from gnuradio import gr
from gnuradio.wxgui import
stdgui2,fftsink2,scopesink2
import
wx

class
gnuradioGUI(stdgui2.std_top_block):

def init(self,frame,panel,vbox,argv):

stdgui2.std_top_block.init(self,frame,panel,vbox,argv)

fft = fftsink2.fft_sink_f(panel, title=“FFT
display”, fft_size=512, sample_rate=100000)

vbox.Add(fft.win,4,wx.EXPAND)

scope = scopesink2.scope_sink_f(panel,
title=“Oscilloscope”, sample_rate=100000)

vbox.Add(scope.win,4,wx.EXPAND)

signal =
gr.sig_source_f(100000,gr.GR_SIN_WAVE,20000,1000,0)
throttle =
gr.throttle(gr.sizeof_float,100000)

self.connect(signal,throttle)

self.connect(throttle,fft)

self.connect(throttle,scope)

if name == ‘main’:
app =
stdgui2.stdapp(gnuradioGUI,“A simple GNU Radio
GUI”)
app.MainLoop()

when I try to start this

#python2.7 simple.py

Using Volk machine:
avx_32_mmx_orc
Traceback (most recent
call last):
File
“./simplegui.py”, line 25, in
app =
stdgui2.stdapp(gnuradioGUI,“A simple GNU Radio
GUI”)
File
“/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,
line 46, in init

wx.App.init (self, redirect=False)

File
“/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/_core.py”,
line 7981, in init

self._BootstrapApp()

File
“/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/_core.py”,
line 7555, in _BootstrapApp

return core.PyApp__BootstrapApp(*args,
**kwargs)

File
“/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,
line 49, in OnInit

frame = stdframe (self.top_block_maker,
self.title, self._nstatus)

File
“/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,
line 76, in init

self.panel = stdpanel (self, self,
top_block_maker)

File
“/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,
line 98, in init

self.top_block = top_block_maker (frame, self,
vbox, sys.argv)

File
“./simplegui.py”, line 18, in init
signal =
gr.sig_source_f(100000,gr.GR_SIN_WAVE,20000,1000,0)
AttributeError: ‘module’ object
has no attribute ‘sig_source_f’

but then nothing is
displayed

can
someone experienced please give me a hint??


Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page


Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page