About the use of gr.probe_signal_f()

Hi all,

I’m trying to read the real-time value of a stream from USRP. I’m
considering using gr.probe_signal_f, but it seems to not work. I’m
really
new to GNURadio, so please forgive me if I ask some stupid question.

My method is like this:

#First generate a source from USRP:

self.source = uhd.usrp_source(device_addr=’’,
stream_args=uhd.stream_args(‘fc32’, ‘sc16’), args=‘scalar=1024’)

#change from complex to interleaved short:

op1 = gr.complex_to_interleaved_short()

#change from short to float

op2 = gr.short_to_float()

#create probe

self.probe = gr.probe_signal_f()

self.connect(self.source, op1, op2, self.probe)

And in a true while loop, I print the value of the probe, but the value
is
always 0.0

Could anyone tell me what is the problem? And is there any better way to
realize this function?

Thanks.

Wu

On Tue, Feb 14, 2012 at 4:00 AM, Wu Ting <
[email protected]> wrote:

My method is like this:****
#change from complex to interleaved short:****

And in a true while loop, I print the value of the probe, but the value is


Wu

Hi Wu,
A couple of things. First, you’re doing one too many operations. You are
going from complex float to short to float. You could just go from
complex
to float. There is gr.complex_to_float that will provide two output
streams for I and Q; complex_to_real or complex_to_imag for each stream
independently; of you could use complex_to_mag or complex_to_mag_squared
for the magnitude of the complex number.

Second, and the main reason for your question, is that you are never
running the flow graph. You construct a flow graph using the connect
functions, but that doesn’t start any samples running through it. So,
given
the class you’ve defined here, call it wu_top_block, we need to return
an
object:

tb = wu_top_block()

Then you need to run the flowgraph:

tb.start()

This will start your system running and collecting data. After this, you
should be able to set a while loop to look at the data:

while(1):
print tb.probe.value()
time.sleep(1000)

So the value get’s printed every second.

Something like that.

Tom

Hi Tom,

Thank you very much for your detailed explanation. That really works!

I really want to learn more about GNURadio by myself. But I dont know
how
should I go on. How can I find the right function/module/block for some
specific purpose? Do you have any suggestion?

Thanks again.

Wu

From: [email protected] [mailto:[email protected]] On Behalf Of
Tom
Rondeau
Sent: 2012215 0:01
To: Wu Ting
Cc: [email protected]
Subject: Re: [Discuss-gnuradio] About the use of gr.probe_signal_f()

On Tue, Feb 14, 2012 at 4:00 AM, Wu Ting
<[email protected]
jp> wrote:

Hi all,

Im trying to read the real-time value of a stream from USRP. Im
considering using gr.probe_signal_f, but it seems to not work. Im really
new to GNURadio, so please forgive me if I ask some stupid question.

My method is like this:

#First generate a source from USRP:

self.source = uhd.usrp_source(device_addr=,
stream_args=uhd.stream_args(fc32, sc16), args=scalar=1024)

#change from complex to interleaved short:

op1 = gr.complex_to_interleaved_short()

#change from short to float

op2 = gr.short_to_float()

#create probe

self.probe = gr.probe_signal_f()

self.connect(self.source, op1, op2, self.probe)

And in a true while loop, I print the value of the probe, but the value
is
always 0.0

Could anyone tell me what is the problem? And is there any better way to
realize this function?

Thanks.

Wu

Hi Wu,

A couple of things. First, you’re doing one too many operations. You are
going from complex float to short to float. You could just go from
complex
to float. There is gr.complex_to_float that will provide two output
streams
for I and Q; complex_to_real or complex_to_imag for each stream
independently; of you could use complex_to_mag or complex_to_mag_squared
for
the magnitude of the complex number.

Second, and the main reason for your question, is that you are never
running
the flow graph. You construct a flow graph using the connect functions,
but
that doesn’t start any samples running through it. So, given the class
you’ve defined here, call it wu_top_block, we need to return an object:

tb = wu_top_block()

Then you need to run the flowgraph:

tb.start()

This will start your system running and collecting data. After this, you
should be able to set a while loop to look at the data:

while(1):

print tb.probe.value()

time.sleep(1000)

So the value get’s printed every second.

Something like that.

Tom

http://gnuradio.org/doc/doxygen/modules.html is a good place to browse
what
available.

2012/2/15 Wu Ting [email protected]

Thanks. This site is helpful. It would be really great if it has some
examples for each function.

Wu

From: Andrew D. [mailto:removed_em[email protected]]
Sent: 2012215 14:29
To: Wu Ting; [email protected]
Subject: Re: [Discuss-gnuradio] About the use of gr.probe_signal_f()

http://gnuradio.org/doc/doxygen/modules.html is a good place to browse
what
available.

2012/2/15 Wu Ting [email protected]

Hi Tom,

Thank you very much for your detailed explanation. That really works!

I really want to learn more about GNURadio by myself. But I dont know
how
should I go on. How can I find the right function/module/block for some
specific purpose? Do you have any suggestion?

Thanks again.

Wu

From: [email protected] [mailto:[email protected]] On Behalf Of
Tom
Rondeau
Sent: 2012215 0:01
To: Wu Ting
Cc: [email protected]
Subject: Re: [Discuss-gnuradio] About the use of gr.probe_signal_f()

On Tue, Feb 14, 2012 at 4:00 AM, Wu Ting
<[email protected]
jp> wrote:

Hi all,

Im trying to read the real-time value of a stream from USRP. Im
considering using gr.probe_signal_f, but it seems to not work. Im really
new to GNURadio, so please forgive me if I ask some stupid question.

My method is like this:

#First generate a source from USRP:

self.source = uhd.usrp_source(device_addr=,
stream_args=uhd.stream_args(fc32, sc16), args=scalar=1024)

#change from complex to interleaved short:

op1 = gr.complex_to_interleaved_short()

#change from short to float

op2 = gr.short_to_float()

#create probe

self.probe = gr.probe_signal_f()

self.connect(self.source, op1, op2, self.probe)

And in a true while loop, I print the value of the probe, but the value
is
always 0.0

Could anyone tell me what is the problem? And is there any better way to
realize this function?

Thanks.

Wu

Hi Wu,

A couple of things. First, you’re doing one too many operations. You are
going from complex float to short to float. You could just go from
complex
to float. There is gr.complex_to_float that will provide two output
streams
for I and Q; complex_to_real or complex_to_imag for each stream
independently; of you could use complex_to_mag or complex_to_mag_squared
for
the magnitude of the complex number.

Second, and the main reason for your question, is that you are never
running
the flow graph. You construct a flow graph using the connect functions,
but
that doesn’t start any samples running through it. So, given the class
you’ve defined here, call it wu_top_block, we need to return an object:

tb = wu_top_block()

Then you need to run the flowgraph:

tb.start()

This will start your system running and collecting data. After this, you
should be able to set a while loop to look at the data:

while(1):

print tb.probe.value()

time.sleep(1000)

So the value get’s printed every second.

Something like that.

Tom

2012/2/15 Wu Ting [email protected]

Thanks. This site is helpful. It would be really great if it has some
examples for each function.****


Wu

Wu,
There are lots of examples, but they don’t necessarily cover every block
in
GNU Radio. Another place to look, though, is in the QA code. This is
code
used during a ‘make test/check’ to verify that the code produces the
correct results. We try to make QA code cover all cases of a block,
and
they are nice in that they are generally the simplest possible flowgraph
needed to run the block being tested (vector_source_x -> block ->
vector_sink_x).

The QA code can be found in a few different locations. For new top-level
blocks (like gr-digital), you can find it in the ‘python’ directory.
They
are all named with a ‘qa_’ prefix.

The majority of the QA code, though, is for the blocks in gnuradio-core.
You’ll find these in gnuradio-core/src/python/gnuradio/gr. Again with
the
‘qa_’ naming convention.

To run a stand-along QA code, it’s easiest if you’re using the cmake
build,
because it uses ctest to run them. You can run a specific test by using
a
regular expression match by passing the -R option to ctest and -V to
make
it verbose. Say you wanted to run just the gr_fft_filter test, you can
use
‘ctest -V -R fft_filter’. The regular expression will match just that
code.
You can get fancier, too, if you want.

Now that you bring it up, since these programs are spread throughout the
code and are not just Python programs you can necessarily just run
(since
they work as part of a test suite), I could see a small project set up
using CGRAN and/or Github to hold a set of small programs used just as
examples of a particular block.

Tom

Hi Tom,

Thank you for your information. Reading examples are currently a major
way for me to learn GR. I will try to read and run the QA code as you
introduced.

Wu

From: [email protected] [mailto:[email protected]] On Behalf Of
Tom R.
Sent: 2012年2月16日 12:21
To: Wu Ting
Cc: Andrew D.; [email protected]
Subject: Re: [Discuss-gnuradio] About the use of gr.probe_signal_f()

2012/2/15 Wu Ting [email protected]

Thanks. This site is helpful. It would be really great if it has some
examples for each function.

Wu

Wu,

There are lots of examples, but they don’t necessarily cover every block
in GNU Radio. Another place to look, though, is in the QA code. This is
code used during a ‘make test/check’ to verify that the code produces
the correct results. We try to make QA code cover all cases of a
block, and they are nice in that they are generally the simplest
possible flowgraph needed to run the block being tested (vector_source_x
-> block -> vector_sink_x).

The QA code can be found in a few different locations. For new top-level
blocks (like gr-digital), you can find it in the ‘python’ directory.
They are all named with a ‘qa_’ prefix.

The majority of the QA code, though, is for the blocks in gnuradio-core.
You’ll find these in gnuradio-core/src/python/gnuradio/gr. Again with
the ‘qa_’ naming convention.

To run a stand-along QA code, it’s easiest if you’re using the cmake
build, because it uses ctest to run them. You can run a specific test by
using a regular expression match by passing the -R option to ctest and
-V to make it verbose. Say you wanted to run just the gr_fft_filter
test, you can use ‘ctest -V -R fft_filter’. The regular expression will
match just that code. You can get fancier, too, if you want.

Now that you bring it up, since these programs are spread throughout the
code and are not just Python programs you can necessarily just run
(since they work as part of a test suite), I could see a small project
set up using CGRAN and/or Github to hold a set of small programs used
just as examples of a particular block.

Tom

From: Andrew D. [mailto:[email protected]]
Sent: 2012年2月15日 14:29
To: Wu Ting; [email protected]

Subject: Re: [Discuss-gnuradio] About the use of gr.probe_signal_f()

http://gnuradio.org/doc/doxygen/modules.html is a good place to browse
what available.

2012/2/15 Wu Ting [email protected]

Hi Tom,

Thank you very much for your detailed explanation. That really works!

I really want to learn more about GNURadio by myself. But I don’t know
how should I go on. How can I find the right function/module/block for
some specific purpose? Do you have any suggestion?

Thanks again.

Wu

From: [email protected] [mailto:[email protected]] On Behalf Of
Tom R.
Sent: 2012年2月15日 0:01
To: Wu Ting
Cc: [email protected]
Subject: Re: [Discuss-gnuradio] About the use of gr.probe_signal_f()

On Tue, Feb 14, 2012 at 4:00 AM, Wu Ting
[email protected] wrote:

Hi all,

I’m trying to read the real-time value of a stream from USRP. I’m
considering using gr.probe_signal_f, but it seems to not work. I’m
really new to GNURadio, so please forgive me if I ask some stupid
question.

My method is like this:

#First generate a source from USRP:

self.source = uhd.usrp_source(device_addr=’’,
stream_args=uhd.stream_args(‘fc32’, ‘sc16’), args=’scalar=1024’)

#change from complex to interleaved short:

op1 = gr.complex_to_interleaved_short()

#change from short to float

op2 = gr.short_to_float()

#create probe

self.probe = gr.probe_signal_f()

self.connect(self.source, op1, op2, self.probe)

And in a true while loop, I print the value of the probe, but the value
is always 0.0

Could anyone tell me what is the problem? And is there any better way to
realize this function?

Thanks.

Wu

Hi Wu,

A couple of things. First, you’re doing one too many operations. You are
going from complex float to short to float. You could just go from
complex to float. There is gr.complex_to_float that will provide two
output streams for I and Q; complex_to_real or complex_to_imag for each
stream independently; of you could use complex_to_mag or
complex_to_mag_squared for the magnitude of the complex number.

Second, and the main reason for your question, is that you are never
running the flow graph. You construct a flow graph using the connect
functions, but that doesn’t start any samples running through it. So,
given the class you’ve defined here, call it wu_top_block, we need to
return an object:

tb = wu_top_block()

Then you need to run the flowgraph:

tb.start()

This will start your system running and collecting data. After this, you
should be able to set a while loop to look at the data:

while(1):

print tb.probe.value()

time.sleep(1000)

So the value get’s printed every second.

Something like that.

Tom


Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs