visigoth.stimuli.Grating¶
- class visigoth.stimuli.Grating(win, tex='sin', mask='none', units='', pos=(0.0, 0.0), size=None, sf=None, ori=0.0, phase=(0.0, 0.0), texRes=128, rgb=None, dkl=None, lms=None, color=(1.0, 1.0, 1.0), colorSpace='rgb', contrast=1.0, opacity=None, depth=0, rgbPedestal=(0.0, 0.0, 0.0), interpolate=False, name=None, autoLog=False, autoDraw=False, maskParams=None, pedestal=None)[source]¶
Psychopy grating stimulus with variable luminance pedestal.
Usage is the same as psychopy.visual.grating.GratingStim. See those docs for more information. The only extra parameter is:
pedestal : float
This makes it possible for a grating to fluctuate around a background value that is not mean gray, (i.e. color=0).
This is based on code by Jonathan Peirce, in particular it is based on his shader code and ‘GratingStim’ class. The original code carries the following license:
Part of the PsychoPy library Copyright (C) 2015 Jonathan Peirce Distributed under the terms of the GNU General Public License (GPL).
Accordingly, this code is also licensed under the GNU General Public License (3+).
Psychopy can be found here: http://www.psychopy.org/
- __init__(win, tex='sin', mask='none', units='', pos=(0.0, 0.0), size=None, sf=None, ori=0.0, phase=(0.0, 0.0), texRes=128, rgb=None, dkl=None, lms=None, color=(1.0, 1.0, 1.0), colorSpace='rgb', contrast=1.0, opacity=None, depth=0, rgbPedestal=(0.0, 0.0, 0.0), interpolate=False, name=None, autoLog=False, autoDraw=False, maskParams=None, pedestal=None)[source]¶
Methods
__init__
(win[, tex, mask, units, pos, size, …])clearTextures
()Clear all textures associated with the stimulus.
contains
(x[, y, units])Returns True if a point x,y is inside the stimulus’ border.
draw
([win])Draw the stimulus in its relevant window.
overlaps
(polygon)Returns True if this stimulus intersects another one.
setAutoDraw
(value[, log])Sets autoDraw.
setAutoLog
([value, log])Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message.
setBackColor
(color[, colorSpace, operation, log])setBlendmode
(value[, log])DEPRECATED.
setBorderColor
(color[, colorSpace, …])Hard setter for fillColor, allows suppression of the log message, simultaneous colorSpace setting and calls update methods.
setColor
(color[, colorSpace, operation, log])setContrast
(newContrast[, operation, log])Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message
setDKL
(newDKL[, operation])DEPRECATED since v1.60.05: Please use the color attribute
setDepth
(newDepth[, operation, log])Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message
setFillColor
(color[, colorSpace, operation, log])Hard setter for fillColor, allows suppression of the log message, simultaneous colorSpace setting and calls update methods.
setForeColor
(color[, colorSpace, operation, log])Hard setter for foreColor, allows suppression of the log message, simultaneous colorSpace setting and calls update methods.
setLMS
(newLMS[, operation])DEPRECATED since v1.60.05: Please use the color attribute
setLineColor
(color[, colorSpace, operation, log])setMask
(value[, log])Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message.
setOpacity
(newOpacity[, operation, log])Hard setter for opacity, allows the suppression of log messages and calls the update method
setOri
(newOri[, operation, log])Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message
setPhase
(value[, operation, log])DEPRECATED.
setPos
(newPos[, operation, log])Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message.
setRGB
(newRGB[, operation, log])DEPRECATED since v1.60.05: Please use the color attribute
setSF
(value[, operation, log])DEPRECATED.
setSize
(newSize[, operation, units, log])Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message
setTex
(value[, log])DEPRECATED.
setUseShaders
([value, log])Usually you can use ‘stim.attribute = value’ syntax instead, but use this method if you need to suppress the log message
updateColors
()Placeholder method to update colours when set externally, for example updating the pallette attribute of a textbox
updateOpacity
()Placeholder method to update colours when set externally, for example updating the pallette attribute of a textbox.
Attributes
autoDraw
Determines whether the stimulus should be automatically drawn on every frame flip.
autoLog
Whether every change in this stimulus should be auto logged.
backColor
Alternative way of setting fillColor
blendmode
The OpenGL mode in which the stimulus is draw
borderColor
color
Alternative way of setting foreColor.
colorSpace
The name of the color space currently being used
contrast
A value that is simply multiplied by the color.
depth
DEPRECATED, depth is now controlled simply by drawing order.
fillColor
Set the fill color for the shape.
foreColor
Foreground color of the stimulus
interpolate
Whether to interpolate (linearly) the texture in the stimulus.
lineColor
Alternative way of setting borderColor.
mask
The alpha mask (forming the shape of the image).
maskParams
Various types of input.
name
The name (str) of the object to be using during logged messages about this stim.
opacity
Determines how visible the stimulus is relative to background.
ori
The orientation of the stimulus (in degrees).
pedestal_contrast
Stimulus contrast, accounting for pedestal luminance.
phase
Phase of the stimulus in each dimension of the texture.
pos
The position of the center of the stimulus in the stimulus units
sf
Spatial frequency of the grating texture
size
The size (width, height) of the stimulus in the stimulus units
tex
Texture to used on the stimulus as a grating (aka carrier)
texRes
Power-of-two int.
units
Units to use when drawing.
useShaders
Should shaders be used to render the stimulus (typically leave as True)
verticesPix
This determines the coordinates of the vertices for the current stimulus in pixels, accounting for size, ori, pos and units
win
The
Window
object in which the