MATLAB Python

drawSPTBchoices

Syntax

drawSPTBchoices(params, window, label, respmap, cresp_input [,style] [,grid_size] [,progress] [,choices] [,firstplay] [,wintex]) [] = optional parameters

Description

DRAWSPTBCHOICES is used to draw response options to a window. For example, a common requirement in psychology experiments is to present several strings of text along with corresponding keys that a user would press to select that option. DRAWSTPBCHOICES arranges these strings nicely in one of several formats (columns, rows or as part overtop a "navigation" bar drawn at the bottom of the screen), along with their keypress options. It will alternately draw picture response options or play back sounds in sequence when supplied with image or audio filepaths or matrices. DRAWSPTBCHOICES can also be useful for debugging your experiment: when in "debug" mode at runtime, options are presented with red or green text / borders to identify which option in each trial is designated as correct.

Usage

DRAWSPTBCHOICES is usually called by easyFunctions and we therefore haven't yet put much effort into making it easy to call. Parameters are as follows: params: the params structure supplied by easyLaunch. window: token for the window where the graphics will be drawn to. label: some text or a multimedia file to be drawn above the choices (e.g., containing simple instructions). Can be left empty. When using a navbar configuration, can be a two-cell array, in which case position 1 is drawn as instructions at the top of the screen, and position 2 is drawn in the middle. respmap: a response map as supplied by makeMap. This is where the options to be drawn are sampled from: response.input must contain strings (probably keynames) to be in circles associated with each option. response.descriptors are the contents of what will be drawn to the screen. Strings will be drawn as text, unless the string is a filename that corresponds to a real file, which will trigger the reading and display (if an image) or playback (if an audio file). If you are trying to load an image or audio file and it appears as a string, the most likely reason is that the file can't be found at the location you specified. When working with dynamic images or sounds, the entire image or audio file can be loaded into the respmap.descriptors field for use by DRAWSPTBCHOICES. Note that images will be scaled to the available space, and audio files will be played in the order they appear in the respmap. While each file is playing, the term "Option N" will appear, and after all playback, a screen allowing the user to select among the text options "Option 1, Option 2..." will be presented. Supported audio formats are .mp3, .wav, and .aif; supporoted image formats are anything that can be read by imread. respmap.values is always ignored. cresp_input: a cell array containing the entry/entries from respmap.inputs that is/are correct on this trial (leave empty if all options are correct, or set to nan if no options are correct). style: [optional] supply the string 'tall', 'wide', or 'navbar' for the algorithm to draw all options in lines one atop another; side-by-side; or in a section at the bottom of the screen, respectively. grid_size: [optional] a numeric array specifying the structure of the grid in which options should be drawn. For example, [2 4] would cause the eight options to be drawn in two rows and 4 columns. progress: [optional] a string to be drawn in the top-left corner of the screen representing the current progress through the experiment. choices: [optional] a cell array of inputs that have been selected. firstplay: [optional] indicates whether this is the first call to drawSPTBchoices for these options. wintex: [optional] If there is a texture to be drawn before every flip, it can be supplied here.