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
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion eeglabio/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def export_set(fname, data, sfreq, ch_names, ch_locs=None, annotations=None,
EEGLAB of the existing reference, this method will not reference the
data for you.
ch_types : list of str | None
Channel types e.g. ‘EEG’, ‘MEG’, ‘EMG’, ‘ECG’, ‘Events’, ..
List of channel types, for example ``"EEG"``, ``"MEG"``, ``"ECG"``,
``"Events"``.
precision : "single" or "double"
Precision of the exported data (specifically EEG.data in EEGLAB)

Expand Down
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
Loading