Package psychopy :: Module visual
[frames] | no frames]

Module visual

source code

To control the screen and visual stimuli for experiments
Classes
  Window
Used to set up a context in which to draw objects, using either PyGame (python's SDL binding) or pyglet.
  DotStim
This stimulus class defines a field of dots with an update rule that determines how they change on every call to the .draw() method.
  SimpleImageStim
A simple stimulus for loading images from a file and presenting at exactly the resolution and color in the file (subject to gamma correction if set).
  PatchStim
Stimulus object for drawing arbitrary bitmaps, textures and shapes.
  RadialStim
Stimulus object for drawing radial stimuli, like an annulus, a rotating wedge, a checkerboard etc...
  ElementArrayStim
This stimulus class defines a field of elements whose behaviour can be independently controlled.
  MovieStim
A stimulus class for playing movies (mpeg, avi, etc...) in PsychoPy.
  TextStim
Class of text stimuli to be displayed in a :class:`~psychopy.visual.Window`...
  ShapeStim
Create geometric (vector) shapes by defining vertex locations.
  BufferImageStim
Obtain a "screen-shot" (fullscreen, or region) from a buffer, save to a PatchStim()-like RBGA image.
  RatingScale
A class for getting numeric subjective ratings, e.g., on a 1-to-7 scale.
Functions
 
makeRadialMatrix(matrixSize)
Generate a square matrix where each element val is its distance from the centre of the matrix
source code
 
createTexture(tex, id, pixFormat, stim, res=128)
id is the texture ID pixFormat = GL.GL_ALPHA, GL.GL_RGB useShaders is a bool interpolate is a bool (determines whether texture will use GL_LINEAR or GL_NEAREST res is the resolution of the texture (unless a bitmap image is used)
source code
 
getMsPerFrame(myWin, nFrames=60, showVisual=False, msg='', msDelay=0.0)
Assesses the monitor refresh rate (average, median, SD) under current conditions, over at least 60 frames.
source code
Variables
  prefs = preferences.Preferences()
  havePyglet = True
  cTypesOpenGL = True
  havePygame = True
  haveFB = False
  haveGLUT = True
  DEBUG = False
  PLAYING = 1
  PAUSED = 2
  NOT_STARTED = 0
  FINISHED = -1
Function Details

getMsPerFrame(myWin, nFrames=60, showVisual=False, msg='', msDelay=0.0)

source code 

Assesses the monitor refresh rate (average, median, SD) under current conditions, over at least 60 frames.

Records time for each refresh (frame) for n frames (at least 60), while displaying an optional visual. The visual is just eye-candy to show that something is happening when assessing many frames. You can also give it text to display instead of a visual, e.g., msg='(testing refresh rate...)'; setting msg implies showVisual == False. To simulate refresh rate under cpu load, you can specify a time to wait within the loop prior to doing the win.flip(). If 0 < msDelay < 100, wait for that long in ms.

Returns timing stats (in ms) of: - average time per frame, for all frames - standard deviation of all frames - median, as the average of 12 frame times around the median (~monitor refresh rate)

Author:

  • 2010 written by Jeremy Gray