Feature#

class braintools.cogtask.Feature(num, name=None)[source]#

Individual feature encoder for cognitive task inputs/outputs.

A Feature defines the encoding dimensions for a single input or output channel in a cognitive task.

Parameters:
  • num (int) – Number of dimensions for this feature.

  • name (str | None) – Feature name. Required for composition.

Examples

>>> from braintools.cogtask import Feature
>>> fix = Feature(1, 'fixation')
>>> stim = Feature(8, 'stimulus')
>>> fix.num, fix.i
(1, slice(0, 1, None))
>>>
>>> # Compose features into a FeatureSet
>>> all_features = fix + stim
>>> all_features.num
9
>>>
>>> # Repeat a feature with indexed names
>>> Feature(2, 'choice') * 3
FeatureSet(names=['choice_0', 'choice_1', 'choice_2'], nums=[2, 2, 2])
copy()[source]#

Create a shallow copy of this feature.

Return type:

Feature

shift(num)[source]#

Shift indices by the given amount.