eelbrain.label_operator

eelbrain.label_operator(labels, operation='mean', exclude=None, weights=None, dim_name='label', dim_values=None)

Convert labeled NDVar into a matrix operation to extract label values

Parameters:
  • labels (NDVar of int) – NDVar in which each label corresponds to a unique integer.

  • operation ('mean' | 'sum') – Whether to extract the label mean or sum.

  • exclude (array_like) – Values to exclude (i.e., use exclude=0 to ignore the area where labels==0.

  • weights (NDVar) – NDVar with same dimension as labels to assign weights to label elements.

  • dim_name (str) – Name for the dimension characterized by labels (default "label").

  • dim_values (dict) – Dictionary mapping label ids (i.e., values in labels) to values on the dimension characterized by labels. If values are strings the new dimension will be categorical, if values are scalar it will be Scalar. The default values are the integers in labels.

Returns:

m – Label operator, m.dot(data) extracts label mean/sum.

Return type:

NDVar