From 5e6efd4249070a9659efe7f4c483fdf1617f5ca5 Mon Sep 17 00:00:00 2001 From: "DESKTOP-I57LBN2\\Lae" Date: Wed, 8 Mar 2023 13:15:48 -0500 Subject: [PATCH] Fix copyfile_eeglab type conflicts --- doc/whats_new.rst | 1 + mne_bids/copyfiles.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/doc/whats_new.rst b/doc/whats_new.rst index cd08f31ac..b4563b3f6 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -52,6 +52,7 @@ Detailed list of changes ^^^^^^^^^^^^ - Amending a dataset now works in cases where the newly-written data contains additional participant properties (new columns in ``participants.tsv``) not found in the existing dataset, by `Richard Höchenberger`_ (:gh:`1113`) +- Fixes copyfile_eeglab to prevent data int conversion and eeg_checkset failure, by `Laetitia Fesselier`_ (:gh:`1122`) :doc:`Find out what was new in previous releases ` diff --git a/mne_bids/copyfiles.py b/mne_bids/copyfiles.py index 8da9b707e..49a14fc0e 100644 --- a/mne_bids/copyfiles.py +++ b/mne_bids/copyfiles.py @@ -564,6 +564,15 @@ def copyfile_eeglab(src, dest): new_value[0, 0] = np.atleast_1d(np.array(tail)) eeg['data'] = new_value + # Make sure all values are saved as float + # (see https://github.com/mne-tools/mne-bids/issues/1122) + eeg['nbchan'] = float(eeg['nbchan']) + eeg['pnts'] = float(eeg['pnts']) + eeg['trials'] = float(eeg['trials']) + eeg['srate'] = float(eeg['srate']) + eeg['xmin'] = float(eeg['xmin']) + eeg['xmax'] = float(eeg['xmax']) + # Save the EEG dictionary as a Matlab struct again mdict = dict(EEG=eeg) if oldstyle else eeg savemat(file_name=dest, mdict=mdict, appendmat=False)