This project contains a Python script for running a video segmentation experiment using PsychoPy and PyGaze.
- Add argparse for counterbalancing and output file naming
- For the counterbalancing, also make it accessible through an ini or csv file
The project uses a Conda environment. To set up the environment:
-
Ensure you have Anaconda or Miniconda installed.
-
Create the environment using the provided
env.ymlfile:conda env create -f env.ymlAfter creating the environment, you may have to (first, uninstall, and then) reinstall some of these packages manually. Namely,
- python-pygaze
- pygaze
You'll find import statements in terminal and these can be useful to determine which packages need to be reinstalled. E.g.,
An error occurred: No module named 'pygaze.libscreen'This can be done by running the following command in the environment:
pip uninstall <package_name> pip install <package_name>- For example:*
pip uninstall python-pygaze pip install python-pygaze -
Activate the environment:
conda activate NIMH_video_seg
The main dependencies for this project are:
- Python 3.8
- pandas
- sounddevice
- python-pygaze
- pygaze
- psychopy
- moviepy
These are all specified in the env.yml file and will be installed when creating the Conda environment.
The main script video_seg.py contains the following key components:
- Import statements and initial setup
- Audio device configuration
- Experiment configuration (visuals, task order, etc.)
- Functions for displaying text, videos, and handling user input
- Main experiment loop
The script presents a series of video clips to participants and records their responses (spacebar presses) to indicate event boundaries.
To run the experiment:
-
Ensure you're in the correct Conda environment.
-
Run the script with Python:
python video_seg.py -
Follow the on-screen instructions to complete the experiment.
The script generates a CSV file with the experiment data, including timing information for each section of the experiment and participant responses.
Make sure to update the file paths in the script to match your local directory structure before running the experiment.