Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
marsipu committed May 13, 2024
2 parents 538b77f + 5f214fd commit 3c64cc1
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 86 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
Expand All @@ -21,6 +21,6 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m build
python -m build
twine check dist/*
twine upload dist/*
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
# Pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-json
- id: check-toml
Expand All @@ -12,13 +12,13 @@ repos:

# Black
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 24.4.2
hooks:
- id: black

# Ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.4.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
File renamed without changes.
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
## Installation

1. Install MNE-python as instructed on
the [website](https://www.martinos.org/mne/stable/install_mne_python.html),
I would recommend to install in a separate conda environment with:
`conda env create -n mne_p -f environment.yml`
2. `conda activate mne_p`
3. `pip install https://github.com/marsipu/mne-pipeline-hd/zipball/main`
the [website](https://www.martinos.org/mne/stable/install_mne_python.html)
2. Then run `pip install https://github.com/marsipu/mne-pipeline-hd/zipball/main` in the conda-enviroment you created in step 1 for MNE-Python.

## Update

Expand All @@ -21,7 +18,7 @@ or `pip install --upgrade mne-pipeline-hd` for the latest release.

## Start

Run `mne_pipeline_hd` in your mne_pipeline-environment (`conda activate mne_p`)
Run `mne_pipeline_hd` in your conda-environment where you installed mne-python and mne-pipeline-hd.

**or**

Expand Down Expand Up @@ -64,7 +61,7 @@ installed.
9. Push changes to your forked repository on GitHub: `git push`
10. Make "New pull request" from your new feature branch

You can always [write me](mailto:[email protected]), if you have questions
You can always [write me an e-mail](mailto:[email protected]), if you have questions
about the contribution-process
or about the program-structure.

Expand Down
2 changes: 0 additions & 2 deletions mne_pipeline_hd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
Github: https://github.com/marsipu/mne-pipeline-hd
"""

from mne_pipeline_hd._version import __version__ # noqa: F401

# Keep reference to Qt-objects without parent for tests
# and to avoid garbage collection
_object_refs = {
Expand Down
2 changes: 0 additions & 2 deletions mne_pipeline_hd/_version.py

This file was deleted.

4 changes: 1 addition & 3 deletions mne_pipeline_hd/functions/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,7 @@ def find_6ch_binary_events(meeg, min_duration, shortest_event, adjust_timeline_b
and q not in events[:, 0] + 1
and q not in events[:, 0] - 1
):
events = np.append(
events, [[q, 0, int(2**a + 2**b + 2**c)]], axis=0
)
events = np.append(events, [[q, 0, int(2**a + 2**b + 2**c)]], axis=0)

for a, b in combinations(range(6), 2):
equals = np.intersect1d(evs_tol[a], evs_tol[b])
Expand Down
22 changes: 11 additions & 11 deletions mne_pipeline_hd/gui/function_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,9 +915,9 @@ def populate_guitype_cmbx(self):

def target_cmbx_changed(self, idx):
if self.current_function:
self.add_pd_funcs.loc[
self.current_function, "target"
] = self.target_cmbx.itemText(idx)
self.add_pd_funcs.loc[self.current_function, "target"] = (
self.target_cmbx.itemText(idx)
)
self.target_chkl.setPixmap(self.yes_icon.pixmap(QSize(16, 16)))
self.check_func_setup()

Expand All @@ -926,9 +926,9 @@ def tab_cmbx_changed(self, idx):
self.populate_tab_cmbx()
self.tab_cmbx.setCurrentIndex(idx)
if self.current_function:
self.add_pd_funcs.loc[
self.current_function, "tab"
] = self.tab_cmbx.itemText(idx)
self.add_pd_funcs.loc[self.current_function, "tab"] = (
self.tab_cmbx.itemText(idx)
)
self.tab_chkl.setPixmap(self.yes_icon.pixmap(QSize(16, 16)))
self.check_func_setup()

Expand Down Expand Up @@ -1040,7 +1040,7 @@ def get_functions(self):
cf_path_string = compat.getopenfilename(
self,
"Choose the Python-File containing your function to import",
filter="Python-File (*.py)",
filters="Python-File (*.py)",
)[0]
if cf_path_string:
self.file_path = Path(cf_path_string)
Expand All @@ -1057,7 +1057,7 @@ def edit_functions(self):
cf_path_string = compat.getopenfilename(
self,
"Choose the Python-File containing the functions to edit",
filter="Python-File (*.py)",
filters="Python-File (*.py)",
directory=self.ct.custom_pkg_path,
)[0]
if cf_path_string:
Expand Down Expand Up @@ -1339,9 +1339,9 @@ def load_selected_functions(self):
param_key, "functions"
] += func_key
else:
self.cf.add_pd_params.loc[
param_key, "functions"
] = func_key
self.cf.add_pd_params.loc[param_key, "functions"] = (
func_key
)
else:
self.cf.add_pd_params.loc[param_key, "functions"] = func_key
else:
Expand Down
12 changes: 6 additions & 6 deletions mne_pipeline_hd/gui/loading_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1835,13 +1835,13 @@ def get_file_tables(self, kind):
for parameter in result_dict:
if isinstance(result_dict[parameter], tuple):
if result_dict[parameter][2]:
obj_pd.loc[
obj_name, path_type
] = "critical_conflict"
obj_pd.loc[obj_name, path_type] = (
"critical_conflict"
)
else:
obj_pd.loc[
obj_name, path_type
] = "possible_conflict"
obj_pd.loc[obj_name, path_type] = (
"possible_conflict"
)

def open_prog_dlg(self):
# Create Progress-Dialog
Expand Down
11 changes: 4 additions & 7 deletions mne_pipeline_hd/gui/parameter_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,8 +1255,6 @@ def __init__(
# Title text
self.add_text(0, 0.9, "", color="w", font_size=14, name="title")

self.show_view(roll=0, elevation=60, azimuth=70)

self._set_annotations(parcellation)
self._init_picking()

Expand All @@ -1274,9 +1272,7 @@ def _set_annotations(self, parcellation):
labels = fsmri.get_labels(parcellation=parcellation)
if parcellation == "Other":
for label in labels:
self.add_label(
label, borders=True, color="k", alpha=0.75, reset_camera=False
)
self.add_label(label, borders=True, color="k", alpha=0.75)
else:
self.add_annotation(
parcellation, borders=True, color="k", alpha=0.75, remove_existing=True
Expand Down Expand Up @@ -1362,7 +1358,7 @@ def _add_label_name(self, label_name, hemi, label=None):
label = lb
break
if label is not None:
self.add_label(label, borders=False, reset_camera=False)
self.add_label(label, borders=False)
self._shown_labels.append(label_name)

def _remove_label_name(self, label_name, hemi):
Expand Down Expand Up @@ -1504,7 +1500,6 @@ def _subject_changed(self):
self._selected_parc_labels += [
lb for lb in old_selected_parc if lb in all_labels_exept_other
]
self.parc_label_list.content_changed()

# Update pickers if open
if self._parc_picker is not None and not self._parc_picker.isclosed():
Expand All @@ -1528,6 +1523,8 @@ def _parc_changed(self):
lb.name for lb in self._fsmri.labels[self._parcellation]
]

self.parc_label_list.content_changed()

if self._parc_picker is not None and not self._parc_picker.isclosed():
self._parc_picker._set_annotations(self._parcellation)
for label_name in [
Expand Down
12 changes: 6 additions & 6 deletions mne_pipeline_hd/tests/test_parameter_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_label_gui(qtbot, controller):
assert "postcentral-lh" in dlg._parc_picker._shown_labels
# Add label by clicking on plot
qtbot.mouseClick(parc_plot, Qt.LeftButton, pos=parc_plot.rect().center(), delay=100)
assert "superiorfrontal-rh" in dlg._selected_parc_labels
assert "supramarginal-rh" in dlg._selected_parc_labels
# Remove label by clicking on plot
qtbot.mouseClick(parc_plot, Qt.LeftButton, pos=parc_plot.rect().center(), delay=100)
assert "superiorfrontal-rh" not in dlg._selected_parc_labels
Expand All @@ -220,20 +220,20 @@ def test_label_gui(qtbot, controller):
assert "lh.BA1-lh" in dlg._extra_picker._shown_labels

# Change parcellation
dlg.parcellation_cmbx.setCurrentText("aparc.a2009s")
dlg.parcellation_cmbx.setCurrentText("aparc_sub")
dlg._parc_changed() # Only triggered by mouse click with .activated
# Add label by clicking on plot
qtbot.mouseClick(parc_plot, Qt.LeftButton, pos=parc_plot.rect().center(), delay=100)
assert "G_front_sup-rh" in dlg._selected_parc_labels
assert "supramarginal_9-rh" in dlg._selected_parc_labels
# Add label by selecting from list
toggle_checked_list_model(dlg.parc_label_list.model, value=1, row=0)
assert "G_Ins_lg_and_S_cent_ins-lh" in dlg._selected_parc_labels
assert "bankssts_1-lh" in dlg._selected_parc_labels

final_selection = [
"insula-lh",
"postcentral-lh",
"G_front_sup-rh",
"G_Ins_lg_and_S_cent_ins-lh",
"supramarginal_9-rh",
"bankssts_1-lh",
"lh.BA1-lh",
]
# Check display widget
Expand Down
50 changes: 37 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "mne-pipeline-hd"
Expand All @@ -10,26 +10,44 @@ authors = [
description = "A Pipeline-GUI for MNE-Python from MEG-Lab Heidelberg"
readme = "README.md"
requires-python = ">=3.9"
license = { "text" = "BSD-3-Clause" }
license = { file = "LICENSE" }
keywords = ["mne-python", "meg", "eeg", "pipeline", "gui", "heidelberg"]
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
]
dynamic = ["version", "dependencies"]

dependencies = [
# MNE
"mne",
"mne-qt-browser",
"mne-connectivity",
# MNE related
"vtk", # needed for CIs
"nibabel", # needed for CIs
"pyvistaqt", # needed for CIs
"autoreject",
"h5io",
"h5netcdf",
# PyQt
"qtpy",
"pyqtdarktheme",
"pyobjc-framework-Cocoa; sys_platform == 'Darwin'",
# Other
"psutil",
]
dynamic = [ "version" ]
[project.optional-dependencies]
tests = [
"black",
"pre-commit",
"pydata-sphinx-theme",
"pytest",
"pytest-qt",
"pre-commit",
"black",
"ruff",
"sphinx"
"sphinx",
"pydata-sphinx-theme",
]

[project.urls]
Expand All @@ -39,9 +57,15 @@ Repository = "https://github.com/marsipu/mne-pipeline-hd.git"
[project.scripts]
mne_pipeline_hd = "mne_pipeline_hd.__main__:main"

[tool.setuptools.dynamic]
version = { attr = "mne_pipeline_hd.__version__" }
dependencies = { file = "requirements.txt" }
[tool.hatch.build]
exclude = [
"/.*",
"/*.yml",
]

[tool.hatch.version]
source = "vcs"
raw-options = { version_scheme = "release-branch-semver" }

[tool.black]
line-lenght = 88
Expand Down
20 changes: 0 additions & 20 deletions requirements.txt

This file was deleted.

0 comments on commit 3c64cc1

Please sign in to comment.