discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: Exporting 2d arrays


From: Artur Nogueira
Subject: Re: Exporting 2d arrays
Date: Mon, 27 Apr 2020 18:10:39 -0300

Thank you very much for the suggestions, Marcus.
I'll consider all of them and I'll try to think on a solution to the problem you mentioned about the other blocks.

Best regards,
Artur

Em seg., 27 de abr. de 2020 às 13:25, Marcus Müller <address@hidden> escreveu:
Hi Artur,

Two options:

1.

simply set your output signature to a single output, with the itemsize
being the size of one element of your matrix. Use set_output_multiple to
N·M, so that the scheduler knows you'll always produce as many items as
fit into your matrix.

2.

simply set your output signature to a single output, size
N·M·sizeof(element of matrix) and always emit one item that contains all
the data of your matrix.

3.¹

combine. E.g. set your output size to a row size, and
set_output_multiple(N_rows).

Now, you're stuck with the fact that the downstream blocks can't know of
"structure", e.g.  that these N·M items form from approach 1 form a
unit, or that the matrix in approach 2 is N×M and not M×N or N/2×2M. For
a few blocks, that doesn't matter (e.g., if you just want to scale
things with multiply_const), for others it does. Either, you need to
communicate that to these blocks beforehand (e.g. they take parameters
in their constructors so that they know what kind of data to expect), or
you use a stream tag in the very beginning to inform them.

Best regards,
Marcus


¹ ... nobody expects the Spanish Inquisition, just to quote Monty Python.
On 24/04/2020 23.20, Artur Nogueira wrote:
> Hi Marcus,
>
> By "variable", it means "the size is set by the user once and doesn't change
> during runtime" and, most importantly, it can change from one simulation
> to another. In my case, each output terminal from my Python Block is
> connected to a Frequency Sink and therefore it would be unpractical to
> remove or make new connections all the time. So I was wondering if it is
> possible to export a 2-d array in a single output terminal rather than
> exporting N 1-d arrays through N different ports (please find attached a
> pdf file with a simple illustration of my question).
>
> And, by the way, I also have a question regarding the second point that
> you've mentioned ("the same block outputs matrices of different
> length"), but we can discuss it later or in another occasion.
>
> Best regards,
> Artur
>
> Em sex., 24 de abr. de 2020 às 02:55, Marcus Müller <address@hidden
> <mailto:address@hidden>> escreveu:
>
>     Hi Artur,
>
>     does "variable" mean the size is set by the user once and doesn't
>     change
>     during runtime, or does it mean that the same block outputs matrices of
>     different length?
>
>     Another way of thinking about this would be:
>     Is this a block that really produces a _stream of identical items_
>     or is
>     it rather a block that produces _messages of different content_?
>
>     Best regards,
>     Marcus
>
>     On 23/04/2020 17.43, Artur Nogueira wrote:
>      > Hi all,
>      >
>      > I'm using the Python Block for signal processing and I need to
>     export a
>      > matrix for further Fourier analysis.
>      > I think I can 'slice' this matrix into several lines (or columns)
>     and
>      > store each of them in an 1-d output_items[i][:] variable,
>      > i=1,2...,number of lines (or columns).
>      > But considering that the number of lines is user-defined (i.e. it
>     can be
>      > large and variable), it would be unpractical to deal with the Python
>      > Block outputs.
>      >
>      > Do you have a suggestion for this?
>      > Is it possible to export a 2-d array into a single Python Block
>     output?
>      >
>      > Best regards,
>      > Artur
>      >
>      >
>     <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
>      >       Livre de vírus. www.avast.com <http://www.avast.com>
>      >
>     <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>.
>
>      >
>      >
>      > <#m_7329815989545016753_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>


reply via email to

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