eelbrain.pipeline.LabelVar
- class eelbrain.pipeline.LabelVar(source, codes, default=True, task=None, fnmatch=False)[source]
Variable assigning labels to values
- Parameters:
source (str) – Variable supplying the values (e.g.,
"value").codes (dict[str | float | tuple[str, ...] | tuple[float, ...], str | float]) – Mapping values in
sourceto values in the new variable. The type of the values determines whether the output is aFactor(strvalues) or aVar(numerical values). Keys are matched againstsourceas it is in the data: converted tostrwheresourceis aFactor(1and1.both spell the label'1'), and to numbers where it is aVar('1'matches the value1). This covers avaluecolumn that a BIDS*_events.tsvfile provides as strings. In a numericsource, missing values (n/a) are NaN and can be matched with afloat('nan')or'nan'key. Keys that become identical through this conversion (e.g.,1and'1') are rejected.default (str | float | bool | None) – Label for values not in
codes. By default, this is''for categorial and 0 for numerical output. Set toFalseto pass through unlabeled input values.task (str) – Only apply the variable to events from this task.
See also
Notes
With
source='subject'the definition spans subjects (it lists a value for each of them), which defers it to the point where different subjects’ data are combined; seeGroupVarfor the implications. Only that exact source is deferred: asourcethat merely involves the subject, such as'subject%value', is applied per subject like any other event variable, and so any subject’s entry invalidates every subject’s events.