Code Tables


The meaning of the code value that appears in the 2nd column of each entry in the stimulus event list can be described by setting the CODETABLE and CODENAMES variables in the paradigm file's parameter settings. Both of these variables are declared automatically by ShowPlay, but they are empty unless specified explicitly in the PPF file.

CODETABLE
This is a numeric matrix variable. The columns in the matrix correspond to stimulus codes that appear in the stimulus event list. There should be one column in the table for each code value that is used. By default, the first column corresponds to a code of 0, the second is for a code of 1, etc. (see the "NAME = code" section below for the exception to this.)

The rows in the CODETABLE matrix correspond to different lines in the CODENAMES variable. There should be one row in CODETABLE for every line (row) that appears in CODENAMES. The values in the matrix, therefore, can be used to map each stimulus code into each of the named conditions. For example, the value in column 4, row 2 of CODETABLE is the status of the 2nd code condition associated with stimulus code 3 (remembering that the first column is used for code value 0).

The CODETABLE variable does not need to be explicitly defined if the stimulus code can be mapped directly to the CODENAMES list. To see how that's done refer to the DIGIT-MAPPING section below.

CODENAMES
This is a character string list variable. Each line (row) contains one or more text strings, and each line is associated with the corresponding row of the CODETABLE matrix (if CODETABLE was specified). The syntax of a CODENAMES line is:

name cond1=value1 cond2=value2 ...

The NAME is required, but the COND and VALUE fields are optional. The NAME field indicates the meaning of the code condition (e.g. "color"), whereas the COND fields indicate the value of the condition to associate with the code value. If the VALUE is specified, that association is explicit, otherwise COND1 is associated with value of 1, COND2 with 2, etc. No COND fields are needed if the meaning of the value is obvious (e.g. yes or no for 1 or 0).

For example the following 2 lines are synonomous:
color red=1 blue=2 green=3 black=4
color red blue green black

NAME = "code"
There is one special meaning word that can be used in the CODETABLE. If the NAME of the first line of CODETABLE is the word "code", it indicates that the first row of the CODETABLE matrix is a code look-up table. In that case, the stimulus code values correspond to whichever column in CODETABLE has that value in the first row. That way the CODETABLE doesn't have to have columns for any unused codes. For example:

codetable = {
0 1 2 3 4
0 2 1 2 3
0 0 0 1 0
}
codenames = {
code
color red=1 blue=2 green=3
moving yes=1 no=0
}

is equivalent to (but easier to read than):

codetable = {
0 2 1 2 3
0 0 0 1 0
}
codenames = {
color red=1 blue=2 green=3
moving
}
In either case, a stimulus code of 3 in the stimulus list would be "moving and blue", whereas a stimulus code of 4 would be "stationary and green".

Any number of stimulus types can be coded as separate rows in CODENAMES. You can also have any number of code values (columns) in CODETABLE, although there is a limit (currently 20) to how many columns can be specified explicitly using the "codetables={" syntax. If you want to have more columns you will probably want to create the CODETABLE by loading values from a data file (e.g. "codetable = import(filename)") instead of trying to list all the values in the parameter file.


DIGIT-MAPPING

Another way to code stimulus meanings is to omit the CODETABLE altogether and use the stimulus code value as a direct index the the CODENAMES table. DIGIT-MAPPING is assumed if the CODENAMES array is specified and CODETABLE is empty. In DIGIT-MAPPING, the stimulus code is interpreted as a multi-digit decimal value and each digit is used as the condition code value for a separate row of CODENAMES. For clarity, the stimulus code values in the stimulus event list should have as many digits as there are lines in CODENAMES. If so, the first digit is the code value for the first row, etc.

For example, with 2 digit codes (e.g. 10, 20, 21, 30) you could simply specify:

codenames = {
color red=1 blue=2 green=3
moving yes=1 no=0
}
instead of the more explicit version:

codetable = {
0 20 10 21 30
0 2 1 2 3
0 0 0 1 0
}
codenames = {
code
color red=1 blue=2 green=3
moving yes=1 no=0
}
The DIGIT-MAPPING form allows for greater numbers of different stimulus code values than is easily available in the CODETABLE format (i.e., 20). The DIGIT-MAPPING approach only allows 9 different values per code condition, however, (i.e. 1 digit) and it is limited to only 7 digits (because of numeric rounding erros for very large numbers), and therefore can only be used with 7 or fewer rows in CODENAMES.

See Also:
Paradigm Parameter Settings
Stimulus List
Event Query Strings

Back to Contents
Back to Running
Back to Introduction