From 841e14d018e6af1f7225b23ad15ef121a938870a Mon Sep 17 00:00:00 2001 From: Laetitia Fesselier Date: Wed, 8 Mar 2023 17:30:54 -0500 Subject: [PATCH] Fix copyfile_eeglab type conflicts (#1126) * Fix copyfile_eeglab type conflicts * Alternative solution using loadmat option mat_dtype * Authors/citation updates --- CITATION.cff | 3 +++ doc/authors.rst | 1 + doc/whats_new.rst | 1 + mne_bids/copyfiles.py | 5 +++-- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index d0ad70af0..0effc3793 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -155,6 +155,9 @@ authors: family-names: Gerster affiliation: 'Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig, Germany' orcid: 'https://orcid.org/0000-0001-9343-6986' + - given-names: Fesselier + family-names: Laetitia + affiliation: 'McGill Centre for Integrative Neuroscience, McGill University, Montreal, Canada' - given-names: Alexandre family-names: Gramfort affiliation: 'Université Paris-Saclay, Inria, CEA, Palaiseau, France' diff --git a/doc/authors.rst b/doc/authors.rst index c9d454e88..4a046d1ae 100644 --- a/doc/authors.rst +++ b/doc/authors.rst @@ -40,3 +40,4 @@ .. _Bruno Hebling Vieira: https://bhvieira.github.io/ .. _Daniel McCloy: http://dan.mccloy.info .. _Moritz Gerster: http://moritz-gerster.com +.. _Laetitia Fesselier: https://github.com/laemtl diff --git a/doc/whats_new.rst b/doc/whats_new.rst index cd08f31ac..c7ae42a7a 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 :func:`~mne_bids.copyfiles.copyfile_eeglab` to prevent data type conversion leading to an ``eeg_checkset`` failure when trying to load the file in EEGLAB, 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..ed11eefed 100644 --- a/mne_bids/copyfiles.py +++ b/mne_bids/copyfiles.py @@ -533,18 +533,19 @@ def copyfile_eeglab(src, dest): # structure and potentially breaks re-reading of the file uint16_codec = None eeg = loadmat(file_name=src, simplify_cells=False, - appendmat=False, uint16_codec=uint16_codec) + appendmat=False, uint16_codec=uint16_codec, mat_dtype=True) oldstyle = False if 'EEG' in eeg: eeg = eeg['EEG'] oldstyle = True + has_fdt_link = False try: # If the data field is a string, it points to a .fdt file in src dir if isinstance(eeg['data'][0, 0][0], str): has_fdt_link = True except IndexError: - has_fdt_link = False + pass if has_fdt_link: fdt_fname = eeg['data'][0, 0][0]