discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Problem with simple implementation of sink block


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] Problem with simple implementation of sink block
Date: Fri, 12 Feb 2016 12:57:21 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

The histogram sink calculates a histogram over the N last samples, with N set by configuring "number of points"; hence, if that is e.g. 1024 (default value), all counts must be ≤1024 and ∑(counts)=1024.

By the way, your block logic is a bit redundant: GNU Radio gives you then block.ninput_items_read method:

def work(self, input_items, output_items):
    self._i += 1 
    print self._i, self.ninput_items_read(0)
    return len(input_items[0])

Best regards,
Marcus

On 12.02.2016 03:29, Maicon Kist wrote:
Hi,
I am having a problem with a simple block implementation in GNURadio:

I developed a python block to count the quantity of numbers received. 
The problem arises when I compare the quantity of numbers received by my block with the ones counted in a Qt Histogram.

My flowgraph is:

 ————————                  ——————
| Random Source |———— >| my_block    |
 ————————        |         ————— —
                                      |
                                      |
                                      |        ———————— 
                                      |—  >| QT Histo Sink    |
                                               ————————  

When executing, my block prints it received millions of numbers, whereas the QT Histo Sink is showing only a few hundreds.
Any suggestions?


The work function of my block is as follows: 

####################### my block code
def work(self, input_items, output_items):
in0 = input_items[0]
num_input_items = len(in0)

    self._i += 1
    self._num_input_items_total += num_input_items

        if self._i % 10000 == 0:
print self._i, self._num_input_items_total

    return len(in0)
########################


Best Regards
-- 
Maicon Kist

-- 
Maicon Kist


_______________________________________________
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]