From 7afe4c566b9e36cd8b6c9e0fead16172547afca5 Mon Sep 17 00:00:00 2001 From: RezaNasri Date: Thu, 14 Jul 2022 18:37:06 +0430 Subject: [PATCH 1/8] fix eeglab export rawarray filenames --- mne/export/_eeglab.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mne/export/_eeglab.py b/mne/export/_eeglab.py index 09e58bda493..de59c41d117 100644 --- a/mne/export/_eeglab.py +++ b/mne/export/_eeglab.py @@ -17,8 +17,11 @@ def _export_raw(fname, raw): # remove extra epoc and STI channels drop_chs = ['epoc'] - if not (raw.filenames[0].endswith('.fif')): - drop_chs.append('STI 014') + try: + if not (raw.filenames[0].endswith('.fif')): + drop_chs.append('STI 014') + except AttributeError: # mne.io.RawArray has no filenames attribute + pass ch_names = [ch for ch in raw.ch_names if ch not in drop_chs] cart_coords = _get_als_coords_from_chs(raw.info['chs'], drop_chs) From e2191d1dab6744e2d4fcbcc9e449b2f9a9fc29d7 Mon Sep 17 00:00:00 2001 From: RezaNasri Date: Thu, 14 Jul 2022 18:54:19 +0430 Subject: [PATCH 2/8] fix flake8 doc style --- mne/export/_eeglab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mne/export/_eeglab.py b/mne/export/_eeglab.py index de59c41d117..9d506f35733 100644 --- a/mne/export/_eeglab.py +++ b/mne/export/_eeglab.py @@ -20,7 +20,7 @@ def _export_raw(fname, raw): try: if not (raw.filenames[0].endswith('.fif')): drop_chs.append('STI 014') - except AttributeError: # mne.io.RawArray has no filenames attribute + except AttributeError: # mne.io.RawArray has no filenames attribute pass ch_names = [ch for ch in raw.ch_names if ch not in drop_chs] From 641d8a3edc9dabc5de79e056462473f49ba3fcdf Mon Sep 17 00:00:00 2001 From: RezaNasri Date: Thu, 14 Jul 2022 18:57:14 +0430 Subject: [PATCH 3/8] append changes to latest.inc names.inc --- doc/changes/latest.inc | 2 ++ doc/changes/names.inc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/doc/changes/latest.inc b/doc/changes/latest.inc index 79bedf1c127..5f189a4b205 100644 --- a/doc/changes/latest.inc +++ b/doc/changes/latest.inc @@ -111,6 +111,8 @@ Enhancements Bugs ~~~~ +- Fix bug in :func: `mne.export._eeglab._export_raw` to ignore empty filenames attribute in :class: `mne.io.RawArray` (:gh: `10927 by :newcontrib: `Reza Nasri`) + - Fix bug in :func:`mne.io.read_raw_edf` to allow reading in all Hypnodyne ZMax EDFs to be read in without issues (:gh:`10754` by :newcontrib:`Frederik Weber`) - Fix bug in :func:`mne.Epochs.drop_bad` where data was loaded although no rejection had to be performed (:gh:`10718` by :newcontrib:`Lukas Gemein`) diff --git a/doc/changes/names.inc b/doc/changes/names.inc index 0f550d09b6f..e09a19a63e2 100644 --- a/doc/changes/names.inc +++ b/doc/changes/names.inc @@ -459,3 +459,5 @@ .. _Frederik Weber: https://github.com/Frederik-D-Weber .. _Mingjian He: https://github.com/mh105 + +.. _Reza Nasri: https://github.com/0reza \ No newline at end of file From 1619ec3ec377c0382b67af0dbe3370d79335af05 Mon Sep 17 00:00:00 2001 From: RezaNasri Date: Thu, 14 Jul 2022 18:58:40 +0430 Subject: [PATCH 4/8] fix typo latest.inc --- doc/changes/latest.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes/latest.inc b/doc/changes/latest.inc index 5f189a4b205..5d46a30a7f0 100644 --- a/doc/changes/latest.inc +++ b/doc/changes/latest.inc @@ -111,7 +111,7 @@ Enhancements Bugs ~~~~ -- Fix bug in :func: `mne.export._eeglab._export_raw` to ignore empty filenames attribute in :class: `mne.io.RawArray` (:gh: `10927 by :newcontrib: `Reza Nasri`) +- Fix bug in :func: `mne.export._eeglab._export_raw` to ignore empty filenames attribute in :class: `mne.io.RawArray` (:gh: `10927` by :newcontrib: `Reza Nasri`) - Fix bug in :func:`mne.io.read_raw_edf` to allow reading in all Hypnodyne ZMax EDFs to be read in without issues (:gh:`10754` by :newcontrib:`Frederik Weber`) From f712d9e4d882a0ac3a30ab2efa3a5372a6d7cf8c Mon Sep 17 00:00:00 2001 From: RezaNasri Date: Thu, 14 Jul 2022 19:25:51 +0430 Subject: [PATCH 5/8] fix typo 2 --- doc/changes/latest.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes/latest.inc b/doc/changes/latest.inc index 5d46a30a7f0..767b203b18e 100644 --- a/doc/changes/latest.inc +++ b/doc/changes/latest.inc @@ -111,7 +111,7 @@ Enhancements Bugs ~~~~ -- Fix bug in :func: `mne.export._eeglab._export_raw` to ignore empty filenames attribute in :class: `mne.io.RawArray` (:gh: `10927` by :newcontrib: `Reza Nasri`) +- Fix bug in :func:`mne.export._eeglab._export_raw` to ignore empty filenames attribute in :class:`mne.io.RawArray` (:gh:`10927` by :newcontrib:`Reza Nasri`) - Fix bug in :func:`mne.io.read_raw_edf` to allow reading in all Hypnodyne ZMax EDFs to be read in without issues (:gh:`10754` by :newcontrib:`Frederik Weber`) From 9b80d9f78c18b376899a7bc67cf3f01156dbbaab Mon Sep 17 00:00:00 2001 From: RezaNasri Date: Thu, 14 Jul 2022 20:09:58 +0430 Subject: [PATCH 6/8] fix reference to public function --- doc/changes/latest.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes/latest.inc b/doc/changes/latest.inc index 767b203b18e..6535d2f0bd6 100644 --- a/doc/changes/latest.inc +++ b/doc/changes/latest.inc @@ -111,7 +111,7 @@ Enhancements Bugs ~~~~ -- Fix bug in :func:`mne.export._eeglab._export_raw` to ignore empty filenames attribute in :class:`mne.io.RawArray` (:gh:`10927` by :newcontrib:`Reza Nasri`) +- Fix bug in :func:`mne.export.export_raw` to ignore empty filenames attribute in :class:`mne.io.RawArray` (:gh:`10927` by :newcontrib:`Reza Nasri`) - Fix bug in :func:`mne.io.read_raw_edf` to allow reading in all Hypnodyne ZMax EDFs to be read in without issues (:gh:`10754` by :newcontrib:`Frederik Weber`) From 33d27ee83485efd38e2ee657a7a0d25c4a488ff8 Mon Sep 17 00:00:00 2001 From: RezaNasri Date: Fri, 15 Jul 2022 05:37:33 +0430 Subject: [PATCH 7/8] remove try-except use condition --- doc/changes/latest.inc | 2 +- mne/export/_eeglab.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/changes/latest.inc b/doc/changes/latest.inc index 6535d2f0bd6..aa41eab4d24 100644 --- a/doc/changes/latest.inc +++ b/doc/changes/latest.inc @@ -111,7 +111,7 @@ Enhancements Bugs ~~~~ -- Fix bug in :func:`mne.export.export_raw` to ignore empty filenames attribute in :class:`mne.io.RawArray` (:gh:`10927` by :newcontrib:`Reza Nasri`) +- Fix bug in :func:`mne.export.export_raw` to ignore None value in filenames attribute of :class:`mne.io.RawArray` (:gh:`10927` by :newcontrib:`Reza Nasri`) - Fix bug in :func:`mne.io.read_raw_edf` to allow reading in all Hypnodyne ZMax EDFs to be read in without issues (:gh:`10754` by :newcontrib:`Frederik Weber`) diff --git a/mne/export/_eeglab.py b/mne/export/_eeglab.py index 9d506f35733..6e6061e7ef7 100644 --- a/mne/export/_eeglab.py +++ b/mne/export/_eeglab.py @@ -17,11 +17,9 @@ def _export_raw(fname, raw): # remove extra epoc and STI channels drop_chs = ['epoc'] - try: - if not (raw.filenames[0].endswith('.fif')): - drop_chs.append('STI 014') - except AttributeError: # mne.io.RawArray has no filenames attribute - pass + # filenames attribute of RawArray is filled with None + if raw.filenames[0] and not (raw.filenames[0].endswith('.fif')): + drop_chs.append('STI 014') ch_names = [ch for ch in raw.ch_names if ch not in drop_chs] cart_coords = _get_als_coords_from_chs(raw.info['chs'], drop_chs) From 3038085bc013e3eaebfa532fe3d7ea0a54cd5378 Mon Sep 17 00:00:00 2001 From: RezaNasri Date: Fri, 15 Jul 2022 11:59:27 +0430 Subject: [PATCH 8/8] empty line names.inc --- doc/changes/names.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes/names.inc b/doc/changes/names.inc index e09a19a63e2..4e0e078069d 100644 --- a/doc/changes/names.inc +++ b/doc/changes/names.inc @@ -460,4 +460,4 @@ .. _Mingjian He: https://github.com/mh105 -.. _Reza Nasri: https://github.com/0reza \ No newline at end of file +.. _Reza Nasri: https://github.com/0reza