Repository: mne-tools/mne-bids

Issue:
Remove .gz extension for fif: It's no longer part of the validator
Throughout the current state of MNE BIDS, the file ending `.gz` is used as an identifier for FIF files:

https://github.com/mne-tools/mne-bids/blob/c73ce744d30be87645e1648754b488f7572307f3/mne_bids/meg_bids.py#L33-L34

Can we change this to `fif.gz`? I am just concerned, because other files can be `.gz` and have nothing to do with FIF.


Discussion:
okay agreed ! PR welcome
given this [issue](https://github.com/INCF/bids-validator/issues/491) on the bids-validator, we should wait until there is some resolution before starting to work on this.
Since `fif.gz` is no longer supported with the validator, we should remove it. See https://github.com/INCF/bids-validator/pull/496
yeah, let's follow that PR and remove it once it is removed

Resolving patch:
diff --git a/mne_bids/io.py b/mne_bids/io.py
--- a/mne_bids/io.py
+++ b/mne_bids/io.py
@@ -9,7 +9,7 @@
 from mne import io
 import os
 
-ALLOWED_EXTENSIONS = ['.con', '.sqd', '.fif', '.gz', '.pdf', '.ds']
+ALLOWED_EXTENSIONS = ['.con', '.sqd', '.fif', '.pdf', '.ds']
 
 
 def _parse_ext(raw_fname, verbose=False):
@@ -37,7 +37,7 @@ def _read_raw(raw_fname, electrode=None, hsp=None, hpi=None, config=None,
                               mrk=hpi, preload=False)
 
     # Neuromag or converted-to-fif systems
-    elif ext in ['.fif', '.gz']:
+    elif ext in ['.fif']:
         raw = io.read_raw_fif(raw_fname, preload=False)
 
     # BTi systems
diff --git a/mne_bids/mne_bids.py b/mne_bids/mne_bids.py
--- a/mne_bids/mne_bids.py
+++ b/mne_bids/mne_bids.py
@@ -29,15 +29,13 @@
 
 
 ALLOWED_KINDS = ['meg', 'ieeg']
-orientation = {'.sqd': 'ALS', '.con': 'ALS', '.fif': 'RAS', '.gz': 'RAS',
-               '.pdf': 'ALS', '.ds': 'ALS'}
+orientation = {'.sqd': 'ALS', '.con': 'ALS', '.fif': 'RAS', '.pdf': 'ALS',
+               '.ds': 'ALS'}
 
-units = {'.sqd': 'm', '.con': 'm', '.fif': 'm', '.gz': 'm', '.pdf': 'm',
-         '.ds': 'cm'}
+units = {'.sqd': 'm', '.con': 'm', '.fif': 'm', '.pdf': 'm', '.ds': 'cm'}
 
 manufacturers = {'.sqd': 'KIT/Yokogawa', '.con': 'KIT/Yokogawa',
-                 '.fif': 'Elekta', '.gz': 'Elekta', '.pdf': '4D Magnes',
-                 '.ds': 'CTF'}
+                 '.fif': 'Elekta', '.pdf': '4D Magnes', '.ds': 'CTF'}
 
 
 def _channels_tsv(raw, fname, verbose):
@@ -434,7 +432,7 @@ def raw_to_bids(subject_id, task, raw_file, output_path, session_id=None,
     data_meta_fname = make_bids_filename(
         subject=subject_id, session=session_id, task=task, run=run,
         suffix='%s.json' % kind, prefix=data_path)
-    if ext in ['.fif', '.gz', '.ds']:
+    if ext in ['.fif', '.ds']:
         raw_file_bids = make_bids_filename(
             subject=subject_id, session=session_id, task=task, run=run,
             suffix='%s%s' % (kind, ext))
@@ -496,7 +494,7 @@ def raw_to_bids(subject_id, task, raw_file, output_path, session_id=None,
 
     # for FIF, we need to re-save the file to fix the file pointer
     # for files with multiple parts
-    if ext in ['.fif', '.gz']:
+    if ext in ['.fif']:
         raw.save(raw_file_bids, overwrite=overwrite)
     elif ext == '.ds':
         sh.copytree(raw_fname, raw_file_bids)


Test patch: