by Jun Zhuang © 2019 Allen Institute email: junz<AT>alleninstitute<DOT>org
The WarpedVisualStim package is a self-contained module for display spherically corrected visual stimuli on a flat screen in visual physiology experiments. It is a wrapper of the "psychopy" package.
The visual stimuli generation and display is implemented in the modules
MonitorSetup.py, StimulusRoutines.py and DisplayStimulus.py.
These modules allow you to display flashing circle, sparse noise,
locally sparse noise, drifting grading circle, static grading circle
and others with spherical correction. The method for spherical
correction is the same as Marshel et al. 2011 (2). These stimulus
routines are highly customizable and designed to give the user
significant flexibility and control in creative experimental design.
It can also interact with a National Instrument equipment to receive trigger and emit timing signals.
Please check the '\examples' folder for example scripts of visual stimulation.
- Jun Zhuang @zhuangj
- John Yearseley @yearsj
- Derric Williams @derricw
- Sumiya Kuroda @sumiya-kuroda
We are planning on occasional updating this tool with no fixed schedule. Community involvement is encouraged through both issues and pull requests.
- python 3.8.10
We use PyQt5 in addition to PsychoPy (PsychoPy does not require Qt library.) You can install Qt 5.15 from here.
cd <package_path>
conda env create -f environment.yml # use 3.8.10 for psychopy==2023.1.0
PYTHONIOENCODING=utf8 source activate base # (Windows Git bash)
PYTHONIOENCODING=utf8 conda activate warpedvisualstim # (Windows cmd) https://stackoverflow.com/questions/59974715/conda-unicodeencodeerror-charmap-codec-cant-encode-character-u2580-in-po
source activate warpedvisualstim # (Mac or Linux)
python setup.py install
pip install -e. # when developing codes
# pip install pytestYou first need to let PsychoPy know which monitors you are using as visual stimulus monitors. Open PsychoPy GUI and navigate Properties > Screen > Show Screen Numbers. This will tell you the screen numbers for each monitor. Edit the protocol json files accordingly.
You need to gamma correct the monitors then. You can use PsychoPy's function for gamma correction if you have one of their supported spectrophotometer. We use LS100. https://psychskills.wordpress.com/2017/04/20/monitor-calibration/ You also need to know that the performance is affected by blanking. Turn on ScanImage and start blanking. Then measure the luminance and Edit the Python file. TODO: Write a script that works with Thorlabs' photodetector.
- Mapping retinotopy: run
main.py. - Mapping feed forwad receptive fields: run
ffRF.py. We use drifting gratings to determine the ffRF.
- pytest
- numpy
- scipy
- matplotlib
- h5py
- pillow
- psychopy
- pyglet
- OpenCV
- scikit-image
- tifffile
- PyDAQmx
- configobj
- sphinx, version 1.6.3 or later (just for documentation)
- numpydoc, version 0.7.0 (just for documentation)
- PyQt5
for detailed installation instructions see the
install page in documentation (doc branch).
- Most image analysis parameters are defined as number of pixels, not microns.
- Works in windows, but not fully tested on Mac and Linux.
- If you are using a new PC, make sure to install miniconda first. you then need to add it to PATH. https://stackoverflow.com/questions/44597662/conda-command-is-not-recognized-on-windows-10. You can delete conda env with
conda remove --name warpedvisualstim --all. - You can launch PsychoPy GUI by simply running
psychopybut only when you use Windows cmd. For whatever reason, it does not work with Git bash. - It occasionally ends up with a weird bug with an error msg
ctypes.ArgumentError: argument 1: <class 'OverflowError'>: int too long to convert. For now, just ignore the msg and restart the conda environemnt. This should fix the problem. - If you are connecting the PC using remote desktop services such as RustDesk, the
psychopygives you warning messagesCouldn't measure a consistent frame rate!at the end of the stimuli.