internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: mne-tools/mne-python

Issue:
use bibtex in label.py
convert references in `mne/label.py` to use footcite / footbibliography



Discussion:
Hi!
I'm gonna do this ticket

Resolving patch:
diff --git a/mne/label.py b/mne/label.py
--- a/mne/label.py
+++ b/mne/label.py
@@ -738,7 +738,7 @@ def center_of_mass(self, subject=None, restrict_vertices=False,
         """Compute the center of mass of the label.
 
         This function computes the spatial center of mass on the surface
-        as in [1]_.
+        as in :footcite:`LarsonLee2013`.
 
         Parameters
         ----------
@@ -775,8 +775,7 @@ def center_of_mass(self, subject=None, restrict_vertices=False,
 
         References
         ----------
-        .. [1] Larson and Lee, "The cortical dynamics underlying effective
-               switching of auditory spatial attention", NeuroImage 2012.
+        .. footbibliography::
         """
         if not isinstance(surf, str):
             raise TypeError('surf must be a string, got %s' % (type(surf),))


Test patch:
Repository: mne-tools/mne-python

Issue:
Fix the sideways helmet plot
`examples/visualization/plot_mne_helmet.py` plots the helmet sideways.


Discussion:
I'll work on this one :)
awesome.  Reminder: 

```sh
cd doc
PATTERN=plot_mne_helmet make html_dev-pattern
```

Resolving patch:
diff --git a/examples/visualization/plot_mne_helmet.py b/examples/visualization/plot_mne_helmet.py
--- a/examples/visualization/plot_mne_helmet.py
+++ b/examples/visualization/plot_mne_helmet.py
@@ -28,5 +28,5 @@
     coord_frame='mri')
 evoked.plot_field(maps, time=time, fig=fig, time_label=None, vmax=5e-13)
 mne.viz.set_3d_view(
-    fig, azimuth=40, elevation=87, focalpoint=(0., -0.01, 0.04), roll=-100,
-    distance=0.48)
+    fig, azimuth=40, elevation=87, focalpoint=(0., -0.01, 0.04), roll=-25,
+    distance=0.55)


Test patch:
Repository: mne-tools/mne-python

Issue:
fif file extension not required when writing FIFF files
I tried a `raw.save('test.h5')` sort of by accident and while it complained that I wasn't using standard `_raw.fif` conventions it happily saved a fif file with an h5 extension. It took me awhile to realize that this wasn't actually an h5 file (I had hoped the h5 support had been extended).

I'm not sure this is a _bug_, as there isn't really the expectation that it should have written an h5 file but it was a bit confusing.

Is there a reason we don't require a `.fif` ending for files that are always written as fiff?

seems like it would be simple to use the `endings_err` parameter to `check_fname` 
https://github.com/mne-tools/mne-python/blob/1fa17ddf895b42c08aea3120d127572834ac5c96/mne/utils/check.py#L35





Discussion:
I think it should probably emit a warning
ok it currently does issue a warning, so I'll close.


but the warning is maybe misleading. I feel a clearer warning should appear
if you don't use a .fif or .fif.gz extension as it's very like a bug

>

Or we could add it to `endings_err` as @bloyl suggests, people can get old behavior with a `shutil.movefile` if they need it. I guess this is better than a warning given the likelihood of error versus legitimate use.

@bloyl do you want to make a PR for this? It should "just" be a one-liner plus two lines of `with pytest.raises` context and `raw.save(...)`...
I'll put together a PR over the weekend hopefully.
FYI `git grep` suggests there are 22 `save` methods that could potentially use something like this.
there is also a `mne.utils.check_fname` and an `mne.utils._check_fname` which do different things :)

I'll work on this issue (sprint 2021) :)

Resolving patch:
diff --git a/mne/io/base.py b/mne/io/base.py
--- a/mne/io/base.py
+++ b/mne/io/base.py
@@ -1369,7 +1369,8 @@ def save(self, fname, picks=None, tmin=0, tmax=None, buffer_size_sec=None,
         endings = ('raw.fif', 'raw_sss.fif', 'raw_tsss.fif',
                    '_meg.fif', '_eeg.fif', '_ieeg.fif')
         endings += tuple([f'{e}.gz' for e in endings])
-        check_fname(fname, 'raw', endings)
+        endings_err = ('.fif', '.fif.gz')
+        check_fname(fname, 'raw', endings, endings_err=endings_err)
 
         split_size = _get_split_size(split_size)
         if not self.preload and fname in self._filenames:


Test patch:
diff --git a/mne/io/tests/test_raw.py b/mne/io/tests/test_raw.py
--- a/mne/io/tests/test_raw.py
+++ b/mne/io/tests/test_raw.py
@@ -260,6 +260,12 @@ def _test_raw_reader(reader, test_preloading=True, test_kwargs=True,
     out_fname = op.join(tempdir, 'test_raw.fif')
     raw = concatenate_raws([raw])
     raw.save(out_fname, tmax=raw.times[-1], overwrite=True, buffer_size_sec=1)
+
+    # Test saving with not correct extension
+    out_fname_h5 = op.join(tempdir, 'test_raw.h5')
+    with pytest.raises(IOError, match='raw must end with .fif or .fif.gz'):
+        raw.save(out_fname_h5)
+
     raw3 = read_raw_fif(out_fname)
     assert_named_constants(raw3.info)
     assert set(raw.info.keys()) == set(raw3.info.keys())
Repository: mne-tools/mne-python

Issue:
use bibtex in plot_compute_covariance.py
convert references in `tutorials/source-modeling/plot_compute_covariance.py` to use footcite / footbibliography



Discussion:
I'll work on this one

Resolving patch:
diff --git a/tutorials/source-modeling/plot_compute_covariance.py b/tutorials/source-modeling/plot_compute_covariance.py
--- a/tutorials/source-modeling/plot_compute_covariance.py
+++ b/tutorials/source-modeling/plot_compute_covariance.py
@@ -103,8 +103,9 @@
 # available. Unfortunately it is not easy to tell the effective number of
 # samples, hence, to choose the appropriate regularization.
 # In MNE-Python, regularization is done using advanced regularization methods
-# described in [1]_. For this the 'auto' option can be used. With this
-# option cross-validation will be used to learn the optimal regularization:
+# described in :footcite:`EngemannGramfort2015`. For this the 'auto' option
+# can be used. With this option cross-validation will be used to learn the
+# optimal regularization:
 
 noise_cov_reg = mne.compute_covariance(epochs, tmax=0., method='auto',
                                        rank=None)
@@ -136,7 +137,7 @@
 # under-regularization.
 #
 # Note that if data have been processed using signal space separation
-# (SSS) [2]_,
+# (SSS) :footcite:`TauluEtAl2005`,
 # gradiometers and magnetometers will be displayed jointly because both are
 # reconstructed from the same SSS basis vectors with the same numerical rank.
 # This also implies that both sensor types are not any longer statistically
@@ -180,9 +181,4 @@
 # References
 # ----------
 #
-# .. [1] Engemann D. and Gramfort A. (2015) Automated model selection in
-#     covariance estimation and spatial whitening of MEG and EEG signals,
-#     vol. 108, 328-342, NeuroImage.
-#
-# .. [2] Taulu, S., Simola, J., Kajola, M., 2005. Applications of the signal
-#    space separation method. IEEE Trans. Signal Proc. 53, 3359-3372.
+# .. footbibliography::


Test patch:
Repository: mne-tools/mne-python

Issue:
use bibtex in xdawn.py
convert references in `mne/preprocessing/xdawn.py` to use footcite / footbibliography



Discussion:
I can do this!

Resolving patch:
diff --git a/mne/preprocessing/xdawn.py b/mne/preprocessing/xdawn.py
--- a/mne/preprocessing/xdawn.py
+++ b/mne/preprocessing/xdawn.py
@@ -345,11 +345,12 @@ def _check_Xy(self, X, y=None):
 class Xdawn(_XdawnTransformer):
     """Implementation of the Xdawn Algorithm.
 
-    Xdawn [1]_ [2]_ is a spatial filtering method designed to improve the
-    signal to signal + noise ratio (SSNR) of the ERP responses. Xdawn was
-    originally designed for P300 evoked potential by enhancing the target
-    response with respect to the non-target response. This implementation
-    is a generalization to any type of ERP.
+    Xdawn :footcite:`RivetEtAl2009,RivetEtAl2011` is a spatial
+    filtering method designed to improve the signal to signal + noise
+    ratio (SSNR) of the ERP responses. Xdawn was originally designed for
+    P300 evoked potential by enhancing the target response with respect
+    to the non-target response. This implementation is a generalization
+    to any type of ERP.
 
     Parameters
     ----------
@@ -395,16 +396,7 @@ class Xdawn(_XdawnTransformer):
 
     References
     ----------
-    .. [1] Rivet, B., Souloumiac, A., Attina, V., & Gibert, G. (2009). xDAWN
-           algorithm to enhance evoked potentials: application to
-           brain-computer interface. Biomedical Engineering, IEEE Transactions
-           on, 56(8), 2035-2043.
-
-    .. [2] Rivet, B., Cecotti, H., Souloumiac, A., Maby, E., & Mattout, J.
-           (2011, August). Theoretical analysis of xDAWN algorithm:
-           application to an efficient sensor selection in a P300 BCI. In
-           Signal Processing Conference, 2011 19th European (pp. 1382-1386).
-           IEEE.
+    .. footbibliography::
     """
 
     def __init__(self, n_components=2, signal_cov=None, correct_overlap='auto',


Test patch:
Repository: mne-tools/mne-python

Issue:
use bibtex in plot_stats_cluster_erp.py
convert references in `tutorials/stats-sensor-space/plot_stats_cluster_erp.py` to use footcite / footbibliography



Discussion:
I'll take this one. :) 

Resolving patch:
diff --git a/tutorials/stats-sensor-space/plot_stats_cluster_erp.py b/tutorials/stats-sensor-space/plot_stats_cluster_erp.py
--- a/tutorials/stats-sensor-space/plot_stats_cluster_erp.py
+++ b/tutorials/stats-sensor-space/plot_stats_cluster_erp.py
@@ -9,8 +9,8 @@
 permutation approaches (here with Threshold-Free Cluster Enhancement);
 and how to visualise the results.
 
-The underlying data comes from [1]_; we contrast long vs. short words.
-TFCE is described in [2]_.
+The underlying data comes from :footcite:`DufauEtAl2015`; we contrast long vs.
+short words. TFCE is described in :footcite:`SmithNichols2009`.
 """
 
 import numpy as np
@@ -122,10 +122,5 @@
 
 ###############################################################################
 # References
-# ----------
-# .. [1] Dufau, S., Grainger, J., Midgley, KJ., Holcomb, PJ. A thousand
-#    words are worth a picture: Snapshots of printed-word processing in an
-#    event-related potential megastudy. Psychological Science, 2015
-# .. [2] Smith and Nichols 2009, "Threshold-free cluster enhancement:
-#    addressing problems of smoothing, threshold dependence, and
-#    localisation in cluster inference", NeuroImage 44 (2009) 83-98.
+# ==========
+# .. footbibliography::


Test patch:
Repository: mne-tools/mne-python

Issue:
use bibtex in plot_sensor_noise_level.py
convert references in `examples/visualization/plot_sensor_noise_level.py` to use footcite / footbibliography



Discussion:
I will work on this

Resolving patch:
diff --git a/examples/visualization/plot_sensor_noise_level.py b/examples/visualization/plot_sensor_noise_level.py
--- a/examples/visualization/plot_sensor_noise_level.py
+++ b/examples/visualization/plot_sensor_noise_level.py
@@ -5,13 +5,7 @@
 ======================================
 
 This shows how to use :meth:`mne.io.Raw.plot_psd` to examine noise levels
-of systems. See [1]_ for an example.
-
-References
-----------
-.. [1] Khan S, Cohen D (2013). Note: Magnetic noise from the inner wall of
-   a magnetically shielded room. Review of Scientific Instruments 84:56101.
-   https://doi.org/10.1063/1.4802845
+of systems. See :footcite:`KhanCohen2013` for an example.
 """
 # Author: Eric Larson <larson.eric.d@gmail.com>
 #
@@ -29,3 +23,8 @@
 # We can plot the absolute noise levels:
 raw_erm.plot_psd(tmax=10., average=True, spatial_colors=False,
                  dB=False, xscale='log')
+###############################################################################
+# References
+# ----------
+#
+# .. footbibliography::


Test patch:
Repository: mne-tools/mne-python

Issue:
use bibtex in plot_15_handling_bad_channels.py
convert references in `tutorials/preprocessing/plot_15_handling_bad_channels.py` to use footcite / footbibliography



Discussion:
I'll have a look on this issue

Resolving patch:
diff --git a/tutorials/preprocessing/plot_15_handling_bad_channels.py b/tutorials/preprocessing/plot_15_handling_bad_channels.py
--- a/tutorials/preprocessing/plot_15_handling_bad_channels.py
+++ b/tutorials/preprocessing/plot_15_handling_bad_channels.py
@@ -2,7 +2,7 @@
 """
 .. _tut-bad-channels:
 
-Interpolating bad channels
+Handling bad channels
 ==========================
 
 This tutorial covers manual marking of bad channels and reconstructing bad
@@ -190,7 +190,8 @@
 # ~~~~~~~~~~~~~~~~~~~~~~~
 #
 # Interpolation of EEG channels in MNE-Python is done using the spherical
-# spline method [1]_, which projects the sensor locations onto a unit sphere
+# spline method :footcite:`PerrinEtAl1989`, which projects the sensor
+# locations onto a unit sphere
 # and interpolates the signal at the bad sensor locations based on the signals
 # at the good locations. Mathematical details are presented in
 # :ref:`channel-interpolation`. Interpolation of MEG channels uses the field
@@ -255,9 +256,7 @@
 # References
 # ^^^^^^^^^^
 #
-# .. [1] Perrin, F., Pernier, J., Bertrand, O. and Echallier, JF. (1989).
-#        Spherical splines for scalp potential and current density mapping.
-#        *Electroencephalography Clinical Neurophysiology* 72(2):184-187.
+# .. footbibliography::
 #
 #
 # .. LINKS


Test patch:
Repository: mne-tools/mne-python

Issue:
use bibtex in envelope.py
convert references in `mne/connectivity/envelope.py` to use footcite / footbibliography



Discussion:
I will work on this!

Resolving patch:
diff --git a/mne/connectivity/envelope.py b/mne/connectivity/envelope.py
--- a/mne/connectivity/envelope.py
+++ b/mne/connectivity/envelope.py
@@ -64,7 +64,7 @@ def envelope_correlation(data, combine='mean', orthogonalize="pairwise",
     Notes
     -----
     This function computes the power envelope correlation between
-    orthogonalized signals [1]_ [2]_.
+    orthogonalized signals :footcite:`HippEtAl2012,KhanEtAl2018`.
 
     .. versionchanged:: 0.22
       Computations fixed for ``orthogonalize=True`` and diagonal entries are
@@ -72,12 +72,7 @@ def envelope_correlation(data, combine='mean', orthogonalize="pairwise",
 
     References
     ----------
-    .. [1] Hipp JF, Hawellek DJ, Corbetta M, Siegel M, Engel AK (2012)
-           Large-scale cortical correlation structure of spontaneous
-           oscillatory activity. Nature Neuroscience 15:884–890
-    .. [2] Khan S et al. (2018). Maturation trajectories of cortical
-           resting-state networks depend on the mediating frequency band.
-           Neuroimage 174:57–68
+    .. footbibliography::
     """
     _check_option('orthogonalize', orthogonalize, (False, 'pairwise'))
     from scipy.signal import hilbert


Test patch:
Repository: mne-tools/mne-python

Issue:
use bibtex in limo.py
convert references in `mne/datasets/limo/limo.py` to use footcite / footbibliography



Discussion:
I'll work on this one!

Resolving patch:
diff --git a/mne/datasets/limo/limo.py b/mne/datasets/limo/limo.py
--- a/mne/datasets/limo/limo.py
+++ b/mne/datasets/limo/limo.py
@@ -49,8 +49,8 @@ def data_path(subject, path=None, force_update=False, update_path=None,
     """Get path to local copy of LIMO dataset URL.
 
     This is a low-level function useful for getting a local copy of the
-    remote LIMO dataset [1]_. The complete dataset is available at
-    datashare.is.ed.ac.uk/ [2]_.
+    remote LIMO dataset :footcite: `Rousselet2016`. The complete dataset is available at
+    datashare.is.ed.ac.uk/.
 
     Parameters
     ----------
@@ -86,12 +86,6 @@ def data_path(subject, path=None, force_update=False, update_path=None,
     and prompt the user to save the 'datasets' path to the mne-python config,
     if it isn't there already.
 
-    References
-    ----------
-    .. [1] Guillaume, Rousselet. (2016). LIMO EEG Dataset, [dataset].
-           University of Edinburgh, Centre for Clinical Brain Sciences.
-           https://doi.org/10.7488/ds/1556.
-    .. [2] https://datashare.is.ed.ac.uk/handle/10283/2189?show=full
     """  # noqa: E501
     # set destination path for download
     key = 'MNE_DATASETS_LIMO_PATH'
@@ -242,3 +236,9 @@ def load_data(subject, path=None, force_update=False, update_path=None,
     epochs.info['bads'] = missing_chans  # missing channels are marked as bad.
 
     return epochs
+
+###############################################################################
+# References
+# ----------
+#
+# .. footbibliography::


Test patch:
Repository: mne-tools/mne-python

Issue:
use bibtex in eegbci.py
convert references in `mne/datasets/eegbci/eegbci.py` to use footcite / footbibliography



Discussion:
Christina Zhao is on it

Resolving patch:
diff --git a/mne/datasets/eegbci/eegbci.py b/mne/datasets/eegbci/eegbci.py
--- a/mne/datasets/eegbci/eegbci.py
+++ b/mne/datasets/eegbci/eegbci.py
@@ -17,7 +17,7 @@ def data_path(url, path=None, force_update=False, update_path=None,
     """Get path to local copy of EEGMMI dataset URL.
 
     This is a low-level function useful for getting a local copy of a
-    remote EEGBCI dataset [1]_ which is available at PhysioNet [2]_.
+    remote EEGBCI dataset :footcite:`SchalkEtAl2004` which is available at PhysioNet :footcite:`GoldbergerEtAl2000`.
 
     Parameters
     ----------
@@ -57,14 +57,7 @@ def data_path(url, path=None, force_update=False, update_path=None,
 
     References
     ----------
-    .. [1] Schalk, G., McFarland, D.J., Hinterberger, T., Birbaumer, N.,
-           Wolpaw, J.R. (2004) BCI2000: A General-Purpose Brain-Computer
-           Interface (BCI) System. IEEE TBME 51(6):1034-1043
-    .. [2] Goldberger AL, Amaral LAN, Glass L, Hausdorff JM, Ivanov PCh,
-           Mark RG, Mietus JE, Moody GB, Peng C-K, Stanley HE. (2000)
-           PhysioBank, PhysioToolkit, and PhysioNet: Components of a New
-           Research Resource for Complex Physiologic Signals.
-           Circulation 101(23):e215-e220
+    .. footbibliography::
     """  # noqa: E501
     key = 'MNE_DATASETS_EEGBCI_PATH'
     name = 'EEGBCI'
@@ -90,8 +83,8 @@ def load_data(subject, runs, path=None, force_update=False, update_path=None,
               base_url=EEGMI_URL, verbose=None):  # noqa: D301
     """Get paths to local copies of EEGBCI dataset files.
 
-    This will fetch data for the EEGBCI dataset [1]_, which is also
-    available at PhysioNet [2]_.
+    This will fetch data for the EEGBCI dataset :footcite:`SchalkEtAl2004`, which is also
+    available at PhysioNet :footcite:`GoldbergerEtAl2000`.
 
     Parameters
     ----------
@@ -147,14 +140,7 @@ def load_data(subject, runs, path=None, force_update=False, update_path=None,
 
     References
     ----------
-    .. [1] Schalk, G., McFarland, D.J., Hinterberger, T., Birbaumer, N.,
-           Wolpaw, J.R. (2004) BCI2000: A General-Purpose Brain-Computer
-           Interface (BCI) System. IEEE TBME 51(6):1034-1043
-    .. [2] Goldberger AL, Amaral LAN, Glass L, Hausdorff JM, Ivanov PCh,
-           Mark RG, Mietus JE, Moody GB, Peng C-K, Stanley HE. (2000)
-           PhysioBank, PhysioToolkit, and PhysioNet: Components of a New
-           Research Resource for Complex Physiologic Signals.
-           Circulation 101(23):e215-e220
+    .. footbibliography::
     """  # noqa: E501
     if not hasattr(runs, '__iter__'):
         runs = [runs]


Test patch:
Repository: mne-tools/mne-python

Issue:
use bibtex in viz/evoked.py
convert references in `mne/viz/evoked.py` to use footcite / footbibliography



Discussion:
I'll work on this one

Resolving patch:
diff --git a/mne/viz/evoked.py b/mne/viz/evoked.py
--- a/mne/viz/evoked.py
+++ b/mne/viz/evoked.py
@@ -1036,9 +1036,10 @@ def plot_evoked_white(evoked, noise_cov, show=True, rank=None, time_unit='s',
     """Plot whitened evoked response.
 
     Plots the whitened evoked response and the whitened GFP as described in
-    [1]_. This function is especially useful for investigating noise
-    covariance properties to determine if data are properly whitened (e.g.,
-    achieving expected values in line with model assumptions, see Notes below).
+    :footcite:`EngemannGramfort2015`. This function is especially useful for
+    investigating noise covariance properties to determine if data are
+    properly whitened (e.g., achieving expected values in line with model
+    assumptions, see Notes below).
 
     Parameters
     ----------


Test patch:
Repository: mne-tools/mne-python

Issue:
use bibtex in spatial_resolution.py
convert references in `mne/minimum_norm/spatial_resolution.py` to use footcite / footbibliography



Discussion:
@cmista and I will work on this one.  Thanks!


Resolving patch:
diff --git a/mne/minimum_norm/spatial_resolution.py b/mne/minimum_norm/spatial_resolution.py
--- a/mne/minimum_norm/spatial_resolution.py
+++ b/mne/minimum_norm/spatial_resolution.py
@@ -44,13 +44,14 @@ def resolution_metrics(resmat, src, function='psf', metric='peak_err',
 
         Spatial-extent-based metrics:
 
-        - ``'sd_ext'`` spatial deviation (e.g. [1,2]_).
-        - ``'maxrad_ext'`` maximum radius to 50%% of max amplitude.
+        - ``'sd_ext'`` Spatial deviation
+          (e.g. :footcite:`MolinsEtAl2008,HaukEtAl2019`).
+        - ``'maxrad_ext'`` Maximum radius to 50%% of max amplitude.
 
         Amplitude-based metrics:
 
-        - ``'peak_amp'`` Ratio between absolute maximum amplitudes of peaks per
-            location and maximum peak across locations.
+        - ``'peak_amp'`` Ratio between absolute maximum amplitudes of peaks
+          per location and maximum peak across locations.
         - ``'sum_amp'`` Ratio between sums of absolute amplitudes.
 
     threshold : float
@@ -65,18 +66,13 @@ def resolution_metrics(resmat, src, function='psf', metric='peak_err',
 
     Notes
     -----
-    For details, see [1]_ [2]_.
+    For details, see :footcite:`MolinsEtAl2008,HaukEtAl2019`.
 
     .. versionadded:: 0.20
 
     References
     ----------
-    .. [1] Molins A, Stufflebeam S M, Brown E N, Hämäläinen M S (2008).
-           Quantification of the benefit from integrating MEG and EEG data in
-           minimum l2-norm estimation. Neuroimage, 42(3):1069-77.
-    .. [2] Hauk O, Stenroos M, Treder M (2019). "Towards an Objective
-           Evaluation of EEG/MEG Source Estimation Methods: The Linear Tool
-           Kit", bioRxiv, doi: https://doi.org/10.1101/672956.
+    .. footbibliography::
     """
     # Check if input options are valid
     metrics = ('peak_err', 'cog_err', 'sd_ext', 'maxrad_ext', 'peak_amp',


Test patch: