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: Tom
Subject: Re: [Discuss-gnuradio] Vector Source variable from file
Date: Mon, 16 Mar 2015 09:37:29 +1100

Thanks Marcus for getting back to me,

You will have to forgive me as i am new to Gnuradio and Python but I will
try my best to answer these.

> 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?

Correct

> 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).

Correct my variable A contains [1,1,0,0] 

> 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?

I could put them in square brackets to look like

[1,0,0,0]
[1,0,0,0,0,0]
etc

> 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


Since I have variable A defined as [1,0,0,0] and variable B defined as
[1,0,0,0,0,0] do you think it's possible with some Python code to get my
vector source to cycle through all possible combinations of those variables
up to four? Hope that makes sense.

A+A+A+A
A+A+A+B
A+A+B+B
A+B+B+B
B+B+B+B
B+B+B+A
B+B+A+A
B+A+A+A
etc...
....
....




reply via email to

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