Skip to content

Commit

Permalink
Added load_flags keyword argument to load previously saved rejection …
Browse files Browse the repository at this point in the history
…flags so they do not need to be re-entered each time (fix Visualizer: allow loading from the manual flag file if it exists #15)
  • Loading branch information
dsuplica committed Nov 11, 2024
1 parent d631365 commit 8f02b24
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pypeline/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def __init__(
chan_offset=CHAN_OFFSET,
channels_drop=None,
channels_ignore=None,
load_flags=True,
):
self.sub = sub
self.parent_dir = parent_dir
Expand Down Expand Up @@ -93,7 +94,12 @@ def __init__(
self.rej_chans[:, self.ignored_channels_mask] = False
self.rej_reasons[:, self.ignored_channels_mask] = None

self.rej_manual = self.rej_chans.any(1)
if load_flags:
self.data_path.update(suffix="rejection_flags", extension=".npy")
print("You have saved annotations already. Loading these.")
self.rej_manual = np.load(self.data_path.fpath)
else:
self.rej_manual = self.rej_chans.any(1)

self.info = self.epochs_obj.info
self.chan_types = self.info.get_channel_types()
Expand Down

0 comments on commit 8f02b24

Please sign in to comment.