discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Vector Source variable from file


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] Vector Source variable from file
Date: Sun, 15 Mar 2015 11:07:39 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

Hi Tom,

A few things;
> I have a vector source that repeats and points to two variables A + B
How do I have to read that? Do you have a vector source, and you set its
data to be the concatenation of list A and list B?

> variable A is 1100
I assume you mean that A is [1,1,0,0] (a python list of integers), not
1100 (an integer, which is 1 more than 1099).
> a file that contains a whole bunch of binary combinations separated 
> line by line.
Ah, I think you're talking about a text file containing lines that look
like "11010100101", right? Notice that these are strings of characters,
not binary data.
Why are they separated line by line?

Please confirm I understand you correctly:
You want the vector source to emit the following:
[1,1,0,0,bits,from,the,first,line,1,1,0,0,bits,from,the,second,line,1,1,0,0
....]

If that's the case, it's not impossible to do:

in your vector source, you'll have to put in some ugly-ish python.
Something like

numpy.ravel([ [1,1,0,0] + [ ord(character) - ord("0") for character in
line[:-1]] for line in open("txt.xt","r").readlines() ])

(you might need to add an import block "import numpy" for this to work).

Greetings,
Marcus


On 03/15/2015 04:09 AM, Tom wrote:
> Thanks Mike,
>
> I created python code to open the file which has the random data in in it
> however unfortunately the vector source complains "can only concatenate list
> (not module) to list, not quite sure what I'm doing wrong.
>
> Will keep at it lol
>
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On Behalf Of
> Mike Markowski
> Sent: Sunday, 15 March 2015 11:55 AM
> To: address@hidden
> Subject: Re: [Discuss-gnuradio] Vector Source variable from file
>
> Tom,
>
> I'm new to gnuradio, so let's see if any replies offer better advice. 
> But I did something similar to what you ask.  In my case, the value of the
> variable is a call to my python code.  You can see what I did in the top two
> examples at
>
>    http://udel.edu/~mm/gr/
>
> Both grc file and my code are there.  You can write something that pulls the
> numbers from your file.
>
> Good luck,
> Mike
>
> On 03/14/2015 07:36 PM, Tom wrote:
>> Hi all,
>>
>> I have a vector source that repeats and points to two variables A + B 
>> , within variable A is 1100 is it possible to have variable B point to 
>> a file that contains a whole bunch of binary combinations separated 
>> line by line.
>>
>> Ideally I would like to run a flow graph and upon every repeat cycle 
>> to go down the list of possible combinations within the file for variable
> B.
>> Cheers
> _______________________________________________
> 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]