EventManager

class EventManager(input_data, hed_schema, extra_defs=None)[source]

Manager of events of temporal extent.

Methods

EventManager.__init__(input_data, hed_schema)

Create an event manager for an events file.

EventManager.compress_strings(list_to_compress)

Compress a list of lists of strings into a single str with comma-separated elements.

EventManager.get_type_defs(types)

Return a list of definition names (lower case) that correspond to any of the specified types.

EventManager.str_list_to_hed(str_list)

Create a HedString object from a list of strings.

EventManager.unfold_context([remove_types])

Unfold the event information into a tuple based on context.

Attributes

EventManager.__init__(input_data, hed_schema, extra_defs=None)[source]

Create an event manager for an events file. Manages events of temporal extent.

Parameters:
  • input_data (TabularInput) – Represents an events file with its sidecar.

  • hed_schema (HedSchema) – HED schema used.

  • extra_defs (DefinitionDict) – Extra definitions not included in the input_data information.

Raises:

HedFileError

  • if there are any unmatched offsets.

Notes: Keeps the events of temporal extend by their starting index in events file. These events are separated from the rest of the annotations, which are contained in self.hed_strings.

static EventManager.compress_strings(list_to_compress)[source]

Compress a list of lists of strings into a single str with comma-separated elements.

Parameters:

list_to_compress (list) – List of lists of HED str to turn into a list of single HED strings.

Returns:

List of same length as list_to_compress with each entry being a str.

Return type:

list

EventManager.get_type_defs(types)[source]

Return a list of definition names (lower case) that correspond to any of the specified types.

Parameters:

types (list or None) – List of tags that are treated as types such as ‘Condition-variable’

Returns:

List of definition names (lower-case) that correspond to the specified types

Return type:

list

EventManager.str_list_to_hed(str_list)[source]

Create a HedString object from a list of strings.

Parameters:

str_list (list) – A list of strings to be concatenated with commas and then converted.

Returns:

The converted list.

Return type:

HedString or None

EventManager.unfold_context(remove_types=[])[source]

Unfold the event information into a tuple based on context.

Parameters:

remove_types (list) – List of types to remove.

Returns:

list of str or HedString representing the information without the events of temporal extent. list of str or HedString or None representing the onsets of the events of temporal extent. list of str or HedString or None representing the ongoing context information.

If the