HedTypeManager

class HedTypeManager(event_manager)[source]

Manager for type factors and type definitions.

Methods

HedTypeManager.__init__(event_manager)

Create a variable manager for one tabular file for all type variables.

HedTypeManager.add_type(type_name)

Add a type variable to be managed by this manager.

HedTypeManager.get_factor_vectors(type_tag)

Return a DataFrame of factor vectors for the indicated HED tag and values.

HedTypeManager.get_type(type_tag)

Returns the HedType variable associated with the type tag.

HedTypeManager.get_type_def_names(type_var)

Return the definitions associated with a particular type tag.

HedTypeManager.get_type_tag_factor(type_tag, ...)

Return the HedTypeFactors a specified value and extension.

HedTypeManager.summarize_all([as_json])

Return a dictionary containing the summaries for the types managed by this manager.

Attributes

HedTypeManager.types

Return a list of types managed by this manager.

HedTypeManager.__init__(event_manager)[source]

Create a variable manager for one tabular file for all type variables.

Parameters:

event_manager (EventManager) – An event manager for the tabular file.

Raises:

HedFileError

  • On errors such as unmatched onsets or missing definitions.

HedTypeManager.add_type(type_name)[source]

Add a type variable to be managed by this manager.

Parameters:

type_name (str) – Type tag name of the type to be added.

HedTypeManager.get_factor_vectors(type_tag, type_values=None, factor_encoding='one-hot')[source]

Return a DataFrame of factor vectors for the indicated HED tag and values.

Parameters:
  • type_tag (str) – HED tag to retrieve factors for.

  • type_values (list or None) – The values of the tag to create factors for or None if all unique values.

  • factor_encoding (str) – Specifies type of factor encoding (one-hot or categorical).

Returns:

DataFrame containing the factor vectors as the columns.

Return type:

DataFrame or None

HedTypeManager.get_type(type_tag)[source]

Returns the HedType variable associated with the type tag.

Parameters:

type_tag (str) – HED tag to retrieve the type for.

Returns:

the values associated with this type tag.

Return type:

HedType or None

HedTypeManager.get_type_def_names(type_var)[source]

Return the definitions associated with a particular type tag.

Parameters:

type_var (str) – The name of a type tag such as Condition-variable.

Returns:

Names of definitions that use this type.

Return type:

list

HedTypeManager.get_type_tag_factor(type_tag, type_value)[source]

Return the HedTypeFactors a specified value and extension.

Parameters:
  • type_tag (str or None) – HED tag for the type.

  • type_value (str or None) – Value of this tag to return the factors for.

HedTypeManager.summarize_all(as_json=False)[source]

Return a dictionary containing the summaries for the types managed by this manager.

Parameters:

as_json (bool) – If False (the default), return as an object otherwise return as a JSON string.

Returns:

Dictionary with the summary.

Return type:

dict or str

HedTypeManager.types

Return a list of types managed by this manager.

Returns:

Type tags names.

Return type:

list