Skip to content

Commit

Permalink
[MAINT] Fix failing unit tests & update CI packages (mne-tools#157)
Browse files Browse the repository at this point in the history
* [MAINT] Specify data copy behaviour

* [MAINT] Updated required MNE version

* Revert "[MAINT] Updated required MNE version"

This reverts commit bfb175e.

* [MAINT] Specify data copy behaviour for MNE>1.5

* [MAINT] Add missing PyQt6

* Revert "[MAINT] Add missing PyQt6"

This reverts commit 5836037.

* [MAINT] Add missing PyQt6 to CircleCI

* [MAINT] Add missing pyvistaqt to CircleCI

* [MAINT] Switch unit tests Python 3.8 to 3.9

* [MAINT] Add missing sphinx extension to CircleCI

* [MAINT] Add missing sphinx extension to CircleCI

* [MAINT] Add missing sphinx extensions to CircleCI

* [MAINT] Add missing sphinx extensions to CircleCI

* [MAINT] Add missing doc requirements to CircleCI
  • Loading branch information
tsbinns authored Nov 25, 2023
1 parent 8bebc62 commit 1b64fc1
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 8 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
curl https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/circleci_dependencies.sh -o circleci_dependencies.sh
chmod +x circleci_dependencies.sh
./circleci_dependencies.sh
pip install -r requirements_doc.txt
- save_cache:
key: pip-cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
include:
# An old one
- os: ubuntu-latest
python-version: "3.8"
python-version: "3.9"
steps:
- uses: actions/checkout@v4
- uses: pyvista/setup-headless-display-action@main
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
matrix:
include:
- os: ubuntu-latest
python-version: "3.8"
python-version: "3.9"
mne-version: mne-main
- os: ubuntu-latest
python-version: "3.11"
Expand Down
8 changes: 7 additions & 1 deletion mne_connectivity/envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#
# License: BSD (3-clause)

import inspect

import numpy as np
from mne import BaseEpochs
from mne.filter import next_fast_len
Expand Down Expand Up @@ -100,7 +102,11 @@ def envelope_correlation(data, names=None,
data.add_annotations_to_metadata(overwrite=True)
metadata = data.metadata
# get the actual data in numpy
data = data.get_data()
# XXX: remove logic once support for mne<1.6 is dropped
kwargs = dict()
if "copy" in inspect.getfullargspec(data.get_data).kwonlyargs:
kwargs["copy"] = False
data = data.get_data(**kwargs)
else:
metadata = None

Expand Down
6 changes: 5 additions & 1 deletion mne_connectivity/spectral/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,11 @@ def _check_rank_input(rank, data, indices):
rank = np.zeros((2, len(indices[0])), dtype=int)

if isinstance(data, BaseEpochs):
data_arr = data.get_data()
# XXX: remove logic once support for mne<1.6 is dropped
kwargs = dict()
if "copy" in inspect.getfullargspec(data.get_data).kwonlyargs:
kwargs["copy"] = False
data_arr = data.get_data(**kwargs)
else:
data_arr = data

Expand Down
10 changes: 8 additions & 2 deletions mne_connectivity/spectral/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#
# License: BSD (3-clause)

import inspect

import numpy as np
import xarray as xr
from mne.epochs import BaseEpochs
Expand Down Expand Up @@ -325,7 +327,6 @@ def spectral_connectivity_time(data, freqs, method='coh', average=False,
sfreq = data.info['sfreq']
events = data.events
event_id = data.event_id
n_epochs, n_signals, n_times = data.get_data().shape
# Extract metadata from the Epochs data structure.
# Make Annotations persist through by adding them to the metadata.
metadata = data.metadata
Expand All @@ -338,7 +339,12 @@ def spectral_connectivity_time(data, freqs, method='coh', average=False,
if hasattr(data, 'annotations') and not annots_in_metadata:
data.add_annotations_to_metadata(overwrite=True)
metadata = data.metadata
data = data.get_data()
# XXX: remove logic once support for mne<1.6 is dropped
kwargs = dict()
if "copy" in inspect.getfullargspec(data.get_data).kwonlyargs:
kwargs["copy"] = False
data = data.get_data(**kwargs)
n_epochs, n_signals, n_times = data.shape
else:
data = np.asarray(data)
n_epochs, n_signals, n_times = data.shape
Expand Down
9 changes: 8 additions & 1 deletion mne_connectivity/vector_ar/var.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import inspect

import numpy as np
import scipy
from scipy.linalg import sqrtm
Expand Down Expand Up @@ -144,7 +146,12 @@ def vector_auto_regression(
metadata = data.metadata

# get the actual data in numpy
data = data.get_data()
# get the actual data in numpy
# XXX: remove logic once support for mne<1.6 is dropped
kwargs = dict()
if "copy" in inspect.getfullargspec(data.get_data).kwonlyargs:
kwargs["copy"] = False
data = data.get_data(**kwargs)
else:
metadata = None

Expand Down
4 changes: 3 additions & 1 deletion requirements_doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ sphinx-autodoc-typehints
sphinxcontrib-bibtex
git+https://github.com/mne-tools/mne-bids@main
pooch
mne-qt-browser
mne-qt-browser
PyQt6
pyvistaqt

0 comments on commit 1b64fc1

Please sign in to comment.