discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] vector sink data


From: abdullah unutmaz
Subject: Re: [Discuss-gnuradio] vector sink data
Date: Fri, 10 Aug 2012 04:05:47 -0700 (PDT)

@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 Reynwar <address@hidden>
To: abdullah unutmaz <address@hidden>; discuss-gnuradio Discussion Group <address@hidden>
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
<address@hidden> wrote:
> 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
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>

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



reply via email to

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