[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Integrate block outputting inconsistent results.
From: |
Marcus Müller |
Subject: |
Re: [Discuss-gnuradio] Integrate block outputting inconsistent results. |
Date: |
Fri, 20 Dec 2013 13:43:04 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Actually, if it worked reliably before, then there might actually be a
regression or something that should be better documented. Can you
share the top_block's source?
Greetings,
Marcus
On 20.12.2013 13:36, Miguel Duarte wrote:
> It worked.
>
> I don't think it's about file opening permissions, it must be
> something else, but it did the trick. The reason I don't think it's
> about permissions is that the files are different, therefore the
> handle shouldn't even be the same, or am I wrong in thinking so?
>
> Don't know why I need to take this care now, I've used this script
> a LOT of times before and this was the first time this happened
> (fresh GR install on a new computer).
>
> Thanks a lot Marcus,
>
> Best Regards,
>
> Miguel
>
>
>
>
>
> 2013/12/20 Marcus Müller <address@hidden>
>
> Hi Miguel, don't shame yourself too much. We all make mistakes.
>
> It could be that B can't open the file it wants to write, because
> the file_sink of A still has it open. After the A.stop() have an
> A.wait() and an A = None. The wait call should let your program
> wait until all blocks are finished and no samples are left stuck in
> the flowgraph somewhere. The None-assignment should cause Python to
> deconstruct A, causing Swig to call the destructor of the C++
> blocks and thus in turn should close the file_sink's file. Sadly,
> Python is a modern language/runtime and has lazy garbage
> collection. So in some cases, it might happen that python decides
> that it should clean up later instead of instantly at the A=None;
> then we still have a problem. To solve that, you might overload
> your top_block's stop() method, making sure that it calls
> miguels_file_sink.close() after stopping the flowgraph:
>
> class detector(grc_wxgui.top_block): ... def stop(self):
> grc_wxgui.top_block.stop(self) self.miguels_file_sink.close()
>
> Hopefully, that helps.
>
> Greetings, Marcus
>
> On 20.12.2013 00:10, Miguel Duarte wrote:
>>>> I hope this doesn't start a new thread. I wanted to answer on
>>>> my thread but I didn't get my own message on my inbox so.. I
>>>> hope it works.
>>>>
>>>>
>>>> I ended up getting what was wrong, and I feel ashamed on so
>>>> many levels, I'm sorry. I was using complex data. Damn.
>>>>
>>>> Anyway, after changing everything, it all works as expected.
>>>> So I delved a little into what was causing my troubles
>>>> initially.
>>>>
>>>> It seems that my top block class "refuses" to be instanced
>>>> twice, with two different identifiers.
>>>>
>>>> So let's say I have a
>>>>
>>>>
>>>> class detector(grc_wxgui.top_block_gui) def __init__(self,
>>>> options):
>>>>
>>>> Where I start an instance A with a certain set of options and
>>>> an instance B with other options.
>>>>
>>>> I do: A = detector(options) A.start() time.sleep(x) A.stop()
>>>>
>>>> change options
>>>>
>>>> B = detector(options) B.start() time.sleep(x) B.stop()
>>>>
>>>> I have a file sink in the flow graph. With instance A it
>>>> writes everything, with instance B it doesn't. Nothing is
>>>> changing the top block, and even with the options parameter
>>>> switched only A works.
>>>>
>>>> Is there something in this new release which prevents this
>>>> from working?
>>>>
>>>> Thanks in advance,
>>>>
>>>> Miguel.
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Discuss-gnuradio mailing list address@hidden
>>>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>>
>>
>> _______________________________________________ Discuss-gnuradio
>> mailing list address@hidden
>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJStDtYAAoJEAFxB7BbsDrL5HkIAJ5A1uOcoB1A9Zi7t0R6Fwz1
HMBrq3cTgq+j+RLA1FsxAN4vuihOudpuI1TWldsK9AI2H7O5Is9GzlT53V/XCBi6
ugx5qH4WewgxrZjdqJ/EftJ/VIHLEb4hOFARA7Aq4v1N7fosxeOqBMX4wu7nLD0P
UuKIS2hWi97/yUVfBM8s+WKN+3SiNY0zziQs+oc8WfhgiRVK3SRLMPYjWJYoRAAY
PQsdr8GNRYQah7bqAqrRxX2wneZyAje7mHvfR/5fqk+DxrFlAaPnAyycaz0MAOtM
qJTWI89LdFmdoPIAf7+GAj7RBKDtcgeOOKU4JZv2/dhAcrGy1bVuC5+9BuWpwR0=
=4qYc
-----END PGP SIGNATURE-----