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
> [email protected]
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to