Vector sink data

Greetings,

I would like to ask you how to read the data stored in a vector sink. I
tried the solutions I found in the discussion list. You can see some
part of my python code below.

##################################################

Connections

##################################################
self.connect((self.my_vec_src, 0), (self.my_thro, 0)) vector_source ->
throttle
self.connect((self.my_thro, 0), (self.my_h, 0)) throttle -> head
self.connect((self.my_h, 0), (self.my_vec_snk, 0)) head -> vector_sink

time.sleep(10)
my_data=self.my_vec_snk.data()
print "data: ",my_data

if name == ‘main’:
parser = OptionParser(option_class=eng_option, usage="%prog:
[options]")
(options, args) = parser.parse_args()
tb = top_block()
tb.Run(True)

Output of the program :

data: ()

I need to read an incoming data to correlate with some predefined data,
vector. If I am not wrong the best solution is to save data in a vector
sink same length as the predefined vector, then applying the
cross-correlation to them. The program above is just a test program to
examine what the vector sink
stores, but I am confused why it does not work, because I saw a similar
working use of a vector sink with USRPs. I already save the data in a
file, but it does not seem to me as a good solution at least due to
possible memory waste, though clearing the file is possible in run-time.

Thanks in advance,
Abdullah

On Thu, Aug 9, 2012 at 1:53 PM, abdullah unutmaz
[email protected] wrote:

vector_source → throttle
parser = OptionParser(option_class=eng_option, usage=“%prog: [options]”)
same length as the predefined vector, then applying the cross-correlation to


Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page

vector_sink is useful if you’re running for a short time, for example
in a test. You can access that data using snk.data() after tb.run()
has completed.
So something like:
tb.run()
time.sleep(10)
my_data = tb.my_vec_snk.data()
print "data: ",my_data

To extract data from a running flow graph use the probe blocks
(gr.probe_signal_*).
tb.start()
time.sleep(10)
my_data = tb.my_probe_signal.level()
print "data: ",my_data

@Ben, first of all thanks for replying.

I tried both of the solutions, the output I get is a vector containing
only zeros,

data: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

When I use probe_signal

data: 0.0

But I was sending a vector composed of eleven elements of a combination
of ones and zeros.It seems extra-ordinary, when I open the file to see
the data I keep, I see two different symbols, ascii-codes, sequenced
periodically after skipping an amount of the first stored data.

What may be the problem, any idea?

  • Abdullah

From: Ben R. [email protected]
To: abdullah unutmaz [email protected]; discuss-gnuradio
Discussion Group [email protected]
Sent: Thursday, August 9, 2012 6:29 PM
Subject: Re: [Discuss-gnuradio] vector sink data

On Thu, Aug 9, 2012 at 1:53 PM, abdullah unutmaz
[email protected] wrote:

vector_source → throttle
parser = OptionParser(option_class=eng_option, usage=“%prog: [options]”)
same length as the predefined vector, then applying the cross-correlation to


Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page

vector_sink is useful if you’re running for a short time, for example
in a test. You can access that data using snk.data() after tb.run()
has completed.
So something like:
tb.run()
time.sleep(10)
my_data = tb.my_vec_snk.data()
print "data: ",my_data

To extract data from a running flow graph use the probe blocks
(gr.probe_signal_*).
tb.start()
time.sleep(10)
my_data = tb.my_probe_signal.level()
print "data: ",my_data

Thanks, I realized what I need to do. Next monday I can try it, probably
it will solve the problem.


From: Ben R. [email protected]
To: abdullah unutmaz [email protected]; discuss-gnuradio
Discussion Group [email protected]
Sent: Friday, August 10, 2012 8:37 PM
Subject: Re: [Discuss-gnuradio] vector sink data

I can’t tell what your problem might be without seeing your entire
script.

A minimal script doing something like this is:

from gnuradio import gr
tb = gr.top_block()
src = gr.vector_source_f([1,2,3,4,5,6])
snk = gr.vector_sink_f()
tb.connect(src, snk)
tb.run()
print(snk.data())

On Fri, Aug 10, 2012 at 4:05 AM, abdullah unutmaz

I can’t tell what your problem might be without seeing your entire
script.

A minimal script doing something like this is:

from gnuradio import gr
tb = gr.top_block()
src = gr.vector_source_f([1,2,3,4,5,6])
snk = gr.vector_sink_f()
tb.connect(src, snk)
tb.run()
print(snk.data())

On Fri, Aug 10, 2012 at 4:05 AM, abdullah unutmaz

Greetings,

Could I set up an ordinary paralel output shift register using
vector_sink or probe_signal?
When I examined both vector_sink & probe_signal, process was ended when
the output was displayed.
But, I need an ongoing data acquisition, though I can get different
outputs from both of the blocks,
I need a flow of samples. If I can set this up, most of the work will be
done.

In main function, I embed

"

tb.run()
time.sleep(10)
my_data = tb.my_vec_snk.data()
print "data: ",my_data

"
into a while(True) loop, but this time everything starts from the
begining, it takes sometime from the FPGA to settle,
and data acquisition cuts down.

As an alternative solution, I keep larger amount of samples than actual
number of samples I need to, and search
the pattern in the kept sequence. But it is time consuming, this study
is for a final year project, when I discuss solutions
with my professor, he decisivelywants the system to be ongoing data
flow, even though in both of the possible
solutions the process ends right after the data is acquired :).

Thanks,
Abdullah


From: abdullah unutmaz [email protected]
To: Ben R. [email protected]; “[email protected]
[email protected]
Sent: Friday, August 10, 2012 3:25 PM
Subject: Re: [Discuss-gnuradio] vector sink data

Thanks, I realized what I need to do. Next monday I can try it, probably
it will solve the problem.

From: Ben R. [email protected]
To: abdullah unutmaz [email protected]; discuss-gnuradio
Discussion Group [email protected]
Sent: Friday, August 10, 2012 8:37 PM
Subject: Re: [Discuss-gnuradio] vector sink data

I can’t tell what your problem might be without seeing your entire
script.

A minimal script doing something like this is:

from gnuradio import gr
tb = gr.top_block()
src = gr.vector_source_f([1,2,3,4,5,6])
snk = gr.vector_sink_f()
tb.connect(src, snk)
tb.run()
print(snk.data())

On Fri, Aug 10, 2012 at 4:05 AM, abdullah unutmaz
[email protected] wrote:

But I was sending a vector composed of eleven elements of a combination of
ones and zeros. It seems extra-ordinary, when I open the file to see the

data I keep, I see two different symbols, ascii-codes, sequenced

Sent: Thursday, August 9, 2012 6:29 PM


##################################################
# Connections
##################################################
self.connect((self.my_vec_src, 0), (self.my_thro, 0))
vector_source → throttle

self.connect((self.my_thro, 0), (self.my_h, 0))

parser = OptionParser(option_class=eng_option, usage=“%prog:
[options]”)
(options, args) = parser.parse_args()
tb = top_block()
tb.Run(True)


sink
stores, but I am confused why it does not work, because I saw a similar
working use of a vector sink with USRPs. I already save the data in a
file,
but it does not seem to me as a good solution at least due to possible
memory waste, though clearing the file is possible in
run-time.
vector_sink is useful if you’re running for a short time, for example

tb.start()

If I am not wrong, I can use “gr.buffer” with “gr.buffer_reader” to
design an exact parallel output shift register,
at least the closest one.

Abdullah


From: Ben R. [email protected]
To: abdullah unutmaz [email protected]
Cc: discuss-gnuradio Discussion Group [email protected]
Sent: Thursday, August 16, 2012 9:57 AM
Subject: Re: [Discuss-gnuradio] vector sink data

tb.start()
while not_finished:
time.sleep(10)
my_data = tb.my_probe_signal.level()
print(my_data)
tb.stop()

You can use gr.probe_signal_vc to grab a vector of data, however
you’ll only grab data every 10 seconds in the above example.
This method will only give you occasional snapshots of the data so
will not allow an exhaustive search.
If you want to do an exhaustive search then writing a custom signal
processing block in C++ is the way to go.

Ben

On Thu, Aug 16, 2012 at 12:28 AM, abdullah unutmaz

tb.start()
while not_finished:
time.sleep(10)
my_data = tb.my_probe_signal.level()
print(my_data)
tb.stop()

You can use gr.probe_signal_vc to grab a vector of data, however
you’ll only grab data every 10 seconds in the above example.
This method will only give you occasional snapshots of the data so
will not allow an exhaustive search.
If you want to do an exhaustive search then writing a custom signal
processing block in C++ is the way to go.

Ben

On Thu, Aug 16, 2012 at 12:28 AM, abdullah unutmaz

Hwy, I know its been almost a decade. But I am stuck with some problem as follows, which is somewhat similair to what you had gone though. My questions are:

  1. Do we need a vector source as well in order to access vector sink?

  2. I am using a USRP (Ettus B210) and my objective is to print the RSSI values in a text file. My setup is two USRP in 3.75 Ghz operating and one USRP sends packets while other receives. My receiving program is USRP source —> complex to mag2 —> vector sink.
    where to put the above code (given in docs of vector sink gnuradio)? Does it work?