Data size error

Hello,

I am somewhat new to GNU Radio and have a basic programming question.
I am not a programmer, so I totally expect this to be obvious…

I am trying to create a simple MUX block by using existing C++ code
blocks and just connecting them in python. One of the first things I
am attempting along this route while getting familiar with the code
is to MUX two complex streams together, then decimate that stream to
obtain one of the original streams. I then desire to multiply by a
constant. I define the following:

fg.mux = gr.streams_to_stream(4,2)
fg.decim = gr.keep_one_in_n(4,2)
fg.amp = gr.multiply_const_cc(1)

then connect them later on:
fg.connect(fg.mux, fg.decim, fg.amp)

I get the following error:
“ValueError: source and destination data sizes are different:
keep_one_in_n multiply_const_cc”

Can someone point out to me what I am missing? Or do I need to give
you more info?

Also, I realize that there is probably a better, more flexible way to
implement a MUX block and am open to suggestions.

Thanks!

Dave

Hi Dave,

There is a pre-existing C++ block for muxing multiple streams,
gr.stream_mux(). Check the documentation in the header to understand
how to use it:
http://gnuradio.org/trac/browser/gnuradio/trunk/gnuradio-core/src/lib/general/gr_stream_mux.h

You may also want to look at gr.interleave():
http://gnuradio.org/trac/browser/gnuradio/trunk/gnuradio-core/src/lib/general/gr_interleave.h

What the error is telling you is that the output size of one block is
not the same as the input size of your next block. In other words, if
you try to connect a block that outputs single byte data with a block
that takes complex data as input, it will let you know.

The naming structure of blocks try to give you a hint, if you are using
gr.multiply_const_cc() the _cc suffix says: complex input, complex
output. You may want to read up on:
http://www.gnu.org/software/gnuradio/doc/howto-write-a-block.html

  • George