discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Tom Rondeau
Subject: Re: [Discuss-gnuradio] About the use of gr.probe_signal_f()
Date: Wed, 15 Feb 2012 22:20:30 -0500

2012/2/15 Wu Ting <address@hidden>

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 Davis [mailto:address@hidden]
Sent: 2012
215 14:29
To: Wu Ting; address@hidden


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 <address@hidden>

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: address@hidden [mailto:address@hidden] On Behalf Of Tom Rondeau
Sent: 2012
215 0:01
To: Wu Ting
Cc: address@hidden
Subject: Re: [Discuss-gnuradio] About the use of gr.probe_signal_f()

 

On Tue, Feb 14, 2012 at 4:00 AM, Wu Ting <address@hidden> 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

 


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

 


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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]