braintools.cogtask.match_label

Contents

braintools.cogtask.match_label#

braintools.cogtask.match_label(match_key, match_label=1, nonmatch_label=2)[source]#

Create a label for match/non-match tasks.

Parameters:
  • match_key (str) – Context key containing boolean match status (True/False).

  • match_label (int) – Label for match trials (default 1).

  • nonmatch_label (int) – Label for non-match trials (default 2).

Returns:

Label function (ctx, feature) -> int

Return type:

Callable[[Context, Feature | None], int]

Examples

>>> outputs={'label': match_label('is_match')}
>>> outputs={'label': match_label('is_match', match_label=1, nonmatch_label=2)}