BaseOp

class BaseOp(op_spec, parameters)[source]

Base class for operations. All remodeling operations should extend this class.

The base class holds the parameters and does basic parameter checking against the operation’s specification.

Methods

hed.tools.remodeling.operations.base_op.BaseOp.__init__(...)

Base class constructor for operations.

hed.tools.remodeling.operations.base_op.BaseOp.check_parameters(...)

Verify that the parameters meet the operation specification.

hed.tools.remodeling.operations.base_op.BaseOp.do_op(...)

Base class method to be overridden by each operation.

Attributes

BaseOp.__init__(op_spec, parameters)[source]

Base class constructor for operations.

Parameters:
  • op_spec (dict) – Specification for required and optional 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.

BaseOp.check_parameters(parameters)[source]

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.

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

Base class method to be overridden by each operation.

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

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

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

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