SummarizeSidecarFromEventsOp

class SummarizeSidecarFromEventsOp(parameters)[source]

Create a JSON sidecar from column values in a collection of tabular files.

Required remodeling parameters:
  • summary_name (str): The name of the summary.

  • summary_filename (str): Base filename of the summary.

  • skip_columns (list): Names of columns to skip in the summary.

  • value_columns (list): Names of columns to treat as value columns rather than categorical columns.

The purpose is to produce a JSON sidecar template for annotating a dataset with HED tags.

Methods

hed.tools.remodeling.operations.summarize_sidecar_from_events_op.SummarizeSidecarFromEventsOp.__init__(...)

Constructor for summarize sidecar from events operation.

hed.tools.remodeling.operations.summarize_sidecar_from_events_op.SummarizeSidecarFromEventsOp.check_parameters(...)

Verify that the parameters meet the operation specification.

hed.tools.remodeling.operations.summarize_sidecar_from_events_op.SummarizeSidecarFromEventsOp.do_op(...)

Extract a sidecar from events file.

Attributes

hed.tools.remodeling.operations.summarize_sidecar_from_events_op.SummarizeSidecarFromEventsOp.PARAMS

hed.tools.remodeling.operations.summarize_sidecar_from_events_op.SummarizeSidecarFromEventsOp.SUMMARY_TYPE

SummarizeSidecarFromEventsOp.__init__(parameters)[source]

Constructor for summarize sidecar from events operation.

Parameters:

parameters (dict) – Dictionary with the parameter values for required and optional parameters.

Raises:
  • KeyError

    • If a required parameter is missing.

    • If an unexpected parameter is provided.

  • TypeError

    • If a parameter has the wrong type.

SummarizeSidecarFromEventsOp.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.

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

Extract a sidecar from events file.

Parameters:
  • dispatcher (Dispatcher) – The dispatcher object for managing the operations.

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

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

  • sidecar (Sidecar or file-like) – Not needed for this operation.

Returns:

A copy of df.

Return type:

DataFrame

Side effect:

Updates the associated summary if applicable.

SummarizeSidecarFromEventsOp.PARAMS = {'operation': 'summarize_sidecar_from_events', 'optional_parameters': {'append_timecode': <class 'bool'>}, 'required_parameters': {'skip_columns': <class 'list'>, 'summary_filename': <class 'str'>, 'summary_name': <class 'str'>, 'value_columns': <class 'list'>}}
SummarizeSidecarFromEventsOp.SUMMARY_TYPE = 'events_to_sidecar'