Wednesday, June 23, 2021

回复: the out_items of python block?

Hi Marcus,
Do you mean that I only performed assignment operations on out_items[0][1] to out_items[0][9], and I did not perform any operations on other out_items[0][i], and then reported to GNURadio? ?
I observed the performance of "QT GUI Time sink", which is a graph resembling a rectangular signal, which seems understandable because I assigned a value of 0.5 to out_items[0][1] to out_items[0][9]. As time goes by, the rectangular signal moves to the right. If you look more closely, the width of the rectangular signal has actually changed! I really don't understand.
Please forgive me for being stupid, but hope someone can help me explain it in detail.
Sincerely
Liu Maolin


------------------ 原始邮件 ------------------
发件人: "Marcus Müller" <mmueller@gnuradio.org>;
发送时间: 2021年6月23日(星期三) 晚上8:26
收件人: "discuss-gnuradio"<discuss-gnuradio@gnu.org>;
主题: Re: the out_items of python block?

Hi liumaolin,

>     def work(self, input_items, output_items):
>         """example: multiply with constant"""
>         for i in range(10) :

You can't do that: you need to make sure you've got at least 10 output items to fill!

>        return len(output_items[0])

Here you tell GNU Radio that you produced `len(output_items[0])` items, where in reality
you produced 10, which might (and will) be less or more than `len(output_items[0])`!

Best regards,
Marcus

No comments:

Post a Comment