DefExpandGatherer

class DefExpandGatherer(hed_schema, known_defs=None, ambiguous_defs=None, errors=None)[source]

Gather definitions from a series of def-expands, including possibly ambiguous ones.

Methods

DefExpandGatherer.__init__(hed_schema[, ...])

Initialize the DefExpandGatherer class.

DefExpandGatherer.get_ambiguous_group(...)

Turn an entry in the ambiguous_defs dict into a single HedGroup.

DefExpandGatherer.process_def_expands(...[, ...])

Process the HED strings containing def-expand tags.

Attributes

DefExpandGatherer.__init__(hed_schema, known_defs=None, ambiguous_defs=None, errors=None)[source]

Initialize the DefExpandGatherer class.

Parameters:
  • hed_schema (HedSchema) – The HED schema to be used for processing.

  • known_defs (str or list or DefinitionDict) – A dictionary of known definitions.

  • ambiguous_defs (dict, optional) – A dictionary of ambiguous def-expand definitions.

static DefExpandGatherer.get_ambiguous_group(ambiguous_def)[source]

Turn an entry in the ambiguous_defs dict into a single HedGroup.

Returns:

The ambiguous definition with known placeholders filled in.

Return type:

HedGroup

DefExpandGatherer.process_def_expands(hed_strings, known_defs=None)[source]

Process the HED strings containing def-expand tags.

Parameters:
  • hed_strings (pd.Series or list) – A Pandas Series or list of HED strings to be processed.

  • known_defs (dict, optional) – A dictionary of known definitions to be added.

Returns:

A tuple containing the DefinitionDict, ambiguous definitions, and errors.

Return type:

tuple