obci.analysis.obci_signal_processing.tags package¶
Submodules¶
obci.analysis.obci_signal_processing.tags.smart_tag module¶
Implement Smart tags classes: SmartTagEndTag, SmartTagDuration.
Bases:
obci.analysis.obci_signal_processing.read_manager.ReadManager
To be subclassed.
Bases:
obci.analysis.obci_signal_processing.tags.smart_tag.SmartTag
Public interface: - get_data() <- this is the only method to be really used outside - - __init__(tag_def, start_tag) - get_start_timestamp() - get_end_timestamp() - get_data_for(channel) - get_start_tag() - set_data() - set_end_tag()
Bases:
obci.analysis.obci_signal_processing.tags.smart_tag.SmartTag
Public interface: - get_data() <- this is the only method to be really used outside - - __init__(tag_def, start_tag) - get_start_timestamp() - get_end_timestamp() - get_data_for(channel) - get_start_tag() - get_end_tag() - set_data() - set_end_tag()
- p_tag_def - must be an instance of SmartTagEndTagDefinition.
- p_start_tag - must be a dictionary representaion of existing tag.
This method must be fired only and only once, to set smart tag`s ending tag.
obci.analysis.obci_signal_processing.tags.smart_tag_definition module¶
Module defines classes representing smart tag definition. Smart tag definition is a data structure defining what kind of bunches of samples smart tag is to provide. By now we have a general, abstract class SmartTagDefinition.
Concrete classes are: SmartTagEndTagDefinition
SmartTagDurationDefinition
see concrete classes definitions to learn how to use them.
Bases:
object
An abstract class storing general info. See subclasses defs.
Se subclasses defs.
Bases:
obci.analysis.obci_signal_processing.tags.smart_tag_definition.SmartTagDefinition
The class is to be used for following requirement: ‘We want to extract bunches of samples starting from some particular tag type and lasting x miliseconds. It is a constructor parameter for SmartTagsManager. Constructor`s parameters and (at the same time) public slots: - start_tag_name - string - start_offset - float (default 0) - end_offset - float (default 0) - duration - float
- x = SmartTagDuration(start_tag_name=’ugm_config’,
- start_offset=-10.0, end_offset=20.0, duration=100.0)
Consider samples file f, and tag scattered on the timeline like that: —100ms——————300ms———–400ms———500ms————- ugm_config ugm_config ugm_break ugm_config
Using x definition means: Generate following samples bunches: - 90ms;220ms - 290ms;420ms - 490ms;620ms
See class description.
Type check - return true if p_type is end_tag.
Bases:
obci.analysis.obci_signal_processing.tags.smart_tag_definition.SmartTagDefinition
The class is to be used for following requirement: ‘We want to extract bunches of samples starting from some particular tag type and ending with some particular tag type.’ It is a constructor parameter for SmartTagsManager. Constructor`s parameters and (at the same time) public slots: - start_tag_name - string - start_offset - float (default 0) - end_offset - float (default 0) - end_tags_names - list of strings.
- x = SmartTagEndTagDefinition(start_tag_name=’ugm_config’,
- start_offset=-10.0, end_offset=20.0, end_tags_names=[‘ugm_config’, ‘ugm_break’])
Consider samples file f, and tag scattered on the timeline like that: —100ms——————300ms———–400ms———500ms———-700ms ugm_config ugm_config ugm_break ugm_config
Using x definition means: Generate following samples bunches: - 90ms;320ms - 290ms;420ms
See class description.
Type check - return true if p_type is end_tag.
obci.analysis.obci_signal_processing.tags.tag_utils module¶
For given tag parameters return a dictionary representing tag with those parameters. Parameters: - p_start_timestamp - float - p_end_timestamp - float - p_tag_name - string - p_tag_desc - dictionary - p_tag_channels - string like “0 6 7” - numbers of channels
For given dictinary describing tag in strings, return dictionary where numeric values are numbers, not strings. The method is fired by file tags reader, while parsing xml tags file.
obci.analysis.obci_signal_processing.tags.tags_file_reader module¶
Module provides a simple class that is able to read tags xml file and give on demand subsequential tags.
Bases:
object
A simple class that is able to read tags xml file and give on demand subsequential tags.
Init tags file path.
Return next tag or None if all tags were alredy returned by this method.
Read tags file, store data in memory.
obci.analysis.obci_signal_processing.tags.tags_file_writer module¶
Bases:
object
A proxy for openbci tags file, that writes every next tag to file. public interface: - tag_received(tag_dict) - finish_saving()
Prepare data structure for storing in-memory xml file.
Write xml tags to the file, return the file`s path.
For give dictionary with pirs key -> value create an xml element. An exception is with key ‘desc’ where xml elements are created for every element of p_tag_dict[‘desc’] value which is a dictionary.
obci.analysis.obci_signal_processing.tags.tags_logging module¶
Module defines a single method get_logger that returns logger with set logging level. Change loggin.INFO lines to change logging level.
Return logger with p_name as name. And logging level p_level. p_level should be in (starting with the most talkactive): ‘debug’, ‘info’, ‘warning’, ‘error’, ‘critical’.