This stimulus class defines a field of elements whose behaviour can be independently controlled. Suitable for creating ‘global form’ stimuli or more detailed random dot stimuli. This stimulus can draw thousands of elements without dropping a frame, but in order to achieve this performance, uses several OpenGL extensions only available on modern graphics cards (supporting OpenGL2.0). See the ElementArray demo.
| Parameters : |
|
|---|
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 the stimulus in its relevant window. You must call this method after every MyWin.update() if you want the stimulus to appear on that frame and then update the screen again.
Set the color of the stimulus. See Color spaces for further information about the various ways to specify colors and their various implications.
| Parameters : |
|---|
Can be specified in one of many ways.
You must 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
Set the contrast for each element. Should either be:
- a single value
- an Nx1 array/list
Set the centre of the array (X,Y)
Set the size of the array on the screen (will override current XY positions of the elements)
Change the mask (all elements have the same mask). Avoid doing this during time-critical points in your script. Uploading new textures to the graphics card can be time-consuming.
Set the opacity for each element. Should either be a single value or an Nx1 array/list
Set the orientation for each element. Should either be a single value or an Nx1 array/list
Set the phase for each element. Should either be:
- a single value
- an Nx1 array/list
- an Nx2 array/list (for separate X and Y phase)
Obselete - users should use setFieldPos or instead of setPos
DEPRECATED (as of v1.74.00). Please use setColors() instead
Set the spatial frequency for each element. Should either be:
- a single value
- an Nx1 array/list
- an Nx2 array/list (spatial frequency of the element in X and Y).
If the units for the stimulus are ‘pix’ or ‘norm’ then the units of sf are cycles per stimulus width. For units of ‘deg’ or ‘cm’ the units are c/cm or c/deg respectively.
Set the size for each element. Should either be:
- a single value
- an Nx1 array/list
- an Nx2 array/list
Change the texture (all elements have the same base texture). Avoid this during time-critical points in your script. Uploading new textures to the graphics card can be time-consuming.
Set the xy values of the element centres (relative to the centre of the field). Values should be:
- None
- an array/list of Nx2 coordinates.
If value is None then the xy positions will be generated automatically, based on the fieldSize and fieldPos. In this case opacity will also be overridden by this function (it is used to make elements outside the field invisible.
Create a new array of self._RGBAs based on self.rgbs. Not needed by the user (simple call setColors())
For element arrays the self.rgbs values correspond to one element so this function also converts them to be one for each vertex of each element
Create a new array of self._maskCoords