This PR integrates the baseline tasks with LSL and makes a series of improvements to the baseline tasks code itself. They are listed below:
Every time a task writes to its corresponding .csv file, the same line is pushed to LSL in a string format. The correspondence between the .csv files and an LSL stream is 1 to 1. That means each task starts its own LSL Stream.
Files and LSLStreams are closed by the server after the end of each task. I noticed the file was not being closed consistently across the tasks. I moved the responsibility for closing the file to the server. Also, the LSL stream is closed along the file. When I was leaving the LSL streams open, LabRecorder was not detecting data for Ping-Pong. Although I could not find anything related in the LSL documentation, I believe this could be happening because I had multiple streams open.
It's not necessary to type close in the server anymore to move to the next task. The server will detect when all players joined, will inform the experimenter and will just wait just for a confirmation to proceed. The experimenter confirms by pressing Enter.
I added an extra parameter (-t) to the run_client and run_server so we can specify the task to start. This will help us with debugging in the future since we don't have to go through all the tasks to test a single one.
Improvements to the text on the server terminal.
Changes in the stary_lab_recorder script to open a new LabRecorder instance for the baseline tasks. We start recording with the streams offline (red in LabRecorder) because they are not continuous. Once the task begins, the streams will become available and the program will wait for 30 seconds for consumers (LabRecorder) before proceeding so we don't lose any data. In tests in the lab, the waiting time was about 1 second before LabRecorder could detect the stream was active.
A new LabRecorder config file was created for streams related to the baseline tasks.
Note:
The .xdf file will be generated under the baseline_tasks folder in the experiment folder. An example is here: /dev/group/exp_2023_03_27_17/baseline_tasks.
I checked the entries in the .xdf file against the .csv files and they match in all the tasks. It can happen that LSL has one more entry at the end of the .xdf file, but I checked and when that happened, the entry was a duplicate from another that happened in the past. I believe this can happen because of some network issues. In any case, no data was lost. Additionally, I only detected this when I executed the code locally. In the lab, there was no extra data in the LSL part.
This PR integrates the baseline tasks with LSL and makes a series of improvements to the baseline tasks code itself. They are listed below:
Note: