[Discuss-gnuradio] set block parameters / variables from cmd line ?

2015-04-03 Thread Andreas Ladanyi

Hi,

i want to run an gnuradio .py application from the command line and want 
to choose parameters (like the frequency or sound level) on the command 
line. So i think about if it is possible to set block parameters / 
variables without graphical sliders or graphical textboxes from the 
command line.


Like:

python application.py -f frequency -s sound_level

cheers,
Andy

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] set block parameters / variables from cmd line ?

2015-04-03 Thread Chris Kuethe
You want a  "Parameter" block, from the Variables section.

On Fri, Apr 3, 2015 at 12:51 AM, Andreas Ladanyi
 wrote:
> Hi,
>
> i want to run an gnuradio .py application from the command line and want to
> choose parameters (like the frequency or sound level) on the command line.
> So i think about if it is possible to set block parameters / variables
> without graphical sliders or graphical textboxes from the command line.
>
> Like:
>
> python application.py -f frequency -s sound_level
>
> cheers,
> Andy
>
> ___
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio



-- 
GDB has a 'break' feature; why doesn't it have 'fix' too?

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] "Run to completion" not working with message passing blocks

2015-04-03 Thread Piotr Krysik
W dniu 02.04.2015 o 15:30, Piotr Krysik pisze:
> W dniu 01.04.2015 o 12:10, Marcus Müller pisze:
>> Hi  Piotr,
>>
>> nice to hear you got a step ahead!
>> so,
>>> I did that and what I obtained was:
>>> ---
>>>   16   Thread 0x7fffbdffb700 (LWP 13462) "python"
>>> pthread_cond_wait@@GLIBC_2.3.2 () at
>>> ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
>>>   3Thread 0x7fffe9720700 (LWP 13449) "gsm_clock_offs1"
>>> pthread_cond_timedwait@@GLIBC_2.3.2 () at
>>> ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
>>> * 1Thread 0x77fc7740 (LWP 13444) "python" 0x778e8da3 in
>>> select () at ../sysdeps/unix/syscall-template.S:81
>>> ---
>> I'd have a blind guess:
>> Thread 16 might be the "surviving" part of a python-spawned Timer()
>> thread, which caused a message _post at another thread, which might be
>> something that hangs if that block's thread no longer exists.
>>
>> Can you switch to that thread:
>> thread 16
>> and then try to get a python backtrace [1]
>> py-bt
>> and maybe a simple C-style backtrace
>> bt
>>
>> that might give you some information what is actually waiting on a
>> condition (which is what I guess from "pthread_cond_wait").
>>
>> Greetings,
>> Marcus
>>
>> [1] for this to work, you might need to follow these instructions from
>> http://gnuradio.org/redmine/projects/gnuradio/wiki/TutorialsGDB:
>>
>> ... make sure that the python development package is installed
>> (|python-devel| on Redhatoids, |python2.7-dev| on Debianoids); for
>> some systems, you should append the content of
>> |/usr/share/doc/{python-devel,python2.7-dev}/gdbinit[.gz]| to your
>> |~/.gdbinit|, and re-start |gdb|.
>>
> Marcus,
>
> Regarding the timer - this is what I thought at first, so I removed it
> from the block. It didn't help, so I removed almost everything leaving
> only message input of the block. But the problem persisted.
>
> I will try you advice with GDB and let everybody know of the result.
>
> Best Regards,
> Piotr
>
> ___
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
Marcus,

I did what you recommended but my knowledge of GDB doesn't let me
interpret what I get to find the probably cause of the problem.

Instead of sending output of GDB I'm sending simple python script so
every interested person can see what doesn't work. Inside the script
there is one message source and one message sink.
The source sends one message to the sink. At the end the program should
exit but it doesn't.

Best Regards,
Piotr Krysik
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 
# Author: Piotr Krysik 

#Program presenting potential problem caused by message passing done
#from Python. The program should exit after sending the message - however this doesn't happen.

from gnuradio import gr
import pmt

class test_msg_source(gr.basic_block):
def __init__(self):
gr.basic_block.__init__(self, name="test_msg_source", in_sig=[], out_sig=[])
self.message_port_register_out(pmt.intern("msgs"))

def send_msg(self):
msg_ppm = pmt.from_double(0.0)
self.message_port_pub(pmt.intern("msgs"), msg_ppm)


class test_msg_sink(gr.basic_block):
def __init__(self):
gr.basic_block.__init__(self, name="test_msg_sink", in_sig=[], out_sig=[])
self.message_port_register_in(pmt.intern("msgs"))
self.set_msg_handler(pmt.intern("msgs"), self.process_msg)

def process_msg(self, msg):
print "Received message:", msg


class test_flowgraph(gr.top_block):
def __init__(self):
gr.top_block.__init__(self, "test_flograph")
self.msg_source = test_msg_source()
self.msg_sink = test_msg_sink()
self.msg_connect((self.msg_source, 'msgs'), (self.msg_sink, 'msgs'))

def trigger_message_transmission(self):
self.msg_source.send_msg()


if __name__ == '__main__':
tb = test_flowgraph()
tb.start()
tb.trigger_message_transmission() 
tb.wait()

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] OOK modulation naming

2015-04-03 Thread Michael Ossmann
Great find, Jeff!  I'm also finding it called "Digital Pulse Interval
and Width Modulation" with the same acronym.  I think it is clearer with
the "and" in there, and that version of the name dates back at least to
1995.

Mike


On Thu, Apr 02, 2015 at 04:24:06PM -0400, Jeff Long wrote:
>
> After way to much searching ... under Anisochronous modulation, there is 
> something called Digital Pulse Interval Width Modulation (DPIWM).
> 
> http://paradise.caltech.edu/papers/thesis010.pdf
> 
> Seems like as good a name as any.
> 
> - Jeff
> 
> On 04/02/2015 03:28 PM, Michael Ossmann wrote:
> > I though NRZI had a constant symbol rate.  I would expect 011101001 in
> > NRZI to look like:
> >
> > _-_--___-
> >
> > Mike
> >
> >
> > On Thu, Apr 02, 2015 at 03:23:57PM -0400, Jeff Long wrote:
> >>
> >> Hey Mike,
> >>
> >> I think that NRZI.
> >>
> >> - Jeff
> >>
> >> On 04/02/2015 02:36 PM, John Ackermann N8UR wrote:
> >>> Why not make the ratio 1:3 and then you could call it Morse PWM. :-)
> >>>
> >>> On 4/2/2015 2:16 PM, Michael Ossmann wrote:
>  A friend recently showed me an OOK modulation that I had never seen
>  before, and I'm wondering if anyone knows a name for this scheme.
> 
>  It is PWM where both the on periods and off periods carry data in their
>  durations.
> 
>  In the example we observed, an on or off period with a duration of two
>  units represents a zero.  An on or off period with a duration of one
>  unit represents a one.  Example:
> 
>  --_-_--_--__-
> 
>  This sequence of amplitudes represents the binary data 011101001.
> 
>  Note that this scheme has a variable data rate.  (Two packets carrying
>  the same number of bits may have different durations.)  Overall,
>  however, the data rate is higher than in a similar looking scheme in
>  which data are encoded only in the on periods.
> 
>  Does anyone know what to call this?  I am tempted to call it Biphase
>  PWM.
> 
>  Thanks,
> 
>  Mike
> 
>  ___
>  Discuss-gnuradio mailing list
>  Discuss-gnuradio@gnu.org
>  https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 
> >>>
> >>> ___
> >>> Discuss-gnuradio mailing list
> >>> Discuss-gnuradio@gnu.org
> >>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> >>
> >>
> >> ___
> >> Discuss-gnuradio mailing list
> >> Discuss-gnuradio@gnu.org
> >> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] set block parameters / variables from cmd line ?

2015-04-03 Thread Andreas Ladanyi
If i use the parameter block with the default "ID=parameter_0" and with 
"Type=Int" and type on the cmd line:


python application.py --parameter_0 10

i get the error message:

application.py: error: no such option: --parameter_0

Do i understand something wrong about the parameter block ?



Am 03.04.2015 um 09:56 schrieb Chris Kuethe:

You want a  "Parameter" block, from the Variables section.

On Fri, Apr 3, 2015 at 12:51 AM, Andreas Ladanyi
 wrote:

Hi,

i want to run an gnuradio .py application from the command line and want to
choose parameters (like the frequency or sound level) on the command line.
So i think about if it is possible to set block parameters / variables
without graphical sliders or graphical textboxes from the command line.

Like:

python application.py -f frequency -s sound_level

cheers,
Andy

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio






___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] set block parameters / variables from cmd line ?

2015-04-03 Thread Chris Kuethe
here's an example.  "python parameter_demo.py --help"

maybe run your script with --help to see what options it will accept...

On Fri, Apr 3, 2015 at 10:20 AM, Andreas Ladanyi
 wrote:
> If i use the parameter block with the default "ID=parameter_0" and with
> "Type=Int" and type on the cmd line:
>
> python application.py --parameter_0 10
>
> i get the error message:
>
> application.py: error: no such option: --parameter_0
>
> Do i understand something wrong about the parameter block ?
>
>
>
>
> Am 03.04.2015 um 09:56 schrieb Chris Kuethe:
>>
>> You want a  "Parameter" block, from the Variables section.
>>
>> On Fri, Apr 3, 2015 at 12:51 AM, Andreas Ladanyi
>>  wrote:
>>>
>>> Hi,
>>>
>>> i want to run an gnuradio .py application from the command line and want
>>> to
>>> choose parameters (like the frequency or sound level) on the command
>>> line.
>>> So i think about if it is possible to set block parameters / variables
>>> without graphical sliders or graphical textboxes from the command line.
>>>
>>> Like:
>>>
>>> python application.py -f frequency -s sound_level
>>>
>>> cheers,
>>> Andy
>>>
>>> ___
>>> Discuss-gnuradio mailing list
>>> Discuss-gnuradio@gnu.org
>>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>>
>>
>



-- 
GDB has a 'break' feature; why doesn't it have 'fix' too?


parameter_demo.grc
Description: Binary data
#!/usr/bin/env python
##
# Gnuradio Python Flow Graph
# Title: Parameter Demo
# Author: Chris Kuethe 
# Generated: Fri Apr  3 10:46:01 2015
##

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()"

from gnuradio import analog
from gnuradio import blocks
from gnuradio import eng_notation
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 wx

class parameter_demo(grc_wxgui.top_block_gui):

def __init__(self, variable_frequency=4000, fixed_frequency=6000):
grc_wxgui.top_block_gui.__init__(self, title="Parameter Demo")

##
# Parameters
##
self.variable_frequency = variable_frequency
self.fixed_frequency = fixed_frequency

##
# Variables
##
self.slider_frequency = slider_frequency = variable_frequency
self.samp_rate = samp_rate = 32000

##
# Blocks
##
_slider_frequency_sizer = wx.BoxSizer(wx.VERTICAL)
self._slider_frequency_text_box = forms.text_box(
	parent=self.GetWin(),
	sizer=_slider_frequency_sizer,
	value=self.slider_frequency,
	callback=self.set_slider_frequency,
	label='slider_frequency',
	converter=forms.int_converter(),
	proportion=0,
)
self._slider_frequency_slider = forms.slider(
	parent=self.GetWin(),
	sizer=_slider_frequency_sizer,
	value=self.slider_frequency,
	callback=self.set_slider_frequency,
	minimum=-15000,
	maximum=15000,
	num_steps=200,
	style=wx.SL_HORIZONTAL,
	cast=int,
	proportion=1,
)
self.Add(_slider_frequency_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.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
self.blocks_add_xx_0 = blocks.add_vcc(1)
self.analog_sig_source_x_1 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, slider_frequency, 1, 0)
self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, fixed_frequency, 1, 0)

##
# Connections
##
self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_0, 0))
self.connect((self.analog_sig_source_x_1, 

Re: [Discuss-gnuradio] set block parameters / variables from cmd line ?

2015-04-03 Thread Andreas Ladanyi

Hi Chris,

That's it. Thank you very much :-)

Andy

Am 03.04.2015 um 19:50 schrieb Chris Kuethe:

here's an example.  "python parameter_demo.py --help"

maybe run your script with --help to see what options it will accept...

On Fri, Apr 3, 2015 at 10:20 AM, Andreas Ladanyi
 wrote:

If i use the parameter block with the default "ID=parameter_0" and with
"Type=Int" and type on the cmd line:

python application.py --parameter_0 10

i get the error message:

application.py: error: no such option: --parameter_0

Do i understand something wrong about the parameter block ?




Am 03.04.2015 um 09:56 schrieb Chris Kuethe:

You want a  "Parameter" block, from the Variables section.

On Fri, Apr 3, 2015 at 12:51 AM, Andreas Ladanyi
 wrote:

Hi,

i want to run an gnuradio .py application from the command line and want
to
choose parameters (like the frequency or sound level) on the command
line.
So i think about if it is possible to set block parameters / variables
without graphical sliders or graphical textboxes from the command line.

Like:

python application.py -f frequency -s sound_level

cheers,
Andy

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio









___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] Top-block does not find Probe Signal block

2015-04-03 Thread Alejandro Pascual Laguna
Hello GNUR's!

I am currently working with a SDR dongle which I want to lock at four different 
frequencies to see four consecutive parts of the spectrum. I have to do so 
because the sampling rate is not enough (2.4 MHz) to see at one glance the 
bandwidth I need (8 MHz). To achieve so I am multiplexing the values I want to 
lock my dongle to but I am getting some errors using the pair of blocks "Probe 
Signal" and "Function Probe" (see the flowgraph in [1] and errors trace [2]). 
By enabling/disabling some blocks I have guessed that the error about the 
overflow is caused by the WX GUI Number Sink, while the error of the 
non-existing attribute appears when I make use of the "variable" defined by the 
block Function Probe.

Of course I have followed the tutorial [3] and still couldn't make it to work.
Thank you very much in advance.

Greetings,
Alejandro

[1] http://imagizer.imageshack.us/a/img673/6338/mw0don.png
[2] http://pastebin.com/Kmxyw250
[3] 
https://gnuradio.org/redmine/projects/gnuradio/wiki/Guided_Tutorial_GRC/61#241-Examining-the-Probe-Signal-Block
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio