FactorHedTagsOp

class FactorHedTagsOp(parameters)[source]

Append columns of factors based on column values to a columnar file.

Required remodeling parameters:
  • queries (list): Queries to be applied successively as filters.

Optional remodeling parameters:
  • expand_context (bool): Expand the context if True.

  • query_names (list): Column names for the query factors.

  • remove_types (list): Structural HED tags to be removed (such as Condition-variable or Task).

  • expand_context (bool): If true, expand the context based on Onset, Offset, and Duration.

Notes

  • If query names are not provided, query1, query2, … are used.

  • If query names are provided, the list must have same list as the number of queries.

  • When the context is expanded, the effect of events for temporal extent is accounted for.

Methods

FactorHedTagsOp.__init__(parameters)

Constructor for the factor HED tags operation.

FactorHedTagsOp.do_op(dispatcher, df, name)

Factor the column using HED tag queries.

FactorHedTagsOp.validate_input_data(parameters)

Parse and valid the queries and return issues in parsing queries, if any.

Attributes

FactorHedTagsOp.NAME

FactorHedTagsOp.PARAMS

FactorHedTagsOp.__init__(parameters)[source]

Constructor for the factor HED tags operation.

Parameters:

parameters (dict) – Actual values of the parameters for the operation.

FactorHedTagsOp.do_op(dispatcher, df, name, sidecar=None)[source]

Factor the column using HED tag queries.

Parameters:
  • dispatcher (Dispatcher) – Manages the operation I/O.

  • df (DataFrame) – The DataFrame to be remodeled.

  • name (str) – Unique identifier for the dataframe – often the original file path.

  • sidecar (Sidecar or file-like) – Only needed for HED operations.

Returns:

A new dataframe after processing.

Return type:

Dataframe

Raises:

ValueError

  • If a name for a new query factor column is already a column.

static FactorHedTagsOp.validate_input_data(parameters)[source]

Parse and valid the queries and return issues in parsing queries, if any.

Parameters:

parameters (dict) – Dictionary representing the actual operation values.

Returns:

List of issues in parsing queries.

Return type:

list

FactorHedTagsOp.NAME = 'factor_hed_tags'
FactorHedTagsOp.PARAMS = {'additionalProperties': False, 'properties': {'expand_context': {'description': 'If true, the assembled HED tags include the effects of temporal extent (e.g., Onset).', 'type': 'boolean'}, 'queries': {'description': 'List of HED tag queries to compute one-hot factors for.', 'items': {'type': 'string'}, 'minItems': 1, 'type': 'array', 'uniqueItems': True}, 'query_names': {'description': 'Optional column names for the queries.', 'items': {'type': 'string'}, 'minItems': 1, 'type': 'array', 'uniqueItems': True}, 'remove_types': {'descriptions': 'List of type tags to remove from before querying (e.g., Condition-variable, Task).', 'items': {'type': 'string'}, 'minItems': 1, 'type': 'array', 'uniqueItems': True}, 'replace_defs': {'description': 'If true, Def tags are replaced with definition contents.', 'type': 'boolean'}}, 'required': ['queries'], 'type': 'object'}