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

Issue:
Info rank computation fails if picking only 'grad' or 'mag'
try to run this:

```python
import os.path as op
import mne
from mne.datasets import somato

data_path = somato.data_path()
subject = '01'
task = 'somato'
raw_fname = op.join(data_path, 'sub-{}'.format(subject), 'meg',
                    'sub-{}_task-{}_meg.fif'.format(subject, task))

raw = mne.io.read_raw_fif(raw_fname)
events = mne.find_events(raw, stim_channel='STI 014')
picks = mne.pick_types(raw.info, meg=True, eeg=False, eog=True, stim=False)
event_id, tmin, tmax = 1, -1., 3.
baseline = (None, 0)
epochs = mne.Epochs(raw, events, event_id, tmin, tmax, picks=picks,
                    baseline=baseline, reject=dict(grad=4000e-13, eog=350e-6),
                    preload=True)
evoked = epochs.average()

print('Rank with all MEG')
print(mne.compute_rank(evoked, 'info'))

print('Rank with only GRAD')
print(mne.compute_rank(evoked.copy().pick('grad'), 'info'))
```

you will get:

```
Rank with all MEG
{'meg': 64}
Rank with only GRAD
{'grad': 204}
```

it shows you that if you pick the grad it ignores the rank computation derived from maxfilter.

@larsoner thoughts?

thx @PABannier for spotting the bug...


Discussion:
Agreed this seems like a bug
do you assign this to you?

>

Yep, should be able to take a look next week

Resolving patch:
diff --git a/mne/rank.py b/mne/rank.py
--- a/mne/rank.py
+++ b/mne/rank.py
@@ -256,7 +256,7 @@ def _get_rank_sss(inst, msg='You should use data-based rank estimate instead',
 
 
 def _info_rank(info, ch_type, picks, rank):
-    if ch_type == 'meg' and rank != 'full':
+    if ch_type in ['meg', 'mag', 'grad'] and rank != 'full':
         try:
             return _get_rank_sss(info)
         except ValueError:


Test patch:
diff --git a/mne/tests/test_rank.py b/mne/tests/test_rank.py
--- a/mne/tests/test_rank.py
+++ b/mne/tests/test_rank.py
@@ -204,7 +204,11 @@ def test_maxfilter_get_rank(n_proj, fname, rank_orig, meg, tol_kind, tol):
     assert raw.info['projs'] == []
     mf = raw.info['proc_history'][0]['max_info']
     assert mf['sss_info']['nfree'] == rank_orig
-    assert _get_rank_sss(raw) == rank_orig
+
+    assert compute_rank(raw, 'info')['meg'] == rank_orig
+    assert compute_rank(raw.copy().pick('grad'), 'info')['grad'] == rank_orig
+    assert compute_rank(raw.copy().pick('mag'), 'info')['mag'] == rank_orig
+
     mult = 1 + (meg == 'separate')
     rank = rank_orig - mult * n_proj
     if n_proj > 0:
Repository: mne-tools/mne-python

Issue:
MAINT: don't skip CIs when merging to main?
as I write this, the most recent merged PR was #9185 which had all-green CIs.  The commit message for the squashed commit (70709f5069ddb413c2719f4d2b41fd6bfea2349a) does not say "ci skip" or use any other of our skip codes, and yet, all the GitHub CIs are showing as "cancelled" (click the red X at the top of the repo homepage where it shows "most recent commit").  Questions:

1. why?
2. is this what is causing CodeCov badge to show 15% coverage?
3. is it possible to change the skip behavior so that skips can occur in open PRs, but never occur on commits to main?


Discussion:
I'm guessing it's due to the new Cancel job being configured incorrectly. Some digging through the logs in https://github.com/mne-tools/mne-python/actions might shed some light on it

Resolving patch:
diff --git a/mne/conftest.py b/mne/conftest.py
--- a/mne/conftest.py
+++ b/mne/conftest.py
@@ -103,6 +103,7 @@ def pytest_configure(config):
     ignore:Call to deprecated class vtk.*:DeprecationWarning
     ignore:Call to deprecated method.*Deprecated since.*:DeprecationWarning
     always:.*get_data.* is deprecated in favor of.*:DeprecationWarning
+    ignore:.*rcParams is deprecated.*global_theme.*:DeprecationWarning
     always::ResourceWarning
     """  # noqa: E501
     for warning_line in warning_lines.split('\n'):


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

Issue:
ENH: Speed up TimeDelayingRidge prediction
Have been using `mne.decoding.time_delaying_ridge.TimeDelayingRidge` and noticed that its `fit` function is faster than its `predict` function, because only the former takes advantage of frequency domain computations. Fixing it might be as simple as changing the `np.convolve` to an FFT-based convolution function such as `scipy.signal.fftconvolve`. I have not done this because it is quite possible that there are other places in the `decoding` module that could benefit from the same (basically, any predictor that relies on a series of adjacent lags as features).


Discussion:
I think that TimeDelayingRidge is pretty unique. It's safe to open a PR to
just fix this estimator.

thx @rkmaddox

>


Resolving patch:
diff --git a/mne/decoding/time_delaying_ridge.py b/mne/decoding/time_delaying_ridge.py
--- a/mne/decoding/time_delaying_ridge.py
+++ b/mne/decoding/time_delaying_ridge.py
@@ -343,6 +343,8 @@ def predict(self, X):
         X : ndarray
             The predicted response.
         """
+        from scipy.signal import fftconvolve
+
         if X.ndim == 2:
             X = X[:, np.newaxis, :]
             singleton = True
@@ -354,7 +356,7 @@ def predict(self, X):
         for ei in range(X.shape[1]):
             for oi in range(self.coef_.shape[0]):
                 for fi in range(self.coef_.shape[1]):
-                    temp = np.convolve(X[:, ei, fi], self.coef_[oi, fi])
+                    temp = fftconvolve(X[:, ei, fi], self.coef_[oi, fi])
                     temp = temp[max(-smin, 0):][:len(out) - offset]
                     out[offset:len(temp) + offset, ei, oi] += temp
         out += self.intercept_


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

Issue:
Add info about reading in Polhemus head scan file into raw instance
Currently, there is no documentation that says that the Polhemus head scan `.pos` file can be read into a `Raw` instance via `mne.io.read_raw_ctf` when the `.pos` file is placed in the CTF directory.

#### Proposal
Include this piece of information in the Notes of the [`mne.io.read_raw_ctf` doc](https://mne.tools/stable/generated/mne.io.read_raw_ctf.html?highlight=read_raw#mne.io.read_raw_ctf).



Discussion:
Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴🏽‍♂️

good idea!  Could you make a PR?  I would also suggest adding a short sentence to the CTF tutorial, saying something like "notice also that the digitized electrode positions (stored in `whatever.pos`) were automatically loaded and added to the `~mne.io.Raw` object."  I'd probably put it somewhere around here: 

https://github.com/mne-tools/mne-python/blob/0d5068dbbce76598c9c6433e1ace1265e1955564/tutorials/io/60_ctf_bst_auditory.py#L77-L89

Resolving patch:
diff --git a/mne/io/ctf/ctf.py b/mne/io/ctf/ctf.py
--- a/mne/io/ctf/ctf.py
+++ b/mne/io/ctf/ctf.py
@@ -57,6 +57,11 @@ def read_raw_ctf(directory, system_clock='truncate', preload=False,
     Notes
     -----
     .. versionadded:: 0.11
+
+    To read in the Polhemus digitization data (for example, from
+    a .pos file), include the file in the CTF directory. The
+    points will then automatically be read into the `mne.io.Raw`
+    instance via `mne.io.read_raw_ctf`.
     """
     return RawCTF(directory, system_clock, preload=preload,
                   clean_names=clean_names, verbose=verbose)
diff --git a/tutorials/io/60_ctf_bst_auditory.py b/tutorials/io/60_ctf_bst_auditory.py
--- a/tutorials/io/60_ctf_bst_auditory.py
+++ b/tutorials/io/60_ctf_bst_auditory.py
@@ -90,6 +90,9 @@
 #   - 12 head tracking channels
 #   - 20 unused channels
 #
+# Notice also that the digitized electrode positions (stored in a .pos file)
+# were automatically loaded and added to the `~mne.io.Raw` object.
+#
 # The head tracking channels and the unused channels are marked as misc
 # channels. Here we define the EOG and ECG channels.
 raw.set_channel_types({'HEOG': 'eog', 'VEOG': 'eog', 'ECG': 'ecg'})


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

Issue:
Crash topomap with only 4 channels from 10-5 system
to replicate the problem:

```
import numpy as np
import mne

ch_names = ['TP9', 'AF7', 'AF8', 'TP10']

info = mne.create_info(ch_names, 100, ch_types='eeg')
evoked = mne.EvokedArray(np.random.randn(4, 10), info)
ten_five = mne.channels.make_standard_montage("standard_1005")
evoked.set_montage(ten_five)
evoked.plot_topomap()
```

now if I do:

`evoked.plot_topomap(sphere=0.14)`

it works.




Discussion:

Resolving patch:
diff --git a/mne/viz/topomap.py b/mne/viz/topomap.py
--- a/mne/viz/topomap.py
+++ b/mne/viz/topomap.py
@@ -5,6 +5,7 @@
 #          Martin Luessi <mluessi@nmr.mgh.harvard.edu>
 #          Eric Larson <larson.eric.d@gmail.com>
 #          Robert Luke <mail@robertluke.net>
+#          Mikołaj Magnuski <mmagnuski@swps.edu.pl>
 #
 # License: Simplified BSD
 
@@ -574,7 +575,7 @@ def _get_extra_points(pos, extrapolate, origin, radii):
     else:
         assert extrapolate == 'head'
         # return points on the head circle
-        angle = np.arcsin(distance / np.mean(radii))
+        angle = np.arcsin(min(distance / np.mean(radii), 1))
         n_pnts = max(12, int(np.round(2 * np.pi / angle)))
         points_l = np.linspace(0, 2 * np.pi, n_pnts, endpoint=False)
         use_radii = radii * 1.1 + distance


Test patch:
diff --git a/mne/viz/tests/test_topomap.py b/mne/viz/tests/test_topomap.py
--- a/mne/viz/tests/test_topomap.py
+++ b/mne/viz/tests/test_topomap.py
@@ -18,7 +18,7 @@
 
 from mne import (read_evokeds, read_proj, make_fixed_length_events, Epochs,
                  compute_proj_evoked, find_layout, pick_types, create_info,
-                 read_cov)
+                 read_cov, EvokedArray)
 from mne.io.proj import make_eeg_average_ref_proj, Projection
 from mne.io import read_raw_fif, read_info, RawArray
 from mne.io.constants import FIFF
@@ -557,6 +557,24 @@ def test_plot_topomap_bads():
     plt.close('all')
 
 
+def test_plot_topomap_channel_distance():
+    """
+    Test topomap plotting with spread out channels (gh-9511, gh-9526).
+
+    Test topomap plotting when the distance between channels is greater than
+    the head radius.
+    """
+    ch_names = ['TP9', 'AF7', 'AF8', 'TP10']
+
+    info = create_info(ch_names, 100, ch_types='eeg')
+    evoked = EvokedArray(np.random.randn(4, 10) * 1e-6, info)
+    ten_five = make_standard_montage("standard_1005")
+    evoked.set_montage(ten_five)
+
+    evoked.plot_topomap(sphere=0.05, res=8)
+    plt.close('all')
+
+
 def test_plot_topomap_bads_grad():
     """Test plotting topomap with bad gradiometer channels (gh-8802)."""
     import matplotlib.pyplot as plt
Repository: mne-tools/mne-python

Issue:
Typo in preprocessing example 15 - Handling bad channels
Maybe I am mistaken, but this looks like a typo: https://mne.tools/stable/auto_tutorials/preprocessing/15_handling_bad_channels.html#when-to-look-for-bad-channels

> After the data has been collected, you can do a more thorough check for bad channels by browsing the raw data using 
> mne.io.Raw.plot(), with any projectors or ICA applied. Finally, you can compute offline averages (again with projectors, 
> ICA, and EEG referencing disabled) to look for channels with unusual properties.

First sentence should be:

> [...] without any projectors or ICA applied.


Discussion:
agreed !

can you send a PR?

>


Resolving patch:
diff --git a/tutorials/preprocessing/15_handling_bad_channels.py b/tutorials/preprocessing/15_handling_bad_channels.py
--- a/tutorials/preprocessing/15_handling_bad_channels.py
+++ b/tutorials/preprocessing/15_handling_bad_channels.py
@@ -124,11 +124,11 @@
 # you can note them in your experiment log or protocol sheet. If your system
 # computes online averages, these can be a good way to spot bad channels as
 # well. After the data has been collected, you can do a more thorough check for
-# bad channels by browsing the raw data using :meth:`mne.io.Raw.plot`, with any
-# projectors or ICA applied. Finally, you can compute offline averages (again
-# with projectors, ICA, and EEG referencing disabled) to look for channels with
-# unusual properties. Here's an example of ERP/F plots where the bad channels
-# were not properly marked:
+# bad channels by browsing the raw data using :meth:`mne.io.Raw.plot`, without
+# any projectors or ICA applied. Finally, you can compute offline averages
+# (again with projectors, ICA, and EEG referencing disabled) to look for
+# channels with unusual properties. Here's an example of ERP/F plots where the
+# bad channels were not properly marked:
 
 raw2 = raw.copy()
 raw2.info['bads'] = []


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

Issue:
mne.io.read_raw_curry() cannot read the event file end with '.cdt.ceo'
#### Describe the bug
I have tried to use `mne.io.read_raw_curry()` to read my data created by Curry 8, but there were no annotations in the Raw object. But EEGLAB can import the data and show the annotations correctly.

#### Steps to reproduce
I read the source code of [curry.py](https://github.com/mne-tools/mne-python/blob/maint/0.23/mne/io/curry/curry.py), and I found this function cannot handle the ".cdt.ceo" file. 

So I change the file extension of my file from ".cdt.ceo" to "cdt.cef", and the function works smoothly.

#### Expected results
`mne.io.read_raw_curry()` can read cef file too, or it will make some users confused.

#### Additional information
I am sorry for my weak program skill. I have tried to fix this bug. 



Discussion:
Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴🏽‍♂️

Can you share the original file (Dropbox, Google drive link, etc) so we can test?
> Can you share the original file (Dropbox, Google drive link, etc) so we can test?

Definitely yes. Here is the original file.

https://www.dropbox.com/s/d41yfv7ik0ldzpv/eeg_raw.zip?dl=0

This bug is fixed by @drammock .
FYI, normally we leave issues open until the fixing pull request has been merged, in case during review the solution is found to be incorrect or incomplete.
I am sorry for my brusque being.
> I am sorry for my brusque being.

no problem!  Different software projects handle issues/PRs differently.  Thanks for reporting this bug and helping to fix it.

Resolving patch:
diff --git a/mne/io/curry/curry.py b/mne/io/curry/curry.py
--- a/mne/io/curry/curry.py
+++ b/mne/io/curry/curry.py
@@ -411,8 +411,8 @@ def _read_events_curry(fname):
     events : ndarray, shape (n_events, 3)
         The array of events.
     """
-    check_fname(fname, 'curry event', ('.cef', '.cdt.cef', '.cdt.ceo'),
-                endings_err=('.cef', '.cdt.cef', '.cdt.ceo'))
+    check_fname(fname, 'curry event', ('.cef', '.ceo', '.cdt.cef', '.cdt.ceo'),
+                endings_err=('.cef', '.ceo', '.cdt.cef', '.cdt.ceo'))
 
     events_dict = _read_curry_lines(fname, ["NUMBER_LIST"])
     # The first 3 column seem to contain the event information


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

Issue:
use bibtex in plot_source_power_spectrum_opm.py
convert references in `examples/time_frequency/plot_source_power_spectrum_opm.py` to use footcite / footbibliography



Discussion:
I and @timonmerk can do this one.
Hi, I'm going to work on this
Closed via #9050 

Resolving patch:
diff --git a/mne/datasets/_fetch.py b/mne/datasets/_fetch.py
--- a/mne/datasets/_fetch.py
+++ b/mne/datasets/_fetch.py
@@ -191,7 +191,8 @@ def fetch_dataset(
         # time because we don't save the archive files after unpacking, so
         # pooch can't check its checksum)
         if op.isdir(final_path):
-            _do_path_update(path, update_path, config_key, name)
+            if config_key is not None:
+                _do_path_update(path, update_path, config_key, name)
             return (final_path, data_version) if return_version else final_path
         # ...if download=False (useful for debugging)
         elif not download:


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

Issue:
Annotations.delete requires Numpy 1.19 or above
#### Describe the bug
This block of code in the tutorials produces the wrong result when used with Numpy 1.18

https://github.com/mne-tools/mne-python/blob/4875e04cdebba132fc637ca65b3cb50584aee8b7/tutorials/preprocessing/70_fnirs_processing.py#L41-L46


#### Steps to reproduce
Run the https://github.com/mne-tools/mne-python/blob/main/tutorials/preprocessing/70_fnirs_processing.py tutorial with Numpy 1.18

#### Expected results
What is displayed here https://mne.tools/dev/auto_tutorials/preprocessing/70_fnirs_processing.html#providing-more-meaningful-annotation-information


#### Actual results
Instead of removing the two annotations with trigger code 15.0, one 15.0 is remove and one other condition is removed.


#### Additional information
I think this is due to a change in how np.delete works that occurred in 1.19. See https://numpy.org/doc/stable/release/1.19.0-notes.html#expired-deprecations

#### Question

What should I do?

1. Do we place a minimum version requirement on Numpy? Currently its v1.15 https://github.com/mne-tools/mne-python/blob/4875e04cdebba132fc637ca65b3cb50584aee8b7/requirements.txt#L2
2. Change the internal function of annotations.remove?
3. Other option?



Discussion:
> Do we place a minimum version requirement on Numpy? Currently its v1.15

At some point we settled on supporting the last two years of our dependencies in each release, and we [bump the requirements only at release time (see step 18)](https://github.com/mne-tools/mne-python/wiki/How-to-make-a-release)

> Change the internal function of annotations.remove?

Usually what we try to do is copy-paste a working version (can be from NumPy `main` if you want) in this case of `np.delete` into `mne/fixes.py` (with a comment about what minimum version of NumPy allows us to stop using it) and use that in `annotations.delete`. In the unfortunate case that `np.delete` is in C, then we'll have to write our own little wrapper and hope it's functionally equivalent, but hopefully that won't be the case!
Thanks for the explanation. Ill find time for this
This is actually not a bug in MNE-Python; docstring of annotations.delete says it takes `int` or array-like of `int`, so passing it an array of booleans (as is done in the tutorial) is the problem.  I'll open a PR to fix.

Resolving patch:
diff --git a/tutorials/preprocessing/70_fnirs_processing.py b/tutorials/preprocessing/70_fnirs_processing.py
--- a/tutorials/preprocessing/70_fnirs_processing.py
+++ b/tutorials/preprocessing/70_fnirs_processing.py
@@ -42,8 +42,8 @@
 raw_intensity.annotations.rename({'1.0': 'Control',
                                   '2.0': 'Tapping/Left',
                                   '3.0': 'Tapping/Right'})
-raw_intensity.annotations.delete(
-    raw_intensity.annotations.description == '15.0')
+unwanted = np.nonzero(raw_intensity.annotations.description == '15.0')
+raw_intensity.annotations.delete(unwanted)
 
 
 # %%


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

Issue:
ignore np.MachAr deprecation warning [skip circle]
hopefully this fixes azure CI


Discussion:

Resolving patch:
diff --git a/mne/conftest.py b/mne/conftest.py
--- a/mne/conftest.py
+++ b/mne/conftest.py
@@ -131,6 +131,7 @@ def pytest_configure(config):
     ignore:.*Found the following unknown channel type.*:RuntimeWarning
     ignore:.*in an Any trait will be shared.*:DeprecationWarning
     ignore:.*Mayavi 3D backend is deprecated.*:DeprecationWarning
+    ignore:.*np\.MachAr.*:DeprecationWarning
     always::ResourceWarning
     """  # noqa: E501
     for warning_line in warning_lines.split('\n'):
diff --git a/mne/surface.py b/mne/surface.py
--- a/mne/surface.py
+++ b/mne/surface.py
@@ -67,6 +67,7 @@ def get_head_surf(subject, source=('bem', 'head'), subjects_dir=None,
                              subjects_dir=subjects_dir)
 
 
+# TODO this should be refactored with mne._freesurfer._get_head_surface
 def _get_head_surface(subject, source, subjects_dir, raise_error=True):
     """Load the subject head surface."""
     from .bem import read_bem_surfaces


Test patch:
diff --git a/mne/forward/tests/test_make_forward.py b/mne/forward/tests/test_make_forward.py
--- a/mne/forward/tests/test_make_forward.py
+++ b/mne/forward/tests/test_make_forward.py
@@ -505,6 +505,7 @@ def test_use_coil_def(tmpdir):
         make_forward_solution(info, trans, src, sphere)
 
 
+@pytest.mark.slowtest
 @testing.requires_testing_data
 def test_sensors_inside_bem():
     """Test that sensors inside the BEM are problematic."""
diff --git a/mne/report/tests/test_report.py b/mne/report/tests/test_report.py
--- a/mne/report/tests/test_report.py
+++ b/mne/report/tests/test_report.py
@@ -660,6 +660,7 @@ def test_split_files(tmpdir, split_naming):
     assert len(report._content) == 1
 
 
+@pytest.mark.slowtest  # ~40 sec on Azure Windows
 @testing.requires_testing_data
 def test_survive_pickle(tmpdir):
     """Testing functionality of Report-Object after pickling."""
@@ -678,6 +679,7 @@ def test_survive_pickle(tmpdir):
     report.save(fname=save_name, open_browser=False)
 
 
+@pytest.mark.slowtest  # ~30 sec on Azure Windows
 @requires_sklearn
 @testing.requires_testing_data
 def test_manual_report_2d(tmpdir, invisible_fig):
diff --git a/mne/tests/test_bem.py b/mne/tests/test_bem.py
--- a/mne/tests/test_bem.py
+++ b/mne/tests/test_bem.py
@@ -390,6 +390,7 @@ def test_fit_sphere_to_headshape():
     pytest.raises(TypeError, fit_sphere_to_headshape, 1, units='m')
 
 
+@pytest.mark.slowtest  # ~2 min on Azure Windows
 @testing.requires_testing_data
 def test_io_head_bem(tmpdir):
     """Test reading and writing of defective head surfaces."""
diff --git a/mne/viz/tests/test_3d.py b/mne/viz/tests/test_3d.py
--- a/mne/viz/tests/test_3d.py
+++ b/mne/viz/tests/test_3d.py
@@ -606,6 +606,7 @@ def test_stc_mpl():
                   time_unit='ss', subject='sample', backend='matplotlib')
 
 
+@pytest.mark.slowtest
 @pytest.mark.timeout(60)  # can sometimes take > 60 sec
 @testing.requires_testing_data
 @requires_nibabel()