MATLAB Python

easyScale

Syntax

datastruct = easyScale(datastruct, [,'init_val'] [,'onset'] [,'draw_func_args'] [,'input_func_args'] [,'respmap'] [,'trial_summary_func_args'] [,'stim'] [,'cond'] [,'cresp'] [,'trial_dur'] [,'nesting'] [,'trial_bin'] [,'info']) [] = optional parameters '' = parameter-value pairs

Description

EASYSCALE is intended as a quick way to gather gather arbitrary data and organize the data on a user-defined scale. Unlike other easyFunctions which sample some input source while you wait, EASYSCALE bounces between an input_func and draw_func, updating the screen on every cycle. This powerful setup allows you to refresh what is shown as a trial progresses, otherwise known as an interactive experiment. Values can be passed back and forth between the two using sample_bin, a two-cell array that by convention contains input_func variables in the first cell, and draw_func variables in the second. These values are updated on each call to input_func and draw_func. For example usage, see demoEasyScale_drag. As with all easyFunctions, each call to EASYSCALE is a 'trial' in which more data are collected. It builds and logs a structure prepared by initEasyScale that can easily be saved and later analyzed in matlab, and which contains much of the important information you would normally hope to collect upon prompting for a response. It also attempts to reduce the burden of gathering a response by assuming the format of your test question will remain the same across instances: most parameters are set once using initEasyScale and can then be forgotten. The function saves all of its information after each response and is logged (to both a matlab and text file) in case disaster strikes in your matlab session. It can also optionally report helpful output to the console so you can see how your participant is doing.

Usage

D = easyScale(S) returns a datastruct using EASYSCALE default values. S is a test-specific data structure prepared by running initEasyScale to specify test-related parameters like initial value, maximum time duration, etc. D = easyScale(datastruct,param1,val1,param2,val2...) sets various optional parameters. Parameters are case-insensitive, and each string parameter must be followed by a value as indicated: 'init_val' Numeric array. Coordinates to indicate the start position of the scale. There must be an entry for each dimension of the scale. Default: 0 'draw_func_args' Cell array. A cell array of optional arguments that will be passed on to each call of the draw function. Default: {} 'input_func_args' Cell array. A cell array of optional arguments that will be passed on to each call of the input function. Default: {} 'trial_summary_func_args' Cell array. A cell array of optional arguments that will be passed on to each call of the scoring function. Default: {} 'onset' Numeric Scalar. Start time of the trial. It is better to use the time returned by, e.g., your draw command than the onset of this function for more accurate measurement. However, if you leave this field empty, the duration will begin from the time this function is launched. Default: output of GetSecs command 'respmap' Table. Table mapping response zones to numeric values and labels. Use makeMap to generate this map. Default: empty table 'stim' String. A string describing the stimulus presented in this trial. Specify here to store the information in your datastruct and enhance console and text-file data-logging. If omitted or repeated, a generated string containing repeat count will be used in its place. stim is used as a row name for the trial table. Default: '---' 'cond' Scalar positive integer, NaN, string, or string cell array. Specifies the condition to which the current trial belongs. If omitted, left empty, or set to NaN, condition -1 will be recorded. It can be specified either by a positive integer, NaN, or by string name. If a condmap was specified in initEasyType, a corresponding condition string will be reported. When there are multiple condition factors, Can be supplied as a numeric array or cell array of strings where each entry corresponds to a different condition factor; in this case, there must be an equal number of condmap entries supplied to initEasyType, and each entry of cond must be the same type. As a shortcut with multiple condition factors, cond can be supplied as a single string (conditions delimited by underscores) which will be compared to row names of the master condmap to determine which conditions to assign for each factor. If no condition in a condmap matches the string, the condition will be appended to the condmap. Default: -1 'cresp' Cell array of strings or NaN's. The string descriptors corresponding to response zones that should be treated as being correct responses. If there is no one correct answer, omit this parameter, and all valid responses will be treated as correct (unless you specified a default_cresp with initEasyScale). NaN indicates that a null response is correct. If there is more than one correct zone, specify cresp as a cell array of strings (with NaN as a valid element as well). Default: {} 'trial_dur' Numeric positive scalar. The maximum period, specified in seconds, for which you would like to present participants with the initial promptscreen while waiting for a response. Specify a duration of 0 to sample for a current keypress and then exit. If you did not provide a default prompt_dur during initialization, you will be required to enter one here. Default: [] 'nesting' Numeric vector of positive integers. Used to specify the nested structure of trials in an experiment. Hierarchy is represented in descending order from left to right, e.g., block 2, subblock 1, trial 4 would be represented as [2 1 4]. This information will be retained in the datastruct trials table, and is also used to create depth-specific summaries in easyScore. The supplied vector can be of any length, but the nesting vector must be of consistent length across all trials of an experiment. If the nesting structure has more than one layer (i.e. more than one element in the nesting vector), this parameter must be explicitly supplied for each trial in the experiment. If a single-element nesting vector is supplied to the first trial, this parameter does not need to be supplied with each call, and will be instead incremented by one automatically from the previous trial nesting value. Default: [trial] 'trial_bin' Cell array. Values can be given here as a cell array. These values are then passed on to input_func and draw_func, although they remain unchanged during a trial. Values such as background canvas image and cursor image for a drawing experiment can be specified here. If specified, trial_bin will override default_trial_bin (if it was given in initEasyScale). Default: [] 'info' Any data type. Populate this field with any kind of meta-data about the trial. It will be associated with that trial and remain available for later reference in the datastruct, including by trial_summary_funcs. Default: {}

Output

datastruct: a data structure containing the various parameters that were provided to the initEasyScale initialization function, as well as response data from each call to easyScale. Fields corresponding to absent optional parameters are set to default values.