Previous topic

Polygon

Next topic

RatingScale

This Page

Quick links

RadialStim

class psychopy.visual.RadialStim(win, tex='sqrXsqr', mask='none', units='', pos=(0.0, 0.0), size=(1.0, 1.0), radialCycles=3, angularCycles=4, radialPhase=0, angularPhase=0, ori=0.0, texRes=64, angularRes=100, visibleWedge=(0, 360), rgb=None, color=(1.0, 1.0, 1.0), colorSpace='rgb', dkl=None, lms=None, contrast=1.0, opacity=1.0, depth=0, rgbPedestal=(0.0, 0.0, 0.0), interpolate=False, name='', autoLog=True)

Stimulus object for drawing radial stimuli, like an annulus, a rotating wedge, a checkerboard etc...

Ideal for fMRI retinotopy stimuli!

Many of the capabilities are built on top of the PatchStim.

This stimulus is still relatively new and I’m finding occasional gliches. it also takes longer to draw than a typical PatchStim, so not recommended for tasks where high frame rates are needed.

Parameters :
win :

a Window object (required)

tex :

The texture forming the image

  • ‘sqrXsqr’, ‘sinXsin’, ‘sin’,’sqr’,None
  • or the name of an image file (most formats supported)
  • or a numpy array (1xN, NxNx1, NxNx3) ranging -1:1
mask :

Unlike the mask in the PatchStim, this is a 1-D mask dictating the behaviour from the centre of the stimulus to the surround.

units : None, ‘norm’, ‘cm’, ‘deg’ 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.

pos :

a tuple (0.0,0.0) or a list [0.0,0.0] for the x and y of the centre of the stimulus. Stimuli can be position beyond the window!

size :

a tuple (0.5,0.5) or a list [0.5,0.5] for the x and y OR a single value (which will be applied to x and y). Sizes can be negative and stimuli can extend beyond the window.

ori :

orientation of stimulus in degrees.

texRes : (default= 128 )

resolution of the texture (if not loading from an image file)

angularRes : (default= 100 )

100, the number of triangles used to make the sti

radialPhase :

the phase of the texture from the centre to the perimeter of the stimulus

angularPhase :

the phase of the texture around the stimulus

color:

Could be a:

  • web name for a color (e.g. ‘FireBrick’);
  • hex value (e.g. ‘#FF0047’);
  • tuple (1.0,1.0,1.0); list [1.0,1.0, 1.0]; or numpy array.

If the last three are used then the color space should also be given See Color spaces

colorSpace:

the color space controlling the interpretation of the color See Color spaces

contrast : (default= 1.0 )

How far the stimulus deviates from the middle grey. Contrast can vary -1:1 (this is a multiplier for the values given in the color description of the stimulus)

opacity :

1.0 is opaque, 0.0 is transparent

depth:

The depth argument is deprecated and may be removed in future versions. Depth is controlled simply by drawing order.

name : string

The name of the object to be using during logged messages about this stim

clearTextures()

Clear the textures associated with the given stimulus. As of v1.61.00 this is called automatically during garbage collection of your stimulus, so doesn’t need calling explicitly by the user.

draw(win=None)

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.

If win is specified then override the normal window of this stimulus.

setAngularCycles(value, operation='')

set the number of cycles going around the stimulus

setAngularPhase(value, operation='')

set the angular phase of the texture

setAutoDraw(val)

Add or remove a stimulus from the list of stimuli that will be automatically drawn on each flip

Parameters :
  • val: True/False

    True to add the stimulus to the draw list, False to remove it

setAutoLog(val=True)

Turn on (or off) autoLogging for this stimulus.

Parameters :
  • val: True (default) or False
setColor(color, colorSpace=None, operation='')

Set the color of the stimulus. See Color spaces for further information about the various ways to specify colors and their various implications.

Parameters :
color :

Can be specified in one of many ways. If a string is given then it is interpreted as the name of the color. Any of the standard html/X11 color names <http://www.w3schools.com/html/html_colornames.asp> can be used. e.g.:

myStim.setColor('white')
myStim.setColor('RoyalBlue')#(the case is actually ignored)

A hex value can be provided, also formatted as with web colors. This can be provided as a string that begins with # (not using python’s usual 0x000000 format):

myStim.setColor('#DDA0DD')#DDA0DD is hexadecimal for plum

You can also provide a triplet of values, which refer to the coordinates in one of the Color spaces. If no color space is specified then the color space most recently used for this stimulus is used again.

myStim.setColor([1.0,-1.0,-1.0], ‘rgb’)#a red color in rgb space myStim.setColor([0.0,45.0,1.0], ‘dkl’) #DKL space with elev=0, azimuth=45 myStim.setColor([0,0,255], ‘rgb255’) #a blue stimulus using rgb255 space

Lastly, a single number can be provided, x, which is equivalent to providing [x,x,x].

myStim.setColor(255, ‘rgb255’) #all guns o max

colorSpace : string or None

defining which of the Color spaces to use. For strings and hex values this is not needed. If None the default colorSpace for the stimulus is used (defined during initialisation).

operation : one of ‘+’,’-‘,’*’,’/’, or ‘’ for no operation (simply replace value)

for colors specified as a triplet of values (or single intensity value) the new value will perform this operation on the previous color

thisStim.setColor([1,1,1],’rgb255’,’+’)#increment all guns by 1 value thisStim.setColor(-1, ‘rgb’, ‘*’) #multiply the color by -1 (which in this space inverts the contrast) thisStim.setColor([10,0,0], ‘dkl’, ‘+’)#raise the elevation from the isoluminant plane by 10 deg
setContr(newContr, operation='')

Set the contrast of the stimulus

setContrast(value, operation='')
setDKL(newDKL, operation='')

DEPRECATED since v1.60.05: Please use setColor

setDepth(newDepth, operation='')
setLMS(newLMS, operation='')

DEPRECATED since v1.60.05: Please use setColor

setMask(value)
setOpacity(newOpacity, operation='')
setOri(newOri, operation='')

Set the stimulus orientation in degrees

setPhase(value, operation='')
setPos(newPos, operation='', units=None)

Set the stimulus position in the specified (or inherited) units

setRGB(newRGB, operation='')

DEPRECATED since v1.60.05: Please use setColor

setRadialCycles(value, operation='')

set the number of texture cycles from centre to periphery

setRadialPhase(value, operation='')

set the radial phase of the texture

setSF(value, operation='')
setSize(value, operation='')
setTex(value)
setUseShaders(val=True)

Set this stimulus to use shaders if possible.