Skip to content

Commit

Permalink
Show epochs/events imported from data file in events list/epoch viewer
Browse files Browse the repository at this point in the history
Previously epochs sourced from the data file appeared only in the epoch viewer, and events sourced from the data file appeared only in the events list.
  • Loading branch information
jpgill86 committed Jul 1, 2019
1 parent c426c81 commit ac63635
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions neurotic/datasets/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ def LoadAndPrepareData(metadata, lazy=False, signal_group_mode='split-all', filt
if not lazy:
blk = ApplyFilters(metadata, blk)

# copy events into epochs and vice versa
epochs_from_events = [neo.Epoch(name=ev.name, times=ev.times, labels=ev.labels, durations=np.zeros_like(ev.times)) for ev in blk.segments[0].events]
events_from_epochs = [neo.Event(name=ep.name, times=ep.times, labels=ep.labels) for ep in blk.segments[0].epochs]
if not filter_events_from_epochs:
blk.segments[0].epochs += epochs_from_events
blk.segments[0].events += events_from_epochs

# read in annotations
annotations_dataframe = ReadAnnotationsFile(metadata)
blk.segments[0].epochs += CreateNeoEpochsFromDataframe(annotations_dataframe, metadata, abs_path(metadata, 'annotations_file'), filter_events_from_epochs)
Expand Down

0 comments on commit ac63635

Please sign in to comment.