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).
Unlike the ImageStim, this type of stimulus cannot be rescaled, rotated or masked (although flipping horizontally or vertically is possible). Drawing will also tend to be marginally slower, because the image isn’t preloaded to the graphics card. The slight advantage, however is that the stimulus will always be in its original aspect ratio, with no interplotation or other transformation, and it is slightly faster to load into PsychoPy.
Determines whether the stimulus should be automatically drawn on every frame flip.
Value should be: True or False. You do NOT need to set this on every frame flip!
Whether every change in this stimulus should be logged automatically
Value should be: True or False. Set to False if your stimulus is updating frequently (e.g. updating its position every frame) and you want to avoid swamping the log file with messages that aren’t likely to be useful.
DEPRECATED. Depth is now controlled simply by drawing order.
Draw the stimulus in its relevant window. You must call this method after every MyWin.flip() if you want the stimulus to appear on that frame and then update the screen again.
True/False. If set to True then the image will be flipped horiztonally (left-to-right). Note that this is relative to the original image, not relative to the current state.
True/False. If set to True then the image will be flipped vertically (top-to-bottom). Note that this is relative to the original image, not relative to the current state.
String. Filename, including relative or absolute path. The image can be any format that the Python Imagin Library can import (almost any). Can also be an image already loaded by PIL.
String or None. The name of the object to be using during logged messages about this stim. If you have multiple stimuli in your experiment this really helps to make sense of log files!
If name = None your stimulus will be called “unnamed <type>”, e.g. visual.TextStim(win) will be called “unnamed TextStim” in the logs.
x,y-pair specifying the he centre of the image relative to the window center. Stimuli can be positioned off-screen, beyond the window!
operations are supported.
Sets autoDraw. Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message
Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message
DEPRECATED. Depth is now controlled simply by drawing order.
Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message.
Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message.
Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message.
Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message.
Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message
None, ‘norm’, ‘cm’, ‘deg’, ‘degFlat’, ‘degFlatPos’, or ‘pix’
If None then the current units of the Window will be used. See Units for the window and stimuli for explanation of other options.
Note that when you change units, you don’t change the stimulus parameters and it is likely to change appearance. Example:
# This stimulus is 20% wide and 50% tall with respect to window
stim = visual.PatchStim(win, units='norm', size=(0.2, 0.5)
# This stimulus is 0.2 degrees wide and 0.5 degrees tall.
stim.units = 'deg'
Should shaders be used to render the stimulus (typically leave as True)
If the system support the use of OpenGL shader language then leaving this set to True is highly recommended. If shaders cannot be used then various operations will be slower (notably, changes to stimulus color or contrast)
Example, drawing same stimulus in two different windows and display simultaneously. Assuming that you have two windows and a stimulus (win1, win2 and stim):
stim.win = win1 # stimulus will be drawn in win1
stim.draw() # stimulus is now drawn to win1
stim.win = win2 # stimulus will be drawn in win2
stim.draw() # it is now drawn in win2
win1.flip(waitBlanking=False) # do not wait for next monitor update
win2.flip() # wait for vertical blanking.
Note that this just changes **default** window for stimulus.
You could also specify window-to-draw-to when drawing::
stim.draw(win1)
stim.draw(win2)