FactorHedTagsOp

class FactorHedTagsOp(parameters)[source]

Create tabular file factors from tag queries.

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

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

  • remove_types (list): Structural HED tags to be removed.

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

Notes

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

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

  • Context expansion is not implemented in the current version.

Methods

hed.tools.remodeling.operations.factor_hed_tags_op.FactorHedTagsOp.__init__(...)

Constructor for the factor HED tags operation.

hed.tools.remodeling.operations.factor_hed_tags_op.FactorHedTagsOp.check_parameters(...)

Verify that the parameters meet the operation specification.

hed.tools.remodeling.operations.factor_hed_tags_op.FactorHedTagsOp.do_op(...)

Factor the column using HED tag queries.

Attributes

hed.tools.remodeling.operations.factor_hed_tags_op.FactorHedTagsOp.PARAMS

FactorHedTagsOp.__init__(parameters)[source]

Constructor for the factor HED tags operation.

Parameters:

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

Raises:
  • KeyError

    • If a required parameter is missing.

    • If an unexpected parameter is provided.

  • TypeError

    • If a parameter has the wrong type.

  • ValueError

    • If the specification is missing a valid operation.

    • If the length of query names is not empty and not same length as queries.

    • If there are duplicate query names.

FactorHedTagsOp.check_parameters(parameters)

Verify that the parameters meet the operation specification.

Parameters:

parameters (dict) – Dictionary of parameters for this operation.

Raises:
  • KeyError

    • If a required parameter is missing.

    • If an unexpected parameter is provided.

  • TypeError

    • If a parameter has the wrong type.

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.

FactorHedTagsOp.PARAMS = {'operation': 'factor_hed_tags', 'optional_parameters': {'expand_context': <class 'bool'>}, 'required_parameters': {'queries': <class 'list'>, 'query_names': <class 'list'>, 'remove_types': <class 'list'>}}