Quantcast

Consuming block of data in python block

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Consuming block of data in python block

maiconkist
Hi list,

I'm trying to implement my first GNURadio block in python.

I followed the how_to_square_ff tutorial.

In that block, each input generates an output. Now what I want is to change this behavior so that the how_to_square_ff receives a block of data (512 for example) and output only a single value (I know it is strange, but is only for learning purpose).

How I declare this in my block ?
Now the declaration is  as follow:

                gr.sync_block.__init__(
                                self,
                                name = "my_block",
                                in_sig =  [numpy.float32], # Input signature: 1 float at a time (want 512)
                                out_sig = [numpy.float32], # Output signature: 1 float at a time
                                )

Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming block of data in python block

Sreeraj Rajendran
As Josh explained in [1] input can be anything that you can represent as a numpy data type.

Try using something like
gr.block.__init__(self, name="my block",
                  in_sig=[numpy.dtype((numpy.float32,2))],
                  out_sig=[numpy.float32])


Also go through fixed/arbitrary ratio blocks in [2] for implementing blocks with different rate.

[1]http://www.ruby-forum.com/topic/4407846
[2]https://github.com/guruofquality/grextras/wiki/Blocks-Coding-Guide

-Sreeraj


From: maiconkist <[hidden email]>
To: [hidden email]
Sent: Tuesday, 29 January 2013 7:10 AM
Subject: [Discuss-gnuradio] Consuming block of data in python block

Hi list,

I'm trying to implement my first GNURadio block in python.

I followed the how_to_square_ff tutorial.

In that block, each input generates an output. Now what I want is to change
this behavior so that the how_to_square_ff receives a block of data (512 for
example) and output only a single value (I know it is strange, but is only
for learning purpose).

How I declare this in my block ?
Now the declaration is  as follow:

        gr.sync_block.__init__(
                self,
                name = "my_block",
                in_sig =  [numpy.float32], # Input signature: 1 float at a time (want
512)
                out_sig = [numpy.float32], # Output signature: 1 float at a time
                )

Thanks



--
View this message in context: http://gnuradio.4.n7.nabble.com/Consuming-block-of-data-in-python-block-tp39244.html
Sent from the GnuRadio mailing list archive at Nabble.com.

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



_______________________________________________
Discuss-gnuradio mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming block of data in python block

Martin Braun (CEL)
On Tue, Jan 29, 2013 at 02:00:15PM +0800, Sreeraj Rajendran wrote:

> As Josh explained in [1] input can be anything that you can represent as a
> numpy data type.
>
>
> Try using something like
>
> gr.block.__init__(self, name="my block",
>
>                   in_sig=[numpy.dtype((numpy.float32,2))],
>
>                   out_sig=[numpy.float32])
>
>
>
> Also go through fixed/arbitrary ratio blocks in [2] for implementing blocks
> with different rate.
$ gr_modtool -t decimator -l python BLOCKNAME

will take you there.

M

--
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstra├če 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT -- University of the State of Baden-W├╝rttemberg and
National Laboratory of the Helmholtz Association

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

attachment0 (205 bytes) Download Attachment
Loading...