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

Issue:
evoked.plot_image silently "works" when clim is not a dict
Here is the script to reproduce:

```py
import os
import mne

sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
                                    'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False).crop(tmax=120)

events = mne.find_events(raw, stim_channel='STI 014')
event_dict = {'auditory/left': 1, 'auditory/right': 2, 'visual/left': 3,
              'visual/right': 4, 'face': 5, 'button': 32}
epochs = mne.Epochs(raw, events, tmin=-0.2, tmax=0.5, event_id=event_dict,
                    preload=True)
epochs.pick_types(eeg=True, meg=False)
evoked = epochs.average()

evoked.plot_image(clim =[-4, 4])
```
This is a bit of a nitpicky bug but note how the `clim` has no effect. I think it should throw an error or use this `clim` ... either of the two. Fixing this can help improve user experience :)


Discussion:
I can work on this!

Resolving patch:
diff --git a/mne/viz/evoked.py b/mne/viz/evoked.py
--- a/mne/viz/evoked.py
+++ b/mne/viz/evoked.py
@@ -273,6 +273,13 @@ def _plot_evoked(evoked, picks, exclude, unit, show, ylim, proj, xlim, hline,
     titles = _handle_default('titles', titles)
     units = _handle_default('units', units)
 
+    if plot_type == "image":
+        if ylim is not None and not isinstance(ylim, dict):
+            # The user called Evoked.plot_image() or plot_evoked_image(), the
+            # clim parameters of those functions end up to be the ylim here.
+            raise ValueError("`clim` must be a dict. "
+                             "E.g. clim = dict(eeg=[-20, 20])")
+
     picks = _picks_to_idx(info, picks, none='all', exclude=())
     if len(picks) != len(set(picks)):
         raise ValueError("`picks` are not unique. Please remove duplicates.")


Test patch:
diff --git a/mne/viz/tests/test_evoked.py b/mne/viz/tests/test_evoked.py
--- a/mne/viz/tests/test_evoked.py
+++ b/mne/viz/tests/test_evoked.py
@@ -281,6 +281,9 @@ def test_plot_evoked_image():
         pytest.raises(ValueError, evoked.plot_image, group_by=group_by,
                       axes=axes)
 
+    with pytest.raises(ValueError, match='`clim` must be a dict.'):
+        evoked.plot_image(clim=[-4, 4])
+
 
 def test_plot_white():
     """Test plot_white."""
Repository: mne-tools/mne-python

Issue:
brains out-of-frame in plot_dipole_orientations tutorial
Several of the figures in `tutorials/source-modeling/plot_dipole_orientations.py` are out-of-frame in the tutorial.  Tweak the plotting params so that they look right.


Discussion:
I'm on this!

Resolving patch:
diff --git a/tutorials/source-modeling/plot_dipole_orientations.py b/tutorials/source-modeling/plot_dipole_orientations.py
--- a/tutorials/source-modeling/plot_dipole_orientations.py
+++ b/tutorials/source-modeling/plot_dipole_orientations.py
@@ -118,6 +118,7 @@
 _, time_max = stc.get_peak(hemi='lh')
 brain_fixed = stc.plot(surface='white', subjects_dir=subjects_dir,
                        initial_time=time_max, time_unit='s', size=(600, 400))
+mne.viz.set_3d_view(figure=brain_fixed, focalpoint=(0., 0., 50))
 
 ###############################################################################
 # The direction of the estimated current is now restricted to two directions:
@@ -170,6 +171,7 @@
 _, time_max = stc.magnitude().get_peak(hemi='lh')
 brain_mag = stc.plot(subjects_dir=subjects_dir, initial_time=time_max,
                      time_unit='s', size=(600, 400), overlay_alpha=0)
+mne.viz.set_3d_view(figure=brain_mag, focalpoint=(0., 0., 50))
 
 ###############################################################################
 # .. _plot_dipole_orientations_vLOC_orientations:
@@ -192,6 +194,7 @@
 _, time_max = stc.magnitude().get_peak(hemi='lh')
 brain_loose = stc.plot(subjects_dir=subjects_dir, initial_time=time_max,
                        time_unit='s', size=(600, 400), overlay_alpha=0)
+mne.viz.set_3d_view(figure=brain_loose, focalpoint=(0., 0., 50))
 
 ###############################################################################
 # Discarding dipole orientation information
@@ -210,6 +213,7 @@
 _, time_max = stc.get_peak(hemi='lh')
 brain = stc.plot(surface='white', subjects_dir=subjects_dir,
                  initial_time=time_max, time_unit='s', size=(600, 400))
+mne.viz.set_3d_view(figure=brain, focalpoint=(0., 0., 50))
 
 ###############################################################################
 # References


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

Issue:
use bibtex in plot_brainstorm_auditory.py
convert references in `tutorials/sample-datasets/plot_brainstorm_auditory.py` to use footcite / footbibliography



Discussion:
I'll work on this!

Resolving patch:
diff --git a/tutorials/sample-datasets/plot_brainstorm_auditory.py b/tutorials/sample-datasets/plot_brainstorm_auditory.py
--- a/tutorials/sample-datasets/plot_brainstorm_auditory.py
+++ b/tutorials/sample-datasets/plot_brainstorm_auditory.py
@@ -7,8 +7,9 @@
 ====================================
 
 Here we compute the evoked from raw for the auditory Brainstorm
-tutorial dataset. For comparison, see [1]_ and the associated
-`brainstorm site <https://neuroimage.usc.edu/brainstorm/Tutorials/Auditory>`_.
+tutorial dataset. For comparison, see :footcite:`TadelEtAl2011` and the
+associated `brainstorm site
+<https://neuroimage.usc.edu/brainstorm/Tutorials/Auditory>`_.
 
 Experiment:
 
@@ -23,10 +24,7 @@
 
 References
 ----------
-.. [1] Tadel F, Baillet S, Mosher JC, Pantazis D, Leahy RM.
-       Brainstorm: A User-Friendly Application for MEG/EEG Analysis.
-       Computational Intelligence and Neuroscience, vol. 2011, Article ID
-       879716, 13 pages, 2011. doi:10.1155/2011/879716
+.. footbibliography::
 """
 
 # Authors: Mainak Jas <mainak.jas@telecom-paristech.fr>


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

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



Discussion:
I'll work on this

Resolving patch:
diff --git a/mne/transforms.py b/mne/transforms.py
--- a/mne/transforms.py
+++ b/mne/transforms.py
@@ -733,7 +733,7 @@ def _sph_to_cart(sph_pts):
 def _get_n_moments(order):
     """Compute the number of multipolar moments (spherical harmonics).
 
-    Equivalent to [1]_ Eq. 32.
+    Equivalent to :footcite:`DarvasEtAl2006` Eq. 32.
 
     .. note:: This count excludes ``degree=0`` (for ``order=0``).
 
@@ -901,13 +901,12 @@ class _TPSWarp(object):
 
     Notes
     -----
-    Adapted from code by `Wang Lin <wanglin193@hotmail.com>`_.
+    Based on the method by :footcite:`Bookstein1989` and
+    adapted from code by Wang Lin (wanglin193@hotmail.com>).
 
     References
     ----------
-    .. [1] Bookstein, F. L. "Principal Warps: Thin Plate Splines and the
-           Decomposition of Deformations." IEEE Trans. Pattern Anal. Mach.
-           Intell. 11, 567-585, 1989.
+    .. footbibliography::
     """
 
     def fit(self, source, destination, reg=1e-3):
@@ -980,7 +979,9 @@ class _SphericalSurfaceWarp(object):
     Notes
     -----
     This class can be used to warp data from a source subject to
-    a destination subject, as described in [1]_. The procedure is:
+    a destination subject, as described in :footcite:`DarvasEtAl2006`.
+
+    The procedure is:
 
         1. Perform a spherical harmonic approximation to the source and
            destination surfaces, which smooths them and allows arbitrary
@@ -995,9 +996,7 @@ class _SphericalSurfaceWarp(object):
 
     References
     ----------
-    .. [1] Darvas F, Ermer JJ, Mosher JC, Leahy RM (2006). "Generic head
-           models for atlas-based EEG source analysis."
-           Human Brain Mapping 27:129-143
+    .. footbibliography::
     """
 
     def __repr__(self):


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

Issue:
stc_near_sensors mode has incongruent docstring
#### Proposed documentation ehancement
I think(?) `stc_near_sensors` only enables nearest, single and sum, but it also says there is a "zero" and "weighted" option? 

Once it's cleared up what sort of activation `mode`s are available and when, I can make a PR to fix up the docstring.

Reference: https://mne.tools/dev/generated/mne.stc_near_sensors.html?highlight=stc_near#mne.stc_near_sensors


Discussion:
It's likely that the docstring is outdated -- let's update it to do what the code actually does/has
I'll have a go 

Resolving patch:
diff --git a/mne/source_estimate.py b/mne/source_estimate.py
--- a/mne/source_estimate.py
+++ b/mne/source_estimate.py
@@ -3226,8 +3226,9 @@ def stc_near_sensors(evoked, trans, subject, distance=0.01, mode='sum',
         Distance (m) defining the activation "ball" of the sensor.
     mode : str
         Can be "sum" to do a linear sum of weights, "nearest" to
-        use only the weight of the nearest sensor, or "zero" to use a
-        zero-order hold. See Notes.
+        use only the weight of the nearest sensor, or "single" to
+        do a distance-weight of the nearest sensor. Default is "sum".
+        See Notes.
     project : bool
         If True, project the electrodes to the nearest ``'pial`` surface
         vertex before computing distances. Only used when doing a
@@ -3264,10 +3265,10 @@ def stc_near_sensors(evoked, trans, subject, distance=0.01, mode='sum',
         1 and a sensor at ``distance`` meters away (or larger) gets weight 0.
         If ``distance`` is less than the distance between any two electrodes,
         this will be the same as ``'nearest'``.
-    - ``'weighted'``
+    - ``'single'``
         Same as ``'sum'`` except that only the nearest electrode is used,
         rather than summing across electrodes within the ``distance`` radius.
-        As as ``'nearest'`` for vertices with distance zero to the projected
+        As ``'nearest'`` for vertices with distance zero to the projected
         sensor.
     - ``'nearest'``
         The value is given by the value of the nearest sensor, up to a


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

Issue:
Reading EDF file yields incorrect scaling
Reported on the forum:
https://mne.discourse.group/t/eeg-data-in-edf-not-converting-in-volt/

The user provided an EDF file which specifies in its header that the data is in µV. When reading this file with MNE-Python, the data is treated as V.



Discussion:
Opening the file linked in the discussion thread in a hex editor shows that the units are declared as `.V` - so this is clearly an invalid EDF file.
invalid file → `wontfix`?
Yes. MNE has never been super strict, but we should not try to interpret `.V` as `µV`.
Which raises the question: since we do load the file, should we perhaps be stricter and raise an error? I've always argued not to do that, because having incorrectly scaled data is better than having no data.
I agree, +1 for a warning when we can't safely interpret the units. Then the user can fix their file or adjust their processing as necessary
> Which raises the question: since we do load the file, should we perhaps be stricter and raise an error? I've always argued not to do that, because having incorrectly scaled data is better than having no data.

My personal feeling is we should throw an error. I feel that incorrectly scaled data is **worse** than no data ;) 
Ok, a warning it is!

Resolving patch:
diff --git a/mne/io/edf/edf.py b/mne/io/edf/edf.py
--- a/mne/io/edf/edf.py
+++ b/mne/io/edf/edf.py
@@ -613,7 +613,7 @@ def _read_edf_header(fname, exclude):
         for i, unit in enumerate(units):
             if i in exclude:
                 continue
-            if unit == 'uV':
+            if unit in ('uV', 'µV', 'µV'):
                 edf_info['units'].append(1e-6)
             elif unit == 'mV':
                 edf_info['units'].append(1e-3)


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

Issue:
BUG grow_labels with overlap=False
to replicate

```
import mne
from mne.datasets import sample

data_path = sample.data_path()
fname = data_path + '/MEG/sample/sample_audvis-meg'
stc = mne.read_source_estimate(fname)
labels = mne.grow_labels('fsaverage', stc.get_peak(hemi='lh')[0], 1, 1, overlap=False)
```

see https://mne.discourse.group/t/potential-bug-with-grow-labels/2679/1


Discussion:

Resolving patch:
diff --git a/mne/label.py b/mne/label.py
--- a/mne/label.py
+++ b/mne/label.py
@@ -1573,8 +1573,7 @@ def grow_labels(subject, seeds, extents, hemis, subjects_dir=None, n_jobs=1,
     # make sure the inputs are arrays
     if np.isscalar(seeds):
         seeds = [seeds]
-    # these can have different sizes so need to use object array
-    seeds = np.asarray([np.atleast_1d(seed) for seed in seeds], dtype='O')
+    seeds = [np.atleast_1d(seed) for seed in seeds]
     extents = np.atleast_1d(extents)
     hemis = np.atleast_1d(hemis)
     n_seeds = len(seeds)
@@ -1636,7 +1635,7 @@ def grow_labels(subject, seeds, extents, hemis, subjects_dir=None, n_jobs=1,
     if overlap:
         # create the patches
         parallel, my_grow_labels, _ = parallel_func(_grow_labels, n_jobs)
-        seeds = np.array_split(seeds, n_jobs)
+        seeds = np.array_split(np.array(seeds, dtype='O'), n_jobs)
         extents = np.array_split(extents, n_jobs)
         hemis = np.array_split(hemis, n_jobs)
         names = np.array_split(names, n_jobs)
@@ -1668,7 +1667,7 @@ def _grow_nonoverlapping_labels(subject, seeds_, extents_, hemis, vertices_,
     labels = []
     for hemi in set(hemis):
         hemi_index = (hemis == hemi)
-        seeds = seeds_[hemi_index]
+        seeds = [seed for seed, h in zip(seeds_, hemis) if h == hemi]
         extents = extents_[hemi_index]
         names = names_[hemi_index]
         graph = graphs[hemi]  # distance graph
@@ -1698,6 +1697,10 @@ def _grow_nonoverlapping_labels(subject, seeds_, extents_, hemis, vertices_,
             # add neighbors within allowable distance
             row = graph[vert_from, :]
             for vert_to, dist in zip(row.indices, row.data):
+                # Prevent adding a point that has already been used
+                # (prevents infinite loop)
+                if (vert_to == seeds[label]).any():
+                    continue
                 new_dist = old_dist + dist
 
                 # abort if outside of extent


Test patch:
diff --git a/mne/tests/test_label.py b/mne/tests/test_label.py
--- a/mne/tests/test_label.py
+++ b/mne/tests/test_label.py
@@ -845,6 +845,10 @@ def test_grow_labels():
     l1 = l11 + l12
     assert_array_equal(l1.vertices, l0.vertices)
 
+    # non-overlapping (gh-8848)
+    for overlap in (False, True):
+        grow_labels('fsaverage', [0], 1, 1, subjects_dir, overlap=overlap)
+
 
 @testing.requires_testing_data
 def test_random_parcellation():
Repository: mne-tools/mne-python

Issue:
graphviz diagrams not clickable/zoomable
The flowchart in the ICA tutorial is too small because it's scaled to fit into the center column. Would be good if one could easily zoom in; easiest would be to link to the full-sized image; most convenient from a user's perspective would be using some kind of lightbox.


https://user-images.githubusercontent.com/2046265/112762090-4e1e3600-8ffe-11eb-8fc7-f0da263dce4c.mov

_Originally posted by @hoechenberger in https://github.com/mne-tools/mne-python/issues/8876#issuecomment-808931273_


Discussion:

Resolving patch:
diff --git a/tutorials/preprocessing/40_artifact_correction_ica.py b/tutorials/preprocessing/40_artifact_correction_ica.py
--- a/tutorials/preprocessing/40_artifact_correction_ica.py
+++ b/tutorials/preprocessing/40_artifact_correction_ica.py
@@ -136,10 +136,20 @@
 # parameters that control dimensionality at various stages are summarized in
 # the diagram below:
 #
+#
+# .. raw:: html
+#
+#    <a href=
+#     "../../_images/graphviz-7483cb1cf41f06e2a4ef451b17f073dbe584ba30.png">
+#
 # .. graphviz:: ../../_static/diagrams/ica.dot
 #    :alt: Diagram of ICA procedure in MNE-Python
 #    :align: left
 #
+# .. raw:: html
+#
+#    </a>
+#
 # See the Notes section of the `~mne.preprocessing.ICA` documentation
 # for further details. Next we'll walk through an extended example that
 # illustrates each of these steps in greater detail.


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

Issue:
notebooks repr misses the proj information
See

<img width="704" alt="Screenshot 2021-05-18 at 12 39 44" src="https://user-images.githubusercontent.com/161052/118650976-4fd9ce00-b7e5-11eb-97cc-4800c9e6ea65.png">

it turned out to be annoying in a vscode debugging session today.




Discussion:

Resolving patch:
diff --git a/mne/data/html_templates.py b/mne/data/html_templates.py
--- a/mne/data/html_templates.py
+++ b/mne/data/html_templates.py
@@ -56,10 +56,16 @@
         <th>Highpass</th>
         <td>{{u'%0.2f' % info['highpass']}} Hz</td>
     </tr>
-     <tr>
+    <tr>
         <th>Lowpass</th>
         <td>{{u'%0.2f' % info['lowpass']}} Hz</td>
     </tr>
+    {{if projs}}
+        <tr>
+            <th>Projections</th>
+            <td>{{projs}}</td>
+        </tr>
+    {{endif}}
 </table>
 """)
 
diff --git a/mne/io/meas_info.py b/mne/io/meas_info.py
--- a/mne/io/meas_info.py
+++ b/mne/io/meas_info.py
@@ -830,10 +830,17 @@ def _repr_html_(self, caption=None):
         meas_date = self['meas_date']
         if meas_date is not None:
             meas_date = meas_date.strftime("%B %d, %Y  %H:%M:%S") + ' GMT'
+        projs = self['projs']
+        if projs:
+            projs = '<br/>'.join(
+                p['desc'] + ': o%s' % {0: 'ff', 1: 'n'}[p['active']]
+                for p in projs
+            )
 
         html += info_template.substitute(
             caption=caption, info=self, meas_date=meas_date, n_eeg=n_eeg,
-            n_grad=n_grad, n_mag=n_mag, n_fnirs=n_fnirs, eog=eog, ecg=ecg)
+            n_grad=n_grad, n_mag=n_mag, n_fnirs=n_fnirs, eog=eog, ecg=ecg,
+            projs=projs)
         return html
 
 
diff --git a/tutorials/intro/30_info.py b/tutorials/intro/30_info.py
--- a/tutorials/intro/30_info.py
+++ b/tutorials/intro/30_info.py
@@ -9,7 +9,7 @@
 of various recording details, and is attached to :class:`~mne.io.Raw`,
 :class:`~mne.Epochs`, and :class:`~mne.Evoked` objects.
 
-We'll begin by loading the Python modules we need, and loading the same
+We will begin by loading the Python modules we need, and loading the same
 :ref:`example data <sample-dataset>` we used in the :ref:`introductory tutorial
 <tut-overview>`:
 """


Test patch:
diff --git a/mne/io/tests/test_meas_info.py b/mne/io/tests/test_meas_info.py
--- a/mne/io/tests/test_meas_info.py
+++ b/mne/io/tests/test_meas_info.py
@@ -809,6 +809,14 @@ def test_repr():
     assert 'dev_head_t: MEG device -> isotrak transform' in repr(info)
 
 
+def test_repr_html():
+    """Test Info HTML repr."""
+    info = read_info(raw_fname)
+    assert 'Projections' in info._repr_html_()
+    info['projs'] = []
+    assert 'Projections' not in info._repr_html_()
+
+
 @testing.requires_testing_data
 def test_invalid_subject_birthday():
     """Test handling of an invalid birthday in the raw file."""
Repository: mne-tools/mne-python

Issue:
Broken link on website
Hey friends, this link https://mne.tools/stable/auto_tutorials/evoked/20_visualize_evoked.py
is broken here 
<img width="1346" alt="Screenshot 2021-05-19 at 23 51 12" src="https://user-images.githubusercontent.com/4321826/118889327-3e83e500-b8fd-11eb-9703-40c3f9a2d4ff.png">



Discussion:

Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -723,7 +723,7 @@ def append_attr_meth_examples(app, what, name, obj, options, lines):
              alt='Connectivity'),
         dict(title='Data Visualization',
              text='Explore your data from multiple perspectives.',
-             url='auto_tutorials/evoked/20_visualize_evoked.py',
+             url='auto_tutorials/evoked/20_visualize_evoked.html',
              img='sphx_glr_20_visualize_evoked_007.png',
              alt='Visualization'),
     ]


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

Issue:
BUG: Raw.plot() error when changing duration while vline visible
#### Describe the bug
When the vertical line is visible and the shown duration is reduced by pressing `End`, nothing happens and an error occurs due to l.713-714 in mne.viz._figure.py:
```python
if key == 'end' and self.mne.vline_visible:  # prevent flicker
    self._show_vline(None)
```
```python
Traceback (most recent call last):
  File "/home/martins/miniconda3/envs/mnedev/lib/python3.9/site-packages/matplotlib/cbook/__init__.py", line 270, in process
    func(*args, **kwargs)
  File "/home/martins/PycharmProjects/mne-python/mne/viz/_figure.py", line 714, in _keypress
    self._show_vline(None)
  File "/home/martins/PycharmProjects/mne-python/mne/viz/_figure.py", line 2210, in _show_vline
    self.mne.vline_text.set_text(f'{xdata:0.2f} s ')
TypeError: unsupported format string passed to NoneType.__format__
```

What is the preventing of flicker about?
Would you rather remove the line or handle None as argument?

#### Steps to reproduce

1. Plot Raw as in:
```python
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file)
raw.plot(block=True)
```
2. Make vertical line visible by clicking inside plot
3. Press `End` on keyboard.

#### Expected results
Duration changes.


#### Actual results
Duration doesn't change, error is thrown instead.



Discussion:

Resolving patch:
diff --git a/mne/viz/_figure.py b/mne/viz/_figure.py
--- a/mne/viz/_figure.py
+++ b/mne/viz/_figure.py
@@ -710,8 +710,6 @@ def _keypress(self, event):
                 if self.mne.t_start + self.mne.duration > last_time:
                     self.mne.t_start = last_time - self.mne.duration
                 self._update_hscroll()
-                if key == 'end' and self.mne.vline_visible:  # prevent flicker
-                    self._show_vline(None)
                 self._redraw(annotations=True)
         elif key == '?':  # help window
             self._toggle_help_fig(event)
@@ -2200,10 +2198,9 @@ def _recompute_epochs_vlines(self, xdata):
     def _show_vline(self, xdata):
         """Show the vertical line(s)."""
         if self.mne.is_epochs:
-            # special case: changed view duration w/ "home" or "end" key
-            # (no click event, hence no xdata)
+            # convert xdata to be epoch-relative (for the text)
             rel_time = self._recompute_epochs_vlines(xdata)
-            xdata = rel_time + self.mne.inst.times[0]  # for the text
+            xdata = rel_time + self.mne.inst.times[0]
         else:
             self.mne.vline.set_xdata(xdata)
             self.mne.vline_hscroll.set_xdata(xdata)


Test patch: