[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Index Error: output_index < noutputs
From: |
Vasil Velichkov |
Subject: |
Re: Index Error: output_index < noutputs |
Date: |
Sat, 30 Sep 2023 16:26:35 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 |
Hi Jim,
On 29/09/2023 17.58, Elmore’s wrote:
> Thanks for the answer. I thought that since I imported the Receive
> constructor I would be able to create a new instance of the Receive class not
> a new class.
You are creating a new instance (not a new class) and this is exactly your
problem. In freq.py you need to obtain a reference to the instance that has
been created in your top flowgraph and call set_wave_select to this instance.
> Also, since a message is asynchronous I don’t think that will work since I
> need precise timing.
But your solution is not any more synchronous then using messages. In gnuradio
all blocks are running in their own threads in parallel (more or less) and have
their own input and output buffers. Each block consume and produce samples as
fast as it can. The fact that one block currently process the N-th sample does
not necessary means that the other block is also processing this very same N-th
sample. Depending on the sampling rate this other block can be few million
samples behind (if it is a downstream) or ahead. Calling a member function is
not any more synchronous than sending a message because you don't know how far
behind or ahead is the other block. Both solutions are non-deterministic -
every time you run the flowgraph with the same input you would get slightly
different result.
P.S.
Please keep the mailing list address in the loop.
Regards,
Vasil
> Jim
>
> Sent from my iPhone
>
>> On Sep 29, 2023, at 9:55 AM, Vasil Velichkov <vvvelichkov@gmail.com> wrote:
>>
>> Hi Jim,
>>
>>> On 29/09/2023 05.00, Elmore Family wrote:
>>> If I am not properly instantiating the objects then I am very confused. I
>>> don't understand how I could be creating an instance of the FT8_Receive
>>> block outside of the flowgraph.
>>
>> In freq.py on line 64 you are calling the FT8_Receive class constructor.
>>
>> 64 RCV = FT8_Receive()
>>
>> This basically create a new instance FT8_Receive class. Have a look in the
>> python file generated by your top flowgraph (top_block.py), you would have
>> something like
>>
>> 369 self.FT8_Receive_0 = FT8_Receive(
>> 370 wave_select=0,
>> 371 )
>>
>> Here the first instance is created and later this instance gets connected to
>> other blocks in your flowgraph.
>>
>> 384 self.connect((self.Receive, 2), (self.FT8_Receive_0, 0))
>>
>> You can try adding a print statement in FT8_Receive constructor and check
>> how many time it gets printed on your terminal.
>>
>>> If this is the case, how do I create the proper instance?
>>
>> I'm not sure how to pass a reference to this first instance of FT8_Recive to
>> freq.py.
>>
>> I'm usually using message ports when available in order to avoid tight
>> coupling between blocks. The selector block has iindex port that you can use
>> to change the input port, see
>> https://wiki.gnuradio.org/index.php/Selector#Messages
>>
>> Regards,
>> Vasil
>>
>>> -----Original Message----- From: Vasil Velichkov
>>> Sent: Thursday, September 28, 2023 5:00 AM
>>> To: Elmore Family
>>> Cc: discuss-gnuradio@gnu.org
>>> Subject: Re: Index Error: output_index < noutputs
>>>
>>> Hi Elmore,
>>>
>>>> On 28/09/2023 04.58, Elmore Family wrote:
>>>> I moved the Selector code (i.e. set_wave_select(wave_select)) into the
>>>> portion of my code which runs after the flowgraph is running. I still get
>>>> the same error.
>>>
>>> Where did you moved it? Can you provide the modified source code?
>>>
>>> Are you sure that you are calling set_wave_select() to the correct instance
>>> of FT8_Receive block, that is actually part of your flowgraph?
>>>
>>> Previously you were creating a new instance of FT8_Receive block that was
>>> not part of any flowgraph and because of this it would never be run, the
>>> check_topology() would never be called on this specific instance.
>>>
>>> Regards,
>>> Vasil
>>>
>>
>
- Re: Index Error: output_index < noutputs, (continued)
- Re: Index Error: output_index < noutputs, Jeff Long, 2023/09/27
- Re: Index Error: output_index < noutputs, Vasil Velichkov, 2023/09/27
- Re: Index Error: output_index < noutputs, Elmore Family, 2023/09/27
- Re: Index Error: output_index < noutputs, Vasil Velichkov, 2023/09/28
- Re: Index Error: output_index < noutputs, Elmore Family, 2023/09/28
- Re: Index Error: output_index < noutputs, Vasil Velichkov, 2023/09/29
- Message not available
- Re: Index Error: output_index < noutputs,
Vasil Velichkov <=
- Re: Index Error: output_index < noutputs, Marcus Müller, 2023/09/28
- Re: Index Error: output_index < noutputs, Vasil Velichkov, 2023/09/28