Skip to content

Commit

Permalink
Merge branch 'main' into miniforge
Browse files Browse the repository at this point in the history
  • Loading branch information
drammock authored Oct 30, 2024
2 parents 65913d7 + 60346f6 commit 70e96db
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ jobs:
pytest:
name: '${{ matrix.os }} / ${{ matrix.kind }} / ${{ matrix.python }}'
needs: style
timeout-minutes: 70
continue-on-error: true
timeout-minutes: 80
runs-on: ${{ matrix.os }}
defaults:
run:
Expand All @@ -54,6 +53,7 @@ jobs:
MNE_CI_KIND: '${{ matrix.kind }}'
CI_OS_NAME: '${{ matrix.os }}'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
Expand Down Expand Up @@ -132,4 +132,4 @@ jobs:
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
if: always()
if: success() || failure()
1 change: 1 addition & 0 deletions doc/changes/devel/12924.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix typos in the Spatio-Spectral Decomposition example, by :newcontrib:`Simon M. Hofmann`.
1 change: 1 addition & 0 deletions doc/changes/names.inc
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@
.. _Simeon Wong: https://github.com/dtxe
.. _Simon Kern: https://skjerns.de
.. _Simon Kornblith: https://simonster.com
.. _Simon M. Hofmann: https://github.com/SHEscher
.. _Sondre Foslien: https://github.com/sondrfos
.. _Sophie Herbst: https://github.com/SophieHerbst
.. _Stanislas Chambon: https://github.com/Slasnista
Expand Down
2 changes: 2 additions & 0 deletions doc/sphinxext/mne_doc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def reset_warnings(gallery_conf, fname):
r"numpy\.core is deprecated and has been renamed to numpy\._core",
# matplotlib
"__array_wrap__ must accept context and return_scalar.*",
# selenium
"setting remote_server_addr",
):
warnings.filterwarnings( # deal with other modules having bad imports
"ignore", message=f".*{key}.*", category=DeprecationWarning
Expand Down
18 changes: 9 additions & 9 deletions examples/decoding/ssd_spatial_filters.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
.. _ex-ssd-spatial-filters:
===========================================================
Compute Spectro-Spatial Decomposition (SSD) spatial filters
===========================================================
================================================================
Compute spatial filters with Spatio-Spectral Decomposition (SSD)
================================================================
In this example, we will compute spatial filters for retaining
oscillatory brain activity and down-weighting 1/f background signals
Expand Down Expand Up @@ -33,7 +33,7 @@

# Prepare data
raw = mne.io.read_raw_ctf(fname)
raw.crop(50.0, 110.0).load_data() # crop for memory purposes
raw.crop(tmin=50.0, tmax=110.0).load_data() # crop for memory purposes
raw.resample(sfreq=250)

raw.pick_types(meg=True, ref_meg=False)
Expand Down Expand Up @@ -63,9 +63,9 @@


# %%
# Let's investigate spatial filter with max power ratio.
# Let's investigate spatial filter with the max power ratio.
# We will first inspect the topographies.
# According to Nikulin et al. 2011 this is done by either inverting the filters
# According to Nikulin et al. (2011), this is done by either inverting the filters
# (W^{-1}) or by multiplying the noise cov with the filters Eq. (22) (C_n W)^t.
# We rely on the inversion approach here.

Expand All @@ -86,7 +86,7 @@
# Note that this is not necessary if sort_by_spectral_ratio=True (default).
spec_ratio, sorter = ssd.get_spectral_ratio(ssd_sources)

# Plot spectral ratio (see Eq. 24 in Nikulin 2011).
# Plot spectral ratio (see Eq. 24 in Nikulin et al., 2011).
fig, ax = plt.subplots(1)
ax.plot(spec_ratio, color="black")
ax.plot(spec_ratio[sorter], color="orange", label="sorted eigenvalues")
Expand All @@ -100,7 +100,7 @@
# the sorting might make a difference.

# %%
# Let's also look at the power spectrum of that source and compare it to
# Let's also look at the power spectrum of that source and compare it
# to the power spectrum of the source with lowest SNR.

below50 = freqs < 50
Expand All @@ -121,7 +121,7 @@
# %%
# Epoched data
# ------------
# Although we suggest to use this method before epoching, there might be some
# Although we suggest using this method before epoching, there might be some
# situations in which data can only be treated by chunks.

# Build epochs as sliding windows over the continuous raw file.
Expand Down
1 change: 1 addition & 0 deletions mne/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def pytest_configure(config):
ignore:Passing a schema to Validator\.iter_errors is deprecated.*:
ignore:Unclosed context <zmq.asyncio.Context.*:ResourceWarning
ignore:Jupyter is migrating its paths.*:DeprecationWarning
ignore:datetime\.datetime\.utcnow\(\) is deprecated.*:DeprecationWarning
ignore:Widget\..* is deprecated\.:DeprecationWarning
ignore:.*is deprecated in pyzmq.*:DeprecationWarning
ignore:The `ipykernel.comm.Comm` class has been deprecated.*:DeprecationWarning
Expand Down
2 changes: 1 addition & 1 deletion mne/decoding/receptive_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def _check_dimensions(self, X, y, predict=False):
f"X and y do not have the same n_epochs\n{X.shape[1]} != "
f"{y.shape[1]}"
)
if predict and y.shape[-1] != len(self.estimator_.coef_):
if predict and y.shape[-1] not in (len(self.estimator_.coef_), 1):
raise ValueError(
"Number of outputs does not match estimator coefficients dimensions"
)
Expand Down
1 change: 1 addition & 0 deletions mne/decoding/tests/test_receptive_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def test_receptive_field_basic(n_jobs):
feature_names = [f"feature_{ii}" for ii in [0, 1, 2]]
rf = ReceptiveField(tmin, tmax, 1, feature_names, estimator=mod, patterns=True)
rf.fit(X, y)
assert rf.coef_.shape == (3, 11)
assert_array_equal(rf.delays_, np.arange(tmin, tmax + 1))

y_pred = rf.predict(X)
Expand Down
5 changes: 3 additions & 2 deletions mne/stats/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,10 @@ def solver(X, y):
coefs = solver(X, data.T)
if coefs.shape[0] != data.shape[0]:
raise ValueError(
"solver output has unexcepted shape. Supply a "
f"solver output has unexcepted shape {coefs.shape}. Supply a "
"function that returns coefficients in the form "
"(n_targets, n_features), where targets == channels."
"(n_targets, n_features), where "
f"n_targets == n_channels == {data.shape[0]}."
)

# construct Evoked objects to be returned from output
Expand Down
4 changes: 3 additions & 1 deletion mne/stats/tests/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ def test_continuous_regression_with_overlap():
from sklearn.linear_model import ridge_regression

def solver(X, y):
return ridge_regression(X, y, alpha=0.0, solver="cholesky")
# Newer scikit-learn returns 1D array for ridge_regression, so ensure
# 2D output
return np.atleast_2d(ridge_regression(X, y, alpha=0.0, solver="cholesky"))

assert_allclose(
effect,
Expand Down

0 comments on commit 70e96db

Please sign in to comment.