AAGRIP
AAGRIP
The project
on décrit le projet ici ?
grandes questions :
- comment on assure synchro entre image et son d'une vidéo ?
- qu'est ce qui affecte le signal de nos capteurs de force dans notre setup ? Comment on le corrige au mieux ?
- Est ce que les latences observées pour l'affichage des stimuli n'affectent pas nos données ?
Materials or Hardware
Acquisition Cards
NI acquisition cards -> drivers only available on Windows and not on Linux
Screen
Check the refresh rate of the screen used. The refresh rate may be less than advertised if you don't use a display port cable.
Operating systems usually have a software permanently running to handle the display of the screen. This software can disturb experiment framework to ensure the vertical synchronisation of the screen. On Windows, this software, the Desktop Windows Manager (DWM), prevent the Psychtoolbox to guarantee the constant vertical frame rate of the screen.
F/T Sensors
Power supply of the computer affects the quality of the signal collected with f/t sensors
Arduino
Troubleshootings
Software
Experiment frameworks
Framework available to build experiment : Psychopy, Psychtoolbox, OpenSesame
Psychopy and OpenSesame rely on Python unlike Psychtoolbox which relies on Matlab.
We chose Psychopy for our project because the package already offers some interesting functionalities such as stimuli pre-loading, interval between frames recording, time blocked until the screen is fully displayed, ... Besides, as it relies on Python, it's easier to custom our script to add hardware and/or LSL trigger.
Stimuli pre-loading is handled with the static component in the builder interface of psychopy and it allows us to avoid the delay between the start of the trial and the launch of the stimulus which will depends on the kind and the size of the stimuls.
Psychopy experiment can be launched by command line if you execute the python file in the psychopy installation folder. Create a python virtual environment with the psychoy package doesn't seems to work to launch experiment in it.
Psychopy have 4 different back-ends to handle video files : ffpyplayer, moviepy, opencv, vlc
- ffpyplayer : bug if there is no sound file or if it's corrupted
- moviepy : lot of errors
- opencv : works even without audio file but if we use the static component to preload the video, the audio part launchs briefly at the preload time.
- vlc : error during the initialisation, it may need additionnal package
(Psychopy seems to keep a lot of things in RAM when you run an experiment multiple times so it may be better to restart it regularly)
You can create your experiment from the builder and generate the python file associated after this. If you want to edit this file to add code not supported by the builder, keep in mind that every time you refresh the python file from the builder, it will erase the modifications made in the file.
Loop element in the builder is transcribed in TrialHandler object in code (you won't find any doc on loop element but you can seek for TrialHandler to know more about options and properties).
It's possible to retrieve the frame index of a movie component which is playing. It may not be useful to detect frame drop because it will always give an answer so it may be a parallel processus which look the frame index at a specific interval.
LSL
The lab streaming layer (LSL) is a system for the unified collection of measurement time series in research experiments that handles both the networking, time-synchronization, (near-) real-time access as well as optionally the centralized collection, viewing and disk recording of the data.
The core library liblsl is supported on many languages : C, C++, Python, Matlab, C#, Java. We used Python interface with pylsl library.
You can find explanations and examples on their github for this library.
Discoveries
If you use the resolve_stream() function to find your stream, the script will wait until it finds a stream corresponding to your research. It's better to use resolve_byprop() which gives us more flexibility and we can specify the amount of time the script should wait until finding a stream or the number of streams we are looking for. You also have the possibility to fetch all the streams available in an array with resolve_streams()
Documentation recommends to seek streams by type but you can also look by name or source_id which can be more useful when you are working with multiple streams.
You can do multiple streams in the same script from a single computer but you can't stream and retrieve data in the same script, you will get an error of multicasting.
Troubleshootings
<ref>Une référence [1] </ref> <references />