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: Ben Reynwar
Subject: Re: [Discuss-gnuradio] vector sink data
Date: Thu, 16 Aug 2012 06:57:37 -0700

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
<address@hidden> wrote:
> 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 decisively wants 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 <address@hidden>
> To: Ben Reynwar <address@hidden>; "address@hidden"
> <address@hidden>
> 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 Reynwar <address@hidden>
> To: abdullah unutmaz <address@hidden>; discuss-gnuradio
> Discussion Group <address@hidden>
> 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
> <address@hidden> wrote:
>> @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
>>
>>
>
>
>
> _______________________________________________
> 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]