From 28e8cdb39b40d4af7c2ab4d9170703aa3202d11e Mon Sep 17 00:00:00 2001 From: Mara Wolter <70799249+marakw@users.noreply.github.com> Date: Thu, 29 Feb 2024 18:24:40 +0100 Subject: [PATCH] FIX: account for potential `.{integer}_meg4` extensions in CTF format (#1230) * In copyfile_ctf change suffix .meg4 to meg4 such that files with suffix .{int}_meg4 are also renamed * Account for potential .{int}_meg4 extensions by adding them separately to file types. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * New contributor entry to authors.rst * Add Mara to new contributors --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Stefan Appelhoff --- CITATION.cff | 4 ++++ doc/authors.rst | 1 + doc/whats_new.rst | 3 +++ mne_bids/copyfiles.py | 7 +++++++ 4 files changed, 15 insertions(+) diff --git a/CITATION.cff b/CITATION.cff index 271f2672f..f17d661fd 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -171,6 +171,10 @@ authors: family-names: Guetschel orcid: 'https://orcid.org/0000-0002-8933-7640' affiliation: 'Donders Institute for Brain, Cognition and Behaviour, Radboud University, Nijmegen, Netherlands' + - given-names: Mara + family-names: Wolter + orcid: 'https://orcid.org/0000-0002-6785-9886' + affiliation: 'Centre for Integrative Neuroscience, Tübingen, Germany' - 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 77ce5c33e..efad72dbf 100644 --- a/doc/authors.rst +++ b/doc/authors.rst @@ -44,3 +44,4 @@ .. _Jonathan Vanhoecke: https://github.com/JonathanVHoecke .. _Ford McDonald: https://github.com/fordmcdonald .. _Pierre Guetschel: https://github.com/PierreGtch +.. _Mara Wolter: https://github.com/marakw diff --git a/doc/whats_new.rst b/doc/whats_new.rst index 07d32b090..0a13f0311 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -18,6 +18,7 @@ Version 0.15 (unreleased) The following authors contributed for the first time. Thank you so much! 🤩 * `Daniel McCloy`_ +* `Mara Wolter`_ The following authors had contributed before. Thank you for sticking around! 🤘 @@ -59,6 +60,8 @@ Detailed list of changes - The datatype in the dataframe returned by :func:`mne_bids.stats.count_events` is now ``pandas.Int64Dtype`` instead of ``float64``, by `Eric Larson`_ (:gh:`1227`) +- The :func:`mne_bids.copyfiles.copyfile_ctf` now accounts for files with ``.{integer}_meg4`` extension, instead of only .meg4, + when renaming the files of a .ds folder, by `Mara Wolter`_ (:gh:`1230`) ⚕️ Code health ^^^^^^^^^^^^^^ diff --git a/mne_bids/copyfiles.py b/mne_bids/copyfiles.py index 3d525a429..5455ed83f 100644 --- a/mne_bids/copyfiles.py +++ b/mne_bids/copyfiles.py @@ -162,6 +162,13 @@ def copyfile_ctf(src, dest): ".newds", ".res4", ) + + # Consider CTF files that are split having consecutively numbered extensions + extra_ctf_file_types = tuple( + f".{i}_meg4" for i in range(1, 21) + ) # cap at 20 is arbitrary + file_types += extra_ctf_file_types + # Rename files in dest with the name of the dest directory fnames = [f for f in os.listdir(dest) if f.endswith(file_types)] bids_folder_name = op.splitext(op.split(dest)[-1])[0]