Hi Kevin,

Thanks for getting back to me. I guess that makes sense. The only thing I
was planning to use was the scipy.fromfile() function, in hopes that it
would read out the binary data into a 1024-point vector, but I guess that
was the wrong assumption.

Maybe the Head block is a good option - it looks like I should put that in
between the complex_to_mag and the file_sink blocks, right? And there are
two values, num_items and vec_length. By the documentation, it seems like
num_items should be 1024 to match the complex_to_mag's vector length of
1024; however there is a mismatch there, as I get the error "Source IO size
4096 does not match sink IO size 4." I'm not sure what the problem is
though.

And based on your description, vec_length should be 1 and the file sink's
length should also be 1; those do not give any problem. Thanks for the help
again.

On Thu, Sep 8, 2016 at 6:43 PM, Kevin Reid <kpr...@switchb.org> wrote:

> On Thu, Sep 8, 2016 at 6:34 PM, Pavan Yedavalli <psy2...@columbia.edu>
> wrote:
>
>> My current flowgraph consists of a signal source (cosine) ->
>> stream_to_vector of size 1024 -> forward FFT of size 1024 -> complex_to_mag
>> of size 1024 -> file sink of size 1024 (unbuffered OFF and append set to
>> overwrite).
>>
>> After I run this flowgraph for a few seconds and manually stop it, I use
>> scipy.fromfile(open("filename"), dtype=scipy.float32) to retrieve the
>> values from the binary file. However, the length of this output vector is
>> some integer multiple of 1024 every time. Shouldn't it always be 1024
>> because I'm overwriting the file? I noticed that the longer I run the
>> flowgraph, the larger this value is, so it seems like it may not be
>> overwriting? Or perhaps there is something else I need to do make sure that
>> my output is always of length 1024 with just the magnitudes of each sample?
>>
>
> The Vec Length field on the file sink doesn't mean the size of file it
> writes; it means the size of each stream item it writes (as a multiple of
> the input type's size). In your case each stream item is 1024 floats, which
> means exactly that your file will always contain some number of 1024-float
> items, as you have observed.
>
> There is nothing in GNU Radio that will repeatedly overwrite a file as the
> flow graph runs — I suggest you find another way to accomplish your goal.
> What were you planning to use to *read* this file?
>
> (If you just want a single FFT, you can add the Head block in your flow
> graph, set to 1, and the flow graph will exit after writing that one.)
>



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

Reply via email to