7. the keyfile

A sample key file

label       start finish cues conds resps
red_vert     -100  200    23  [1:10 100]   0 % this is a comment
red_horiz    -100  200    25  11:20   0
blue_vert    -100  200    23  21:30   0
blue_horiz   -100  200    25  31:40   0
another_one  -100  200    27  41:50   0
% this last analysis is a weird one
yet_another  -150  300    [29 32]   -1    -1

Rules to create a well-written key file

the file doesn't have to look "pretty" to work; however:

  • the first line in the file must contain the header;
  • the first field in the header must be 'label';
  • the rest of the header can contain any combination, in any order, of the following valid fields:
    • start,
    • finish,
    • cues,
    • trials,
    • relative_trials,
    • conds,
    • blocks,
    • repetition,
    • type_of_trial,
    • given_response
    • response
  • if a field is omitted in the keyfile, the default values (see table above) are applied by the constructor
  • each record must contain the same number of fields specified in the header, in the same order;
  • each field can be of any length;
  • fields must be separated by any combination of spaces and tabs;
  • records can be separated by any number of empty lines;
  • the label cannot contain spaces, so use underscores if necessary (e.g., attend_away)
  • if you need to use spaces between values in a field, enclose the whole field in square brackets (e.g., [1 2 3:5])
  • you can add comments (MatLab style) either at the end of a record or on an empty line, but not between or within fields.

Keys and subkeys

It is not always possible to specify in a single row all the trials that belong together in the analysis. For example, you might want to include in the same bunch trials of conditions [6:10], where the cue event is 25, and trials of conditions [16:20], where the cue event is 27.

This can be accomplished by creating "complex" keys, i.e., keys composed of more than one subkey. When the same label appears in consecutive rows in the keyfile, the constructor groups toghether all those rows in complex keys.

In the following example, two complex keys are defined; the first is made of 2 subkeys, the second is made of 3 subkeys:

label        start finish cues conds resps
one_analysis  -100  200    25   6:10   0 % this is a comment
one_analysis  -100  200    27  16:20   0
another_one   -100  200    25  11:15   0
another_one   -100  200    27  21:25   0
another_one   -100  200    27  41:50   0

Previous <-> Next