![]() ![]() repeat ( 2, 1 ) # repeat once on dim 1 elif 'Nx2' in acceptedInput and value. nElements, 1 ) # set to be 2D value = value. resize ( value, ) elif 'Nx1' in acceptedInput and valShpElem : value. shape in if 'scalar' in acceptedInput and value. array ( value, dtype = float ) # Check shape and transform if not appropriate valShpElem = value. 'Nx2': x-y pair for each element """ # Make into an array if not already value = numpy. 'Nx1': vector of values for each element. ![]() currWindow = win def _makeNx2 ( self, value, acceptedInput = ( 'scalar', 'Nx1', 'Nx2' )): """Helper function to change input to Nx2 arrays 'scalar': int/float, 1x1 and 2x1. name, str ( self ))) def _selectWindow ( self, win ): # don't call switch if it's already the curr window if win != globalVars. _updateVertices () # set autoLog now that params have been initialised wantLog = autoLog is None and self. setOris ( oris, log = False ) # set sizes before sfs (sfs may need it formatted) self. setOpacities ( opacities, log = False ) self. setContrs ( contrs, log = False ) # opacities is used by setRgbs, so this needs to be early self. setTex ( elementTex, log = False ) self. setMask ( elementMask, log = False ) self. _dict_ = val2array ( fieldSize, False ) # create textures self. _dict_ = val2array ( fieldPos, False, False ) self. setColors ( colors, colorSpace = colorSpace, log = False ) # Deal with input for fieldpos and fieldsize self. setColors ( rgbs, colorSpace = 'rgb', log = False ) else : self. Please use colors and colorSpace args instead" ) logging. colorSpace = colorSpace if rgbs != None : msg = ( "Use of the rgb argument to ElementArrayStim is deprecated" ". _haveShaders : raise Exception ( "ElementArrayStim requires shaders support" " and floating point textures" ) self. winType = 'pygame' : raise TypeError ( 'ElementArrayStim is not supported in a pygame context' ) if not self. ![]() nElements = nElements # info for each element self. _dict_ = maskParams # unit conversions if units != None and len ( units ): self. win = win # Not pretty (redefined later) but it works! self. autoLog = False # until all params are set self. _init_ ( name = name, autoLog = False ) self. remove ( 'self' ) super ( ElementArrayStim, self ). """ # what local vars are defined (these are the init params) for use by # _repr_ self. nElements : number of elements in the array. See :ref:`units` for explanation of other options. """ def _init_ ( self, win, units = None, fieldPos = ( 0.0, 0.0 ), fieldSize = ( 1.0, 1.0 ), fieldShape = 'circle', nElements = 100, sizes = 2.0, xys = None, rgbs = None, colors = ( 1.0, 1.0, 1.0 ), colorSpace = 'rgb', opacities = 1.0, depths = 0, fieldDepth = 0, oris = 0, sfs = 1.0, contrs = 1, phases = 0, elementTex = 'sin', elementMask = 'gauss', texRes = 48, interpolate = True, name = None, autoLog = None, maskParams = None ): """ :Parameters: win : a :class:`~` object (required) units : **None**, 'height', 'norm', 'cm', 'deg' or 'pix' If None then the current units of the :class:`~` will be used. 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). Suitable for creating 'global form' stimuli or more detailed random dot stimuli. class ElementArrayStim ( MinimalStim, TextureMixin, ColorMixin ): """This stimulus class defines a field of elements whose behaviour can be independently controlled. gl import psychopy # so we can get the _path_ from psychopy import logging from psychopy.visual import Window # tools must only be imported *after* event or MovieStim breaks on win32 # (JWP has no idea why!) from import val2array from import attributeSetter, logAttrib, setAttribute from import convertToPix from import setColor from import MinimalStim, TextureMixin, ColorMixin from. options = False import ctypes GL = pyglet. # Shaders will work but require OpenGL2.0 drivers AND PyOpenGå…ƒ.0+ import pyglet from. # Ensure setting pyglet.options to False is done prior to any # other calls to pyglet or pyglet submodules, otherwise it may not get picked # up by the pyglet GL engine and have no effect. # Distributed under the terms of the GNU General Public License (GPL). Suitable for creating 'global form' stimuli or more detailed random dot stimuli.""" # Part of the PsychoPy library # Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2022 Open Science Tools Ltd. #!/usr/bin/env python # -*- coding: utf-8 -*- """This stimulus class defines a field of elements whose behaviour can be independently controlled. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |