From 24e7e3e0ebe41aa27f31b0d97c1d761479c19dad Mon Sep 17 00:00:00 2001
From: Eric Larson <larson.eric.d@gmail.com>
Date: Fri, 28 Oct 2022 11:53:49 -0400
Subject: [PATCH] BUG: Work around ppc64le bugs (#11284)
---
azure-pipelines.yml | 2 +-
mne/inverse_sparse/mxne_optim.py | 2 +-
mne/time_frequency/tests/test_tfr.py | 2 ++
mne/time_frequency/tfr.py | 7 ++++++-
requirements.txt | 2 +-
5 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index ee96d030a..08970b3dc 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -116,7 +116,7 @@ stages:
- bash: |
set -e
python -m pip install --progress-bar off --upgrade pip setuptools wheel codecov
- python -m pip install --progress-bar off mne-qt-browser[opengl] pyvista scikit-learn pytest-error-for-skips python-picard "PySide6!=6.3.0,!=6.4.0" qtpy
+ python -m pip install --progress-bar off mne-qt-browser[opengl] pyvista scikit-learn pytest-error-for-skips python-picard "PySide6!=6.3.0,!=6.4.0,!=6.4.0.1" qtpy
python -m pip uninstall -yq mne
python -m pip install --progress-bar off --upgrade -e .[test]
displayName: 'Install dependencies with pip'
diff --git a/mne/inverse_sparse/mxne_optim.py b/mne/inverse_sparse/mxne_optim.py
index 8b7f342b5..587f17444 100644
--- a/mne/inverse_sparse/mxne_optim.py
+++ b/mne/inverse_sparse/mxne_optim.py
@@ -225,7 +225,7 @@ def _mixed_norm_solver_bcd(M, G, alpha, lipschitz_constant, maxit=200,
# equivalent to:
# z = np.linalg.solve(C, np.ones(K))
u, s, _ = np.linalg.svd(C, hermitian=True)
- if s[-1] <= 1e-6 * s[0]:
+ if s[-1] <= 1e-6 * s[0] or not np.isfinite(s).all():
logger.debug("Iteration %d: LinAlg Error" % (i + 1))
continue
z = ((u * 1 / s) @ u.T).sum(0)
diff --git a/mne/time_frequency/tests/test_tfr.py b/mne/time_frequency/tests/test_tfr.py
index 57feb97ca..c626e9058 100644
--- a/mne/time_frequency/tests/test_tfr.py
+++ b/mne/time_frequency/tests/test_tfr.py
@@ -99,6 +99,8 @@ def test_time_frequency():
tfr_morlet(epochs_nopicks,
freqs=freqs, n_cycles=n_cycles, use_fft=True,
return_itc=False, picks=picks, average=False)
+ assert_allclose(
+ epochs_power_picks.data[0, 0, 0, 0], 9.130315e-23, rtol=1e-4)
power_picks_avg = epochs_power_picks.average()
# the actual data arrays here are equivalent, too...
assert_allclose(power.data, power_picks.data)
diff --git a/mne/time_frequency/tfr.py b/mne/time_frequency/tfr.py
index ce1c008ff..912e40f8c 100644
--- a/mne/time_frequency/tfr.py
+++ b/mne/time_frequency/tfr.py
@@ -248,7 +248,12 @@ def _cwt_gen(X, Ws, *, fsize=0, mode="same", decim=1, use_fft=True):
if use_fft:
ret = ifft(fft_x * fft_Ws[ii])[:n_times + W.size - 1]
else:
- ret = np.convolve(x, W, mode=mode)
+ # Work around multarray.correlate->OpenBLAS bug on ppc64le
+ # ret = np.correlate(x, W, mode=mode)
+ ret = (
+ np.convolve(x, W.real, mode=mode) +
+ 1j * np.convolve(x, W.imag, mode=mode)
+ )
# Center and decimate decomposition
if mode == 'valid':
diff --git a/requirements.txt b/requirements.txt
index f666856bc..20da23a48 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -9,7 +9,7 @@ h5io
packaging
pymatreader
qtpy
-PySide6!=6.3.0,!=6.4.0 # incompat with Matplotlib 3.6.1
+PySide6!=6.3.0,!=6.4.0,!=6.4.0.1 # incompat with Matplotlib 3.6.1 and qtpy
pyobjc-framework-Cocoa>=5.2.0; platform_system=="Darwin"
sip
scikit-learn
--
2.37.3