-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repetitive query of coil.amplitude freezes the process #7
Comments
Please add a minimal script to reproduce the error. Generally, this likely occurs if you request the amplitudes too often and too fast. Localite 4.0 answers requests asychronously, and we check on our side that we received an answer for every query. If you query too often too fast, this pipeline can get clogged. This can not be fixed. |
import time
from localite.api import Coil
c = Coil(0)
while True:
c.amplitude
time.sleep(.75) Works for >= 0.8 seconds |
Could be related to the minimal latency between consecutive messages sent by Localite4. Should be settable in the Preference Editor (quote from email):
|
Related: The function coil.amplitude = stimulation_intensity does not return every ~30 calls
A manual change of amplitude on the MagVenture lets the program continue.
seems to solve the problem (0.8 seconds was not enough)
|
It is probably better to remove the request at the end , i.e. Rationale is that we do not want to block an experiment for 1.5 seconds everytime we set a new amplitude. |
Can you test whether this solved the issue? |
Still has problems, probably even more severly, sometimes after the first request. Script with test:
|
During hotspot search, if we want to get the information of coil.amplitude continuously, then we would call amplitude = coil.amplitude. This still have problem, scripts for testing:
|
This issue is persisting in East measure as well and seems to remain unresolved here for West. Currently, it is holding back the Breathing-FES study from starting. When running any form of:
such as that found here with the amplitude request in line 201, either the function In order to prevent this issue with the coming studies, the RMT and HS search scripts (found here) are being adapted to remove coil.amplitude requesting within a while loop. I will comment again and close this issue once this has been implemented. |
This issue is persisting despite removing |
Thanks for the analysis! Very challenging to debug. First of all, the old scripts run fine when the old localite-client was still being used. Therefore, this could be linked to how we deal with Localite missing some of our queries (in former times, we just ignored it, so examiners had to repeat triggering etc.) Now, we expect for every query an answer and the package automatically retries the query if there is no answer in time (see here ). Yet, i think it should only do so for queries containing I can offer two additional speculations. The first is: This is related to repetitive queries to the ethernet stack, especially something intrinsic to Windows 10 OS. This could be tested by running the same code from a Linux machine and see whether the behaviour differs. An alternative (or maybe even linked) explanation is how a while loop is being compiled by CPython. The |
Hi Robert, thanks for the reply . I Just have a few questions: So far, What do you mean by inlining queries? The same error occurs for |
This. A pity the error still occurs.
Probably not. This likely just shows that properties are tricky when turned into bytecode. Considering the error occurs also when the property was inlined, it is likely not due to bytecode, but some other issue with the ethernet and the client/server relationship |
Thanks for the guidance, I'll continue on this direction. |
hey @ethanrich , any update on the status of this issue? |
I failed to solve the connection issue. Ultimately, I reverted to using the Localite Client class from the old branch. |
It is possible to unjam the system by starting a new instance of Coil in a seperate thread. maybe it is possible to find our what is done when starting the thread so that the old thread also runs again |
If I call coil.amplitude for several times without changing the amplitude on the device, it will freeze.
https://github.com/pyreiz/ctrl-localite/blob/master/localite/coil.py#L143
The text was updated successfully, but these errors were encountered: