From Complexity to Simplicity: Using Python Instead of PsychoPy for fNIRS Data Collection

Shayla Sharmin,Md Fahim Abrar,Roghayeh Leila Barmaki
2024-11-11
Abstract:This paper discusses the improvements made by replacing the PsychoPy script with a simplified Python code, reducing the number of devices and enhancing the experiment's overall efficiency in fNIRS based studies.
Human-Computer Interaction
What problem does this paper attempt to address?
The problem that this paper attempts to solve is: to simplify the complexity of experimental settings in the process of functional near - infrared spectroscopy (fNIRS) data collection. Specifically, the authors hope to reduce the number of devices, simplify the code, and improve the overall efficiency of the experiment by using Python instead of PsychoPy. ### Problem Background In traditional fNIRS data - collection experiments, researchers usually need to use multiple devices and complex software to complete the experimental setup. For example, the original setup requires three laptops: - **L1**: Runs learning materials. - **L2**: Connects to the fNIRS device, runs COBI for data collection, and uses fNIRSoft for data analysis. - **L3**: Runs PsychoPy scripts to present stimuli and trigger the fNIRS device. This setup is not only complex but also error - prone, increasing the difficulty and maintenance cost of the experiment. ### Solution To simplify this process, the authors propose a new experimental setup, replacing PsychoPy scripts with Python scripts. The main improvements of the new setup include: 1. **Reducing the number of devices**: Reducing from three laptops to two (L1 and L2), eliminating the need for L3. 2. **Simplifying the code**: Python scripts are shorter, more readable, and easier to maintain and debug than PsychoPy scripts. 3. **Improving integration and user - friendliness**: Python code can be easily integrated with other Python libraries and provides a graphical user interface (GUI), making experimental operations more intuitive. ### Main Advantages Through these improvements, the new setup brings the following benefits: - **Reducing complexity**: Reducing the number of devices and code complexity, reducing potential failure points. - **Simplifying coding**: Python code is easier to understand and modify, enhancing the flexibility of the experiment. - **Better integration and GUI**: Python code can be easily integrated with other Python applications and provides a user - friendly graphical interface. - **Easier to debug**: It is simpler to debug using standard Python debugging tools such as PDB and Jupyter Notebook. - **Powerful error handling**: Python's `try - except` block provides a robust error handling mechanism. In conclusion, this paper aims to simplify the experimental setup of fNIRS data collection by introducing Python scripts, thereby improving the efficiency, reliability, and maintainability of the experiment.