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

Filenames #11

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Changes from 1 commit
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
Next Next commit
account for filenames not being string
  • Loading branch information
sappelhoff committed Oct 9, 2024
commit 5f9794a6abc51a3f14d5ed13fa83af54a61ac62a
16 changes: 13 additions & 3 deletions eeglabio/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pathlib
import logging

import numpy as np
Expand Down Expand Up @@ -178,18 +179,27 @@ def export_mne_raw(inst, fname, precision="single"):
Parameters
----------
inst : mne.io.BaseRaw
Raw instance to save
Raw instance to save.
fname : str
Name of the export file.
"""
from .raw import export_set

# load data first
inst.load_data()

# remove extra epoc and STI channels
chs_drop = [ch for ch in ['epoc'] if ch in inst.ch_names]
if 'STI 014' in inst.ch_names and \
not (inst.filenames[0].endswith('.fif')):

if isinstance(inst.filenames[0], pathlib.Path):
notfif = not (inst.filenames[0].suffix.endswith('.fif'))
elif isinstance(inst.filenames[0], str):
notfif = not inst.filenames[0].endswith('.fif')
else:
# assume not fif
notfif = True

if 'STI 014' in inst.ch_names and notfif:
chs_drop.append('STI 014')
inst.drop_channels(chs_drop)

Expand Down