📜 ⬆️ ⬇️

PsychoPy in Brief

I looked somehow soft available in the Ubuntu application center and came across a thing called "PsychoPy - a program for creating experiments in neurology and experimental psychology." In the search bar, habrahabr introduced “PsychoPy” and the search did not tell me anything interesting. I decided to google and tell the community at the same time about what this thing is.

So meet. PsychoPy.

PsychoPy is software written in Python and using OpenGL to generate various stimuli on a PC. The program is designed to create experiments on neurology and psychology. The user can create various visual and auditory stimuli (stimulants) and interact with external devices (electroencephalography, MEG, image brain activity and other interesting devices). The script structure is simple and straightforward. PsychoPy also allows you to generate a movie and a sequence of images that can help simulate an experiment in neurology.

Introduction
')
Most of the experiments in modern neuroscience do not pass without the presentation of auditory or visual stimuli in order to trace the activity of the GM / study the influence of stimuli and so on ... That is why PsychoPy was invented to make life easier when carrying out this kind of experiment. PsychoPy is the power of the Python language and several cross-platform Python libraries. PsyhoPy is completely platform independent and can be used on Windows, Mac OS X and Linux.

Features:

Modeling language - Python.
Hardware Accelerated Graphics (OpenGL)
Platform-independent software
Modular structure (for example, the line imports modules for visual stimuli and events from the subject of the experiment):

from psychopy import visual, core, event 


Built-in code editor (PsychoPyIDE) that supports code completion, code folding.

Stimuli:

PathStim is one of the most commonly used. It is used to control the visual area on the screen. It may consist of bitmap-data, textures, photos. Supports alpha masks. They can be manipulated in real time in different ways: rotate, shift in phase, change the number of cycles, etc. I use it to study the influence of graphical information.

TextStim - text stimuli (orders, text information). Unicode support. Color, rotation.

Sound - audio stimuli. Supports files mpg, wav, the task of sound using notes and octaves, etc. Support Stereo.

DotStim - a pattern of random points (aka Random Dot Kinematogram) - is an array of points or an array of other stimuli (for example PathStim).

MovieStim is a visual stimulus. Support for various formats (Mpeg, DivX, avi, Quicktime). Supports transformation (rotation, stretching, etc.)

PsychoPy provides easy and complete access to I / O devices via serial and parallel ports (including USB serial / parallel emulators)

And finally, an example script (video sequence player):
 from psychopy import core, visual, event from numpy import ceil #    myWin=visual.Window((1000,1000), allowGUI=False) #  mov=visual.MovieStim(myWin, 'stimulus_movie.mp4', flipVert=False) # fps fps=60 #  total_frames=ceil(fps*mov.duration) #movie duration   print mov.duration #   print mov.format.width, mov.format.height #  t=0 #   mov.draw() #    while t < total_frames: #   myWin.flip() #   mov.draw() #  t=t+1 


Useful links:
Official site
Generating stimuli for neurosince using PsychoPy by JWPeirce
PsyhoPy on the Neural Wiki

Source: https://habr.com/ru/post/140098/


All Articles