Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: try fix cis #29

Merged
merged 13 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ jobs:
- run:
name: Get Python running
command: |
pip install --upgrade PyQt6!=6.6.1 "PyQt6-Qt6!=6.6.1" sphinx-gallery pydata-sphinx-theme numpydoc scikit-learn nilearn mne-bids autoreject git+https://github.com/pyvista/pyvista@main memory_profiler sphinxcontrib.bibtex sphinxcontrib.youtube darkdetect qdarkstyle
# TO DO: sphinx-gallery main -> stable on 0.17 release
pip install --upgrade PyQt6!=6.6.0 "PyQt6-Qt6!=6.6.0,!=6.7.0" git+https://github.com/sphinx-gallery/sphinx-gallery.git pydata-sphinx-theme numpydoc scikit-learn nilearn mne-bids autoreject pyvista memory_profiler sphinxcontrib.bibtex sphinxcontrib.youtube darkdetect qdarkstyle
Comment on lines +45 to +46
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SG 0.16 is out now which should work for you already. So you can either revert this entirely or just remove the comment (as it should also be safe to use the SG master development branch)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah my bad! I'll take it out in the #27

pip install -ve ./mne-python .
- run:
name: Check Qt
Expand All @@ -58,13 +59,19 @@ jobs:
- run:
name: List packages
command: python -m pip list
- restore_cache:
keys:
- data-cache-sample
- restore_cache:
keys:
- data-cache-misc
- restore_cache:
keys:
- data-cache-somato
- run:
name: Get data
command: |
python -c "import mne; mne.datasets.somato.data_path(update_path=True, verbose=True); mne.datasets.misc.data_path(update_path=True, verbose=True);"
python -c "import mne; mne.datasets.somato.data_path(update_path=True, verbose=True); mne.datasets.misc.data_path(update_path=True, verbose=True); sample_path = mne.datasets.sample.data_path(update_path=True, verbose=True); mne.datasets.fetch_fsaverage(subjects_dir=sample_path / 'subjects', verbose=True)"
ls -al ~/mne_data;
- run:
name: make html
Expand All @@ -83,6 +90,10 @@ jobs:
root: doc/_build
paths:
- html
- save_cache:
key: data-cache-sample
paths:
- ~/mne_data/MNE-sample-data
- save_cache:
key: data-cache-somato
paths:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ jobs:
if: "matrix.mne-version == 'mne-main'"
run: git clone --single-branch --branch main https://github.com/mne-tools/mne-python.git
- run: pip install -ve ./mne-python
- run: pip install -v ${{ matrix.qt }}!=6.6.1 "PyQt6-Qt6!=6.6.1"
- run: pip install -v ${{ matrix.qt }}!=6.6.0 "PyQt6-Qt6!=6.6.0,!=6.7.0"
- run: pip install -ve .[tests]
- run: mne sys_info
- run: |
set -eo pipefail
mne sys_info -pd | grep "qtpy:\? .*${{ matrix.qt }}=.*$"
# Check Qt
- run: ./tools/check_qt_import.sh $MNE_QT_BACKEND
if: ${{ env.MNE_QT_BACKEND != '' }}
name: Check Qt
shell: bash
- run: python -c "import mne_gui_addons; print(mne_gui_addons.__version__)"
Expand Down
18 changes: 11 additions & 7 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import faulthandler
import os
import sys
from pathlib import Path

import pyvista
import mne_gui_addons
Expand All @@ -11,6 +12,14 @@
os.environ["MNE_BROWSER_THEME"] = "light"
os.environ["MNE_3D_OPTION_THEME"] = "light"

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
curpath = Path(__file__).parent.resolve(strict=True)
sys.path.append(str(curpath / "sphinxext"))

project = "MNE-GUI-Addons"
release = mne_gui_addons.__version__
version = ".".join(release.split(".")[:2])
Expand All @@ -35,10 +44,7 @@
"scipy": ("https://docs.scipy.org/doc/scipy", None),
"matplotlib": ("https://matplotlib.org/stable", None),
"nibabel": ("https://nipy.org/nibabel", None),
"dipy": (
"https://dipy.org/documentation/latest/",
"https://dipy.org/documentation/latest/objects.inv/",
),
"dipy": ("https://docs.dipy.org/stable", None),
"mne": ("https://mne.tools/stable", None),
"mne_bids": ("https://mne.tools/mne-bids/stable", None),
}
Expand All @@ -53,8 +59,6 @@
"AverageTFR": "mne.time_frequency.AverageTFR",
"EpochsTFR": "mne.time_frequency.EpochsTFR",
"Transform": "mne.transforms.Transform",
# MNE-GUI-Addons
# 'IntracranialElectrodeLocator': 'mne_gui_addons.IntracranialElectrodeLocator', # Many doc errors!
}
numpydoc_xref_ignore = {
# words
Expand Down Expand Up @@ -108,7 +112,7 @@
"remove_config_comments": True,
"min_reported_time": 1.0,
"abort_on_example_error": False,
"image_scrapers": ("matplotlib", mne_gui_addons._GUIScraper(), "pyvista"),
"image_scrapers": ("matplotlib", "mne_gui_addons_doc_utils.gui_scraper", "pyvista"),
"show_memory": not sys.platform.startswith(("win", "darwin")),
"line_numbers": False, # messes with style
"capture_repr": ("_repr_html_",),
Expand Down
5 changes: 5 additions & 0 deletions doc/sphinxext/mne_gui_addons_doc_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Doc building utils."""

import mne_gui_addons

gui_scraper = mne_gui_addons._GUIScraper()
12 changes: 8 additions & 4 deletions mne_gui_addons/_ieeg_locate.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def __init__(
)

self._ch_names = info.ch_names
# load channels, leave in "head" coordinate frame until transforms are loaded in super
# load channels, leave in "head" coordinate frame
# until transforms are loaded in super
self._chs = {
name: ch["loc"][:3] for name, ch in zip(info.ch_names, info["chs"])
}
Expand Down Expand Up @@ -133,7 +134,8 @@ def __init__(
self._update_lines(group)

# ready for user
# set current position as (0, 0, 0) surface RAS (center of mass roughly) if no positions
# set current position as (0, 0, 0) surface RAS
# (center of mass roughly) if no positions
if np.isnan(self._chs[self._ch_names[self._ch_index]]).any():
self._set_ras(
apply_trans(
Expand Down Expand Up @@ -572,7 +574,8 @@ def _auto_find_line(self, tv, r, max_search_radius=50, voxel_tol=2):
if np.min(
[np.linalg.norm(next_loc - loc) for loc in locs]
) > np.sqrt(3):
# update the direction to account for bent electrodes and grids contoured to the brain
# update the direction to account for bent electrodes
# and grids contoured to the brain
rr_tmp = next_loc - np.array(
locs[-1] if direction == 1 else locs[0]
)
Expand Down Expand Up @@ -714,7 +717,8 @@ def auto_find_contacts(
)
v /= np.linalg.norm(v)
for i, tv in enumerate(local_maxima): # try neartest sequentially
# only try entry if given, otherwise try other local maxima as direction vectors
# only try entry if given,
# otherwise try other local maxima as direction vectors
for tv2 in local_maxima[i + 1 :] if entry is None else [tv + v]:
# find specified direction vector/direction vector to next contact
r = (tv2 - tv) / np.linalg.norm(tv2 - tv)
Expand Down
3 changes: 1 addition & 2 deletions mne_gui_addons/tests/test_ieeg_locate.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ def test_ieeg_elec_locate_io(renderer_interactive_pyvistaqt):
with pytest.warns(RuntimeWarning, match="nasion not found"):
info.set_montage(montage)
with pytest.raises(RuntimeError, match='must be in the "head" coordinate frame'):
with pytest.warns(RuntimeWarning, match="`pial` surface not found"):
mne_gui.locate_ieeg(info, trans, aligned_ct, subject, subjects_dir)
mne_gui.locate_ieeg(info, trans, aligned_ct, subject, subjects_dir)


@pytest.mark.allow_unclosed_pyside2
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ classifiers = [
dependencies = [
"packaging",
"qtpy",
"PyQt6!=6.6.0",
"PyQt6-Qt6!=6.6.0,!=6.7.0",
"pyvista",
"pyvistaqt",
"mne",
Expand Down
Loading