Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Fix update of epoch_tags store #1521

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/pynwb/epoch.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ def __init__(self, **kwargs):

@docval({'name': 'start_time', 'type': 'float', 'doc': 'Start time of epoch, in seconds'},
{'name': 'stop_time', 'type': 'float', 'doc': 'Stop time of epoch, in seconds'},
{'name': 'tags', 'type': (str, list, tuple), 'doc': 'user-defined tags used throughout time intervals',
'default': None},
{'name': 'tags', 'type': (str, list, tuple),
'doc': ('User-defined tags used throughout time intervals. If list or tuple each element is treated as '
'a separate tag. If str, can be a single tag, or comma-separated entries that will be parsed '
'into individual tags.'), 'default': None},
{'name': 'timeseries', 'type': (list, tuple, TimeSeries), 'doc': 'the TimeSeries this epoch applies to',
'default': None},
allow_extra=True)
Expand Down
7 changes: 6 additions & 1 deletion src/pynwb/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,12 @@ def add_epoch(self, **kwargs):
"""
self.__check_epochs()
if kwargs['tags'] is not None:
self.epoch_tags.update(kwargs['tags'])
# If a str is passed into epoch_tags directly, it gets split into characters
# This processing needs to match tags parsing in `epoch.TimeIntervals.add_interval`
tmp = kwargs['tags']
if isinstance(kwargs['tags'], str):
tmp = [s.strip() for s in kwargs['tags'].split(",") if not s.isspace()]
oruebel marked this conversation as resolved.
Show resolved Hide resolved
self.epoch_tags.update(tmp)
self.epochs.add_interval(**kwargs)

def __check_electrodes(self):
Expand Down