Opticka 2.16.1
Opticka is an experiment manager for behavioral research.
Loading...
Searching...
No Matches
polarGratingStimulus Class Reference

polar grating stimulus, inherits from baseStimulus POLARGRATINGSTIMULUS inherits from baseStimulus The basic properties are: type = 'radial' or 'circular' or 'spiral' colour = first grating colour colour2 = second grating colour baseColour = the midpoint between the two from where contrast works, defult just inherits the background colour from screenManager correctBaseColour = automatically generate baseColour as the average of colour and colour2 contrast = contrast from 0 - 1 sf = spatial frequency in degrees tf = temporal frequency in degs/s angle = angle in degrees rotateTexture = do we rotate the grating texture (true) or the patch itself (false) phase = phase of grating mask = use circular mask (true) or not (false) More...

Detailed Description

polar grating stimulus, inherits from baseStimulus POLARGRATINGSTIMULUS inherits from baseStimulus The basic properties are: type = 'radial' or 'circular' or 'spiral' colour = first grating colour colour2 = second grating colour baseColour = the midpoint between the two from where contrast works, defult just inherits the background colour from screenManager correctBaseColour = automatically generate baseColour as the average of colour and colour2 contrast = contrast from 0 - 1 sf = spatial frequency in degrees tf = temporal frequency in degs/s angle = angle in degrees rotateTexture = do we rotate the grating texture (true) or the patch itself (false) phase = phase of grating mask = use circular mask (true) or not (false)

See docs for more property details.

Todo:
phase appears different to gratingStimulus, work out why

Copyright ©2014-2022 Ian Max Andolina — released: LGPL3, see LICENCE.md

Inheritance diagram for polarGratingStimulus:

Public Member Functions

function polarGratingStimulus (in varargin)
 Class constructor.
 
function setup (in me, in sM)
 Setup this object in preparation for use When displaying a stimulus object, the main properties that are to be modified are copied into cache copies of the property, both to convert from visual description (c/d, Hz, degrees) to computer metrics, and to be animated and modified as independant variables. So xPosition is copied to xPositionOut and converted from degrees to pixels. The animation and drawing functions use these modified properties, and when they are updated, for example to change to a new xPosition, internal methods ensure reconversion and update any dependent properties. This method initialises the object with all the cache properties for display.
 
function set_cOut (in me, in value)
 
function set_c2Out (in me, in value)
 
function set_sfOut (in me, in value)
 
function set_tfOut (in me, in value)
 
function set_reverseDirectionOut (in me, in value)
 
function set_sizeOut (in me, in value)
 
function set_xPositionOut (in me, in value)
 
function set_yPositionOut (in me, in value)
 
function update (in me)
 Update this stimulus object for display.
 
function draw (in me)
 Draw this stimulus object for display.
 
function animate (in me)
 Animate this object for runExperiment.
 
function reset (in me)
 Reset an structure for runExperiment.
 
function calculatePhase (in me)
 calculate phase offset
 
function set sf (in me, in value)
 sf Set method
 
function set colour2 (in me, in value)
 SET Colour2 method Allow 1 (R=G=B) 3 (RGB) or 4 (RGBA) value colour.
 
function set baseColour (in me, in value)
 SET baseColour method Allow 1 (R=G=B) 3 (RGB) or 4 (RGBA) value colour.
 
function getsfOut (in me)
 sfOut Pseudo Get method
 
- Public Member Functions inherited from baseStimulus
virtual setup (in runObject)
 ALL Children must implement these 5 methods!
 
function baseStimulus (in varargin)
 Class constructor.
 
function set colour (in me, in value)
 colour set method Allow 1 (R=G=B) 3 (RGB) or 4 (RGBA) value colour
 
function set alpha (in me, in value)
 alpha set method
 
function get delta (in me)
 delta Get method delta is the normalised number of pixels per frame to move a stimulus
 
function get dX (in me)
 dX Get method X position increment for a given delta and angle
 
function get dY (in me)
 dY Get method Y position increment for a given delta and angle
 
function show (in me)
 Method to set isVisible=true.
 
function hide (in me)
 Method to set isVisible=false.
 
function setOffTime (in me, in time)
 set offTime
 
function setDelayTime (in me, in time)
 set delayTime
 
function resetTicks (in me)
 reset the various tick counters for our stimulus
 
function getMousePosition (in me)
 get mouse position we make sure this is only called once per animation tick to improve performance and ensure all stimuli that are following mouse position have consistent X and Y per frame update This sets mouseX and mouseY and mouseValid if mouse is within PTB screen (useful for mouse override positioning for stimuli)
 
function run (in me, in benchmark, in runtime, in s, in forceScreen, in showVBL)
 Run stimulus in a window to preview it.
 
function makePanel (in me, in parent)
 make a GUI properties panel for this object
 
function selectFilePanel (in me, in varargin)
 read values from a GUI properties panel for this object
 
function readPanel (in me, in varargin)
 read values from a GUI properties panel for this object
 
function showPanel (in me)
 show GUI properties panel for this object
 
function hidePanel (in me)
 hide GUI properties panel for this object
 
function closePanel (in me, in varargin)
 close GUI panel for this object
 
function cleanHandles (in me, in ignoredArg)
 clean any handles
 
function getP (in me, in name, in range)
 gets a property copy or original property
 
function setP (in me, in name, in value)
 sets a property copy or original property
 
function updateXY (in me, in x, in y, in useDegrees)
 Update only position info, faster and doesn't reset image etc.
 
- Public Member Functions inherited from optickaCore
function optickaCore (in varargin)
 Class constructor.
 
function get fullName (in me)
 
function getALF (in me, in subject, in sessionPrefix, in lab, in create)
 
function findAttributes (in me, in attrName, in attrValue)
 
function findAttributesandType (in me, in attrName, in attrValue, in type)
 find properties of object with specific attributes, for example all properties whose GetAcccess attribute is public and type is logical.
 
function findPropertyDefault (in me, in propName)
 
function clone (in me)
 Use this syntax to make a deep copy of the object, i.e. OBJ_OUT has the same field values, but will not behave as a handle-copy of me anymore.
 
function checkSuperclasses (in List)
 
function editProperties (in me, in properties)
 method to modify a set of properties
 
function setProp (in me, in property, in value)
 method to fast change a particular value. This is useful for use in anonymous functions, like in the state machine.
 
function initialiseGlobals (in me, in doReset, in doOpen)
 
function initialiseSaveFile (in me)
 Initialise Save prefix.
 
function checkPaths (in me)
 checks the paths are valid
 

Public Attributes

Property type
 family type, can be 'radial', 'circular', 'spiral'
 
Property colour2
 second colour of a colour grating stimulus
 
Property baseColour
 
Property spiralFactor
 spiral, how much to multiply the sf for the radial part
 
Property arcValue
 arc start angle and width in degrees (0 disable)
 
Property arcSymmetry
 shoud arc be symmetrical
 
Property centerMask
 do we mask (size in degrees) the centre part?
 
Property sf
 spatial frequency of the grating
 
Property tf
 temporal frequency of the grating
 
Property sigma
 sigma of square wave smoothing, use -1 for sinusoidal gratings
 
Property rotateTexture
 rotate the grating patch (false) or the grating texture within the patch (default = true)?
 
Property phase
 phase of grating
 
Property contrast
 contrast of grating (technically the contrast from the baseColour)
 
Property mask
 use a circular mask for the grating (default = true).
 
Property reverseDirection
 direction of the drift; default = false means drift left>right when angle is 0deg.
 
Property direction
 the direction of the grating object if speed > 0.
 
Property correctPhase
 
Property correctBaseColour
 
Property phaseReverseTime
 Reverse phase of grating X times per second? Useful with a static grating for linearity testing.
 
Property phaseOfReverse
 What phase to use for reverse?
 
Property aspectRatio
 aspect ratio of the grating
 
Property visibleRate
 turn stimulus on/off at X hz, [] diables this
 
Property family
 
Property scale
 scale is used when changing size as an independent variable to keep sf accurate
 
Property phaseIncrement
 the phase amount we need to add for each frame of animation
 
Constant Property typeList
 
Property ignorePropertiesUI
 properties to not show in the UI panel
 
- Public Attributes inherited from baseStimulus
Property type
 stimulus type
 
Property xPosition
 
Property yPosition
 
Property size
 
Property colour
 
Property alpha
 Alpha (opacity) [0-1], this gets combined with the RGB colour.
 
Property startPosition
 
Property speed
 
Property angle
 angle in degrees (0 - 360)
 
Property delayTime
 
Property offTime
 time to turn stimulus off, relative to stimulus onset
 
Property isVisible
 true or false, whether to draw() this object
 
Property mouseOverride
 override X and Y position with mouse input? Useful for RF mapping
 
Property showOnTracker
 show the position on the Eyetracker display?
 
Property verbose
 Do we log extra details to the command-line?
 
Property xFinal
 
Property yFinal
 
Property mvRect
 
Property szIsPx
 
Property szPx
 computed size in pixels
 
Property szD
 computed size in °
 
Property xFinalD
 X and Y position in °
 
Property yFinalD
 
Property isRect
 
Property tick
 tick updates +1 on each call of draw (even if delay or off is true and no stimulus is drawn, resets on each update
 
Property drawTick
 draw tick only updates when a draw is actually performed, resets on each update
 
Property ppd
 pixels per degree (normally inhereted from screenManager)
 
Property delta
 What our per-frame motion delta is.
 
Property dX
 X update which is computed from our speed and angle.
 
Property dY
 X update which is computed from our speed and angle.
 
- Public Attributes inherited from optickaCore
Property name
 object name
 
Property comment
 comment
 
Property verbose
 verbose logging, subclasses must assign this. This is normally logical true/false
 
Property dateStamp
 clock() dateStamp set on construction
 
Property uuid
 universal ID
 
Property paths
 storage of various paths
 
Property fullName
 The fullName is the object name combined with its uuid and class name.
 

Protected Member Functions

function setRect (in me)
 setRect setRect makes the PsychRect based on the texture and screen values this is modified over parent method as gratings have slightly different requirements.
 
function calculateScale (in me, in ignoredArg, in ignoredArg)
 calculateScale Use an event to recalculate scale as get method is slower (called many more times), than an event which is only called on update
 
function calculatePhaseIncrement (in me, in ignoredArg, in ignoredArg)
 calculatePhaseIncrement Use an event to recalculate as get method is slower (called many more times), than an event which is only called on update
 
function fixBaseColour (in me, in varargin)
 fixBaseColour POST SET
 
function updateSFs (in me)
 
- Protected Member Functions inherited from baseStimulus
function addRuntimeProperties (in me)
 These are transient properties that specify actions during runtime.
 
function updateRuntimeProperties (in me)
 Update transient properties that specify actions during runtime.
 
function computePosition (in me)
 compute xFinal and yFinal (in pixels) taking startPosition, xPosition, yPosition and direction/angle into account
 
function setAnimationDelta (in me)
 
function setRect (in me)
 
function toStructure (in me, in tmp)
 Converts properties to a structure.
 
function removeTmpProperties (in me)
 Finds and removes dynamic properties.
 
function delete (in me)
 
- Protected Member Functions inherited from optickaCore
function parseArgs (in me, in args, in allowedProperties)
 Sets properties from a structure or normal arguments pairs, ignores invalid or non-allowed properties.
 
function addArgs (in me, in args)
 
function setPaths (in me)
 Sets properties from a structure or normal arguments pairs, ignores invalid or non-allowed properties.
 
function getFonts (in me)
 set paths for object
 
function toStructure (in me)
 Converts properties to a structure.
 
function getType (in me, in in)
 
function logOutput (in me, in in, in message, in override)
 Give a metaproperty return the likely property class.
 
function salutation (in me, in varargin)
 Prints messages dependent on verbosity.
 

Protected Attributes

Property sfCache
 
Property sfRecurse
 to stop a loop between set method and an event
 
Property allowedProperties
 allowed properties passed to object upon construction
 
Property ignoreProperties
 properties to not create transient copies of during setup phase
 
Property phaseCounter
 how many frames between phase reverses
 
Property maskValue
 mask value (radius for the procedural shader)
 
Property shader
 the raw shader, we can try to change colours.
 
Property needUpdate
 these store the current colour so we can check if update needs
 
Property colourCache
 
Property colour2Cache
 
Property visibleTick
 
Property visibleFlip
 
Property sf1
 
Property sf2
 
Property cMaskTex
 
Property cMaskRect
 
- Protected Attributes inherited from baseStimulus
Property family
 the stimulus family (grating, dots etc.)
 
Property texture
 Our texture pointer for texture-based stimuli.
 
Property handles
 handles for the GUI
 
Property sM
 our screen manager
 
Property animator
 animation manager
 
Property screenVals
 screen settings generated by sM on setup
 
Property isSetup
 
Property isGUI
 is panel constructed?
 
Property dstRect
 initial screen rectangle position [LEFT TOP RIGHT BOTTOM]
 
Property mouseValid
 is mouse position within screen co-ordinates?
 
Property mouseX
 mouse X position
 
Property mouseY
 mouse Y position
 
Property delayTicks
 delay ticks to wait until display
 
Property offTicks
 ticks before stimulus turns off
 
Property inSetup
 are we setting up?
 
Property delta_
 delta cache
 
Property dX_
 dX cache
 
Property dY_
 dY cache
 
Property isInSetColour
 deal with interaction of colour and alpha
 
Property setLoop
 
Property ignorePropertiesBase
 Which properties to ignore cloning when making transient copies in setup.
 
Property ignorePropertiesUIBase
 Which properties to not draw in the UI panel.
 
- Protected Attributes inherited from optickaCore
Property cloning
 are we cloning this from another object
 
Property mversion
 Matlab version number, this is transient so it is not saved.
 
Property sansFont
 sans font
 
Property monoFont
 monoFont
 
Property className
 class name
 
Property savePrefix
 save prefix generated from clock time
 
Property fullName_
 cached full name
 

Additional Inherited Members

- Public Types inherited from baseStimulus
enum  Events { readPanelUpdate }
 
- Static Public Member Functions inherited from baseStimulus
static function d2r (in degrees)
 degrees2radians
 
static function r2d (in r)
 radians2degrees
 
static function findDistance (in x1, in y1, in x2, in y2)
 findDistance in X and Y coordinates
 
static function updatePosition (in delta, in angle)
 updatePosition returns dX and dY given an angle and delta
 
- Static Public Member Functions inherited from optickaCore
static function makeArgs (in args)
 Converts cell args to structure array.
 
static function addDefaults (in args, in defs)
 add default options to arg input
 
static function hasKey (in in, in key)
 check if a struct / object has a propery / field
 
static function getKeys (in device)
 PTB Get key presses, stops key bouncing.
 

Constructor & Destructor Documentation

◆ polarGratingStimulus()

function polarGratingStimulus::polarGratingStimulus ( in  varargin)

Class constructor.

More detailed description of what the constructor does.

Parameters
argsare passed as a structure of properties which is parsed.
Returns
instance of class.

Member Function Documentation

◆ animate()

function polarGratingStimulus::animate ( in  me)
virtual

Animate this object for runExperiment.

Reimplemented from baseStimulus.

◆ baseColour()

function set polarGratingStimulus::baseColour ( in  me,
in  value 
)

SET baseColour method Allow 1 (R=G=B) 3 (RGB) or 4 (RGBA) value colour.

◆ calculatePhase()

function polarGratingStimulus::calculatePhase ( in  me)

calculate phase offset

◆ calculatePhaseIncrement()

function polarGratingStimulus::calculatePhaseIncrement ( in  me,
in  ignoredArg,
in  ignoredArg 
)
protected

calculatePhaseIncrement Use an event to recalculate as get method is slower (called many more times), than an event which is only called on update

◆ calculateScale()

function polarGratingStimulus::calculateScale ( in  me,
in  ignoredArg,
in  ignoredArg 
)
protected

calculateScale Use an event to recalculate scale as get method is slower (called many more times), than an event which is only called on update

◆ colour2()

function set polarGratingStimulus::colour2 ( in  me,
in  value 
)

SET Colour2 method Allow 1 (R=G=B) 3 (RGB) or 4 (RGBA) value colour.

◆ draw()

function polarGratingStimulus::draw ( in  me)
virtual

Draw this stimulus object for display.

Reimplemented from baseStimulus.

◆ fixBaseColour()

function polarGratingStimulus::fixBaseColour ( in  me,
in  varargin 
)
protected

fixBaseColour POST SET

◆ getsfOut()

function polarGratingStimulus::getsfOut ( in  me)

sfOut Pseudo Get method

◆ reset()

function polarGratingStimulus::reset ( in  me)
virtual

Reset an structure for runExperiment.

Parameters
rErunExperiment object for reference
Returns
stimulus structure.

Reimplemented from baseStimulus.

◆ set_c2Out()

function polarGratingStimulus::set_c2Out ( in  me,
in  value 
)

◆ set_cOut()

function polarGratingStimulus::set_cOut ( in  me,
in  value 
)

◆ set_reverseDirectionOut()

function polarGratingStimulus::set_reverseDirectionOut ( in  me,
in  value 
)

◆ set_sfOut()

function polarGratingStimulus::set_sfOut ( in  me,
in  value 
)

◆ set_sizeOut()

function polarGratingStimulus::set_sizeOut ( in  me,
in  value 
)

◆ set_tfOut()

function polarGratingStimulus::set_tfOut ( in  me,
in  value 
)

◆ set_xPositionOut()

function polarGratingStimulus::set_xPositionOut ( in  me,
in  value 
)

◆ set_yPositionOut()

function polarGratingStimulus::set_yPositionOut ( in  me,
in  value 
)

◆ setRect()

function polarGratingStimulus::setRect ( in  me)
protected

setRect setRect makes the PsychRect based on the texture and screen values this is modified over parent method as gratings have slightly different requirements.

◆ setup()

function polarGratingStimulus::setup ( in  me,
in  sM 
)

Setup this object in preparation for use When displaying a stimulus object, the main properties that are to be modified are copied into cache copies of the property, both to convert from visual description (c/d, Hz, degrees) to computer metrics, and to be animated and modified as independant variables. So xPosition is copied to xPositionOut and converted from degrees to pixels. The animation and drawing functions use these modified properties, and when they are updated, for example to change to a new xPosition, internal methods ensure reconversion and update any dependent properties. This method initialises the object with all the cache properties for display.

Parameters
sMscreenManager object to use

◆ sf()

function set polarGratingStimulus::sf ( in  me,
in  value 
)

sf Set method

◆ update()

function polarGratingStimulus::update ( in  me)
virtual

Update this stimulus object for display.

Reimplemented from baseStimulus.

◆ updateSFs()

function polarGratingStimulus::updateSFs ( in  me)
protected

Member Data Documentation

◆ allowedProperties

Property polarGratingStimulus::allowedProperties
protected

allowed properties passed to object upon construction

◆ arcSymmetry

Property polarGratingStimulus::arcSymmetry

shoud arc be symmetrical

◆ arcValue

Property polarGratingStimulus::arcValue

arc start angle and width in degrees (0 disable)

◆ aspectRatio

Property polarGratingStimulus::aspectRatio

aspect ratio of the grating

◆ baseColour

Property polarGratingStimulus::baseColour

base colour from which colour and colour2 are blended via contrast value if empty [default], uses the background colour from screenManager

◆ centerMask

Property polarGratingStimulus::centerMask

do we mask (size in degrees) the centre part?

◆ cMaskRect

Property polarGratingStimulus::cMaskRect
protected

◆ cMaskTex

Property polarGratingStimulus::cMaskTex
protected

◆ colour2

Property polarGratingStimulus::colour2

second colour of a colour grating stimulus

◆ colour2Cache

Property polarGratingStimulus::colour2Cache
protected

◆ colourCache

Property polarGratingStimulus::colourCache
protected

◆ contrast

Property polarGratingStimulus::contrast

contrast of grating (technically the contrast from the baseColour)

◆ correctBaseColour

Property polarGratingStimulus::correctBaseColour

In certain cases the base colour should be calculated dynamically from colour and colour2, and this enables this to occur blend

◆ correctPhase

Property polarGratingStimulus::correctPhase

Do we need to correct the phase to be relative to center not edge? This enables centre surround stimuli are phase matched, and if we enlarge a grating object its phase stays identical at the centre of the object (where we would imagine our RF)

◆ direction

Property polarGratingStimulus::direction

the direction of the grating object if speed > 0.

◆ family

Property polarGratingStimulus::family

◆ ignoreProperties

Property polarGratingStimulus::ignoreProperties
protected

properties to not create transient copies of during setup phase

◆ ignorePropertiesUI

Property polarGratingStimulus::ignorePropertiesUI

properties to not show in the UI panel

◆ mask

Property polarGratingStimulus::mask

use a circular mask for the grating (default = true).

◆ maskValue

Property polarGratingStimulus::maskValue
protected

mask value (radius for the procedural shader)

◆ needUpdate

Property polarGratingStimulus::needUpdate
protected

these store the current colour so we can check if update needs

◆ phase

Property polarGratingStimulus::phase

phase of grating

◆ phaseCounter

Property polarGratingStimulus::phaseCounter
protected

how many frames between phase reverses

◆ phaseIncrement

Property polarGratingStimulus::phaseIncrement

the phase amount we need to add for each frame of animation

◆ phaseOfReverse

Property polarGratingStimulus::phaseOfReverse

What phase to use for reverse?

◆ phaseReverseTime

Property polarGratingStimulus::phaseReverseTime

Reverse phase of grating X times per second? Useful with a static grating for linearity testing.

◆ reverseDirection

Property polarGratingStimulus::reverseDirection

direction of the drift; default = false means drift left>right when angle is 0deg.

◆ rotateTexture

Property polarGratingStimulus::rotateTexture

rotate the grating patch (false) or the grating texture within the patch (default = true)?

◆ scale

Property polarGratingStimulus::scale

scale is used when changing size as an independent variable to keep sf accurate

◆ sf

Property polarGratingStimulus::sf

spatial frequency of the grating

◆ sf1

Property polarGratingStimulus::sf1
protected

◆ sf2

Property polarGratingStimulus::sf2
protected

◆ sfCache

Property polarGratingStimulus::sfCache
protected

as get methods are slow, we cache sf, then recalculate sf whenever changeScale event is called

◆ sfRecurse

Property polarGratingStimulus::sfRecurse
protected

to stop a loop between set method and an event

◆ shader

Property polarGratingStimulus::shader
protected

the raw shader, we can try to change colours.

◆ sigma

Property polarGratingStimulus::sigma

sigma of square wave smoothing, use -1 for sinusoidal gratings

◆ spiralFactor

Property polarGratingStimulus::spiralFactor

spiral, how much to multiply the sf for the radial part

◆ tf

Property polarGratingStimulus::tf

temporal frequency of the grating

◆ type

Property polarGratingStimulus::type

family type, can be 'radial', 'circular', 'spiral'

◆ typeList

Constant Property polarGratingStimulus::typeList

◆ visibleFlip

Property polarGratingStimulus::visibleFlip
protected

◆ visibleRate

Property polarGratingStimulus::visibleRate

turn stimulus on/off at X hz, [] diables this

◆ visibleTick

Property polarGratingStimulus::visibleTick
protected

The documentation for this class was generated from the following file: