Skip to content

Commit

Permalink
Fix copyfile_eeglab type conflicts (#1126)
Browse files Browse the repository at this point in the history
* Fix copyfile_eeglab type conflicts

* Alternative solution using loadmat option mat_dtype

* Authors/citation updates
  • Loading branch information
laemtl authored Mar 8, 2023
1 parent 0b1a61d commit 841e14d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions doc/authors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <whats_new_previous_releases>`

Expand Down
5 changes: 3 additions & 2 deletions mne_bids/copyfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 841e14d

Please sign in to comment.