-
Notifications
You must be signed in to change notification settings - Fork 5
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
Issues with scan trigger timing #17
Comments
This issue sounds to me like race condition having to do with different startup times for different threads. FlyVR spawns a lot of threads a processes and some of them seem to go about processing things before others are totally initialized. This can lead to tricky bugs when they depend on each other's state. I will need to investigate the scan image triggering code and see if we can create a reproducible example. |
All backend processes should take the opportunity to pre-roll or prepare any buffers before waiting for the start signal over IPC if their start needs to be coordinated.
it would be harmless to make the daqio backend also spin until start signal but there shouldn't be any other backends signaling they are playing items until they have got the start signal. (main process waits for all other backends here Line 146 in 5dac72a
|
(I never saw any races at the start, place to look would be to check that main is waiting for all backends and that they only play the first item after they have signaled their readyness and then waited). aka main does start audio, start video, etc and backends should do init |
I think this is related to issue #18 but it's more specifically about timing so I'll post it here. now that I have the experiment.py's process_state has a stim block and a stop block. what I notice is that I'm inside the stim block, and the timer is already running, before the flyvr shared state says "signaling start". the config file delay is 5, and the first stim plays for a split second before moving on.
if I remove the delay in the config file, then the stimulus plays more normally. @nzjrs maybe I'm misinterpreting the delay field in the config file? what is that supposed to be used for? for now, setting it to 0 mostly solves this problem. I thought that the delay field would delay the experiment start time (i.e. stimulus presentation/stimulus-triggered scan image/various input into the daq). setting the delay to 10, means that the first 10 sec of stim are not played out thru the speakers.... so, this could actually be related to why scan triggering (issue described above) seems to trigger on a second playlist item rather than the first (if the first item's "go" signal occurred during the "delay")...? |
I'm not sure why I added delay - I think it was an old feature from FlyVR1 that I just kept. In simiar assays some long delay at the start to allow (for example) people to leave the room etc is a common feature. As you note, it delays the start signal of the experment main process but does not stop the loop in the experiment being run. You should check https://github.com/murthylab/fly-vr/blob/master/flyvr/control/experiment.py#L147 there is an example of this here https://github.com/murthylab/fly-vr/blob/master/experiments/cl_random_audio_daq.py#L48 you should feel free to make your
could be. if you send a command to play something while the rest of the backends are not yet ready (or waiting in the delay phase for the start signal from the main flyvr.exe process) then the first stimulus would be 'missing'. |
Issues with scan image triggering starting too early or not starting at all. Sometimes it triggers on the second playlist item but not the first.
The text was updated successfully, but these errors were encountered: