braintools.cogtask.ctx_value

Contents

braintools.cogtask.ctx_value#

braintools.cogtask.ctx_value(key, default=0)[source]#

Create a dynamic value that reads directly from context.

Parameters:
  • key (str) – Context key to read.

  • default (Any) – Default value if key not found (default 0).

Returns:

Value function (ctx, feature) -> value

Return type:

Callable[[Context, Feature], Any]

Examples

>>> inputs={'fixation': ctx_value('fixation_strength', default=1.0)}