Moving Gratings

The program mvg shows one or two motion patterns and then waits for a response. There also may be special inspection patterns while waiting for the response. Possible applications involve paired comparisons of two motion patterns, motion adjustment, and motion adaptation.

Program Features

Adaptation and Inspection Pattern

The adaptation pattern is a sinusoidal grating which is computed as a convex mixture of the colors a and b with coordinates ax, ay, aL, bx, by, bL where the weights of each component are sinusoidal functions of spatial position: c(h) = w(h) * a + (1-w(h)) * b, where w(h) = 0.5 * (1 + cos(2Pif h)). h is the position and f is the spatial frequency of the sinusoid. The frequency is derived from cyclespm, the number of full pattern cycles per meter and the size of the pattern area as defined by width and height.

If the flag I is set then the pattern colors are changed when going from the adaptation to the inspection phase. The spatial pattern remains the same but colors (a,b) are replaced by (a_i,b_i) This feature may be used to show an inspection pattern with less modulation than the motion pattern.

Motion Parameters

The motion direction is controlled by direction: 0 = down/right/inwards, 1 = up/left/outwards. Motion speed is controlled by pxlmps. This parameter gives the pxlm per second. dsptime is the duration of the motion display and thus of the adaptation phase. It is given in seconds.

Intertrial Countdown

Since adaptation experiments need rather long intertrial intervals there is a countdown message between trials. The message string is countdown. If it contains the character sequence "%d" then this sequence is replaced each second by the remaining number of seconds to wait.


Each adaptation period may start with a message telling the subject what to do in the next trial. This may be used to tell the subject that she has to change the eye for inspection. The message is shown for dsptm ms. The message shown is changenote if the parameter change is ON and dspmsg if change is OFF.

Program Parameters

ax , ay , aL , bx , by , bL (float)
Color coordinates of those colors a and b that make up the motion pattern.

aix , aiy , aiL , bix , biy , biL (float)
coordinates of the components a and b during the inspection phase.

fieldcolx , fieldcoly , fieldlum (float)
Background field color.

fieldheight , fieldwidth (int)
Height and width of the background field.

centerx , centery (int)
Stimulus pattern center coordinates.

change (int)
Indicates that changenote should be shown before the trial starts.

changenote (string)
This text is shown before the trial starts if change is ON.

clearfixmark (int)
If this varaible is not 0 then the fixation mark is cleared during the inspection phase.

countdown (string)
Count down message shown between trials.

clearfixmark (int)
Flag for not showing the fixation mark during inspection.

csteps , csteps2 (int)
Color steps per single sine wave in first and second stimulus. Note that only around 250 color steps are available in total.

cyclespm , cyclespm2 (int)
Number of visible sine waves cycles per meter whithin the stimulus fields.

direction , direction2 (int)
Motion direction of first and second stimulus pattern. These are possible: MOVEUP (1), MOVEDOWN (0), MOVELEFT (1), MOVERIGHT (0), MOVEOUT (1), MOVEIN (0).

dspmsg (string)
Message at start of the adaptation period.

dsptime (int)
Duration of the motion display given in seconds.

dsptm (int)
Duration of dspmsg. If dsptm is negative then dspmsg is shown until a key is pressed.

fixmarklum (int)
Fixation mark luminance.

fixmarksize (int)
Size of fixation mark. No mark is shown if fixmarksize is 0.

fixmarkx , fixmarky (int)
Position of fixation mark.

flags (string)
These flags are available:

Give an acoustic cue at the start of the adaptation period.

Show two moving patterns.

Change the pattern colors (a,b) to (a_i,b_i) during the inspection phase.

Immediately remove grating after inspection phase.

Enable an acoustic cue at the start of the inspection phase in those cases where change has the value 1.

Use a circular background field instead of a rectangular one.

Print speed table for debugging purpose.

Recompute and repaint the motion pattern for each trial. Default is to use only a single pattern for the whole block. This is necessary if there are different spatial frequencies within a single block.

Allow motion adjustment instead of constant motion display.

height , width (int)
Height and width of the stimulus field. For circular stimulus fields width is the diameter of the circular area.

intdsptime (int)
Pause between consecutive trials, given in seconds. This pause may be filled with a visual countdown message.

lpp , lpp2 (int)
Screen lines per sine wave period of the two stimuli. These parameters are only used for the data protocol and are set at run time by the program. They have no effect if set in the parameter file.

pxlmps , pxlmps2 (int)
Motion speed in pxlm per second for two stimuli.

rtime (int)
Duration between start of the inspection phase and the subject's response. Should be duration of after effect.

stripedir , stripedir2 (int)
Orientation of the stripes in the two stimulus patterns. These are possible: HSTRIPES (0) (horizontal), VSTRIPES (1) (vertical), and CIRCULAR (2).

stripeform , stripeform2 (int)
Wave type of stripes: SINEPATTEN (0), RECTPATTERN (1) (not used until know).

timeunit (int)
Number of milliseconds per unit of time for time between trials (intdsptime), stimulation time (dsptime), and response (after effect) time (rtime). This also is the count unit for the inter trial count down process.

Example Experiments

The following parameter file is an experiment with linear and radial motion and a possible change of the observation condition between adaptation and inspection phase.

Parameter file bene.x from directory \pxl\app\mvg

Back to table of contents

Author: Hans Irtel