Example TaskProvided here are the conditions file and timing script for a simple DMS (Delayed-Match-to-Sample) task. The subject sees a picture, and then must select that picture from two choices presented after a brief delay. Note that the inter-trial-interval is set in the main menu, and the timing script controls only the within-trial events. These files are available in a zip folder, along with four sample stimuli. All these files should be placed into an experiment directory (e.g., named "dms_task"). Once the conditions file is loaded from the main menu, the appropriate options set, and a data file name entered, the run button should become active. To run this task, X & Y eye inputs must be defined in the main menu (because it uses the acquirefix and holdfix options of the eyejoytrack command, which expect an eye-signal, as described in the timing script section), although a joystick may be connected, or no actual hardware at all. In addition, an output should be selected for the reward. Note: if using a joystick to play the task, some of the times may need to be increased to account for slower reaction times and movements of a joystick compared to saccades, for which this code was written. Conditions file (dms.txt):
This file is structured so that the sample is always TaskObject#2 and the target is TaskObject#3, while the distractor is TaskObject#4. This organization makes writing the timing file very straightforward, as all it needs to do is display TaskObject #1 (the fix-spot), then display TaskObject #2 (the sample), then after extinguishing TaskObject #2 and a subsequent delay, it puts up TaskObjects #3 and #4. So long as the subject chooses TaskObject #3, the timing script knows s/he has chosen correctly - without knowing anything about the actual stimuli themselves. Three blocks are defined: running blocks 1 or 2 will use stimuli A & B, or C & D, respectively, while running block 3 will use all the stimuli. Note, however, that without additional conditions, objects A & B can never serve as distractors for C & D, or vice versa.
Note that MonkeyLogic functions available only in timing scripts are shown here in different colors (except for comments, they will not appear this color in the Matlab editor). Generally, a timing script begins by redefining TaskObject numbers as readable names, and by defining the temporal intervals that will be used in the experiment (in milliseconds). Then toggleobject and eyejoytrack are interleaved such as to present stimuli at the appropriate times as contingent upon the subject's behavior. Whenever a behavioral error is encountered, a "trialerror" is recorded and any currently visible stimuli are turned off with a call to toggleobject (although these stimuli will be extinguished at some point during the inter-trial-interval, it is good programming practice to turn them off explicitly so that the times of all events are predictable and consistent across trials). In addition to the code shown here, the eventmarker command, and the eventmarker option of toggleobject, should be employed generously to mark salient events (e.g., a stimulus is turned on or off, the subject acquires fixation, initiates a response, acquires a target, etc.). These event-markers allow one to align neural signals with behavioral events post-hoc with millisecond-level accuracy.
|
This site last updated: May, 2014 | © 2008-2014 |