Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0b1ecb8
MAINT: Modernize path handling in misc.py using pathlib
Akhila21-6 Mar 22, 2026
820f7ad
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 22, 2026
1322a09
Merge branch 'main' into main
Akhila21-6 Mar 22, 2026
416be7c
MAINT: Add changelog entry for #13775
Akhila21-6 Mar 22, 2026
7f5b6c4
Merge branch 'main' of https://github.com/Akhila21-6/mne-python
Akhila21-6 Mar 22, 2026
1d50715
Update mne/misc.py
Akhila21-6 Mar 22, 2026
0cdfea7
Update mne/misc.py
Akhila21-6 Mar 22, 2026
88d3ee9
Update mne/misc.py
Akhila21-6 Mar 22, 2026
71bb006
Update mne/misc.py
Akhila21-6 Mar 22, 2026
fb3fc60
Update mne/misc.py
Akhila21-6 Mar 22, 2026
b0d4b42
MAINT: Add changelog entry
Akhila21-6 Mar 25, 2026
ba1b693
Merge branch 'main' of https://github.com/Akhila21-6/mne-python
Akhila21-6 Mar 25, 2026
c6e3afa
Merge branch 'main' into main
Akhila21-6 Mar 25, 2026
c6e3cc4
MAINT: move changelog to dev/ and add contributor name
Akhila21-6 Mar 26, 2026
70f9fac
Merge branch 'main' of https://github.com/Akhila21-6/mne-python
Akhila21-6 Mar 26, 2026
cd25ecf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 26, 2026
197de22
MAINT: fix names.inc syntax and verify dev path
Akhila21-6 Mar 26, 2026
58535a7
Merge branch 'main' into main
Akhila21-6 Mar 26, 2026
9a386c5
MAINT: fix docs syntax and resolve rebase
Akhila21-6 Mar 26, 2026
3c982e9
MAINT: Restore names.inc and fix contribution syntax
Akhila21-6 Mar 27, 2026
9a79553
MAINT: restore names.inc and use newcontrib syntax
Akhila21-6 Mar 27, 2026
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
1 change: 1 addition & 0 deletions doc/changes/dev/13775.maintenance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Modernized path handling in :func:mne.viz.parse_config and :func:mne.viz.read_reject_parameters to use pathlib, by Akhila Thammenenwar.
1 change: 1 addition & 0 deletions doc/changes/devel/13775.maintenance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Modernize path handling in ``mne/misc.py`` using ``pathlib``, by `Akhila Thammenenwar`_.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You added two changelog entries. The syntax in this file is correct but it should go in doc/changes/dev/.

Also please add your name and public profile to doc/changes/names.inc

14 changes: 10 additions & 4 deletions mne/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# License: BSD-3-Clause
# Copyright the MNE-Python contributors.

from pathlib import Path


def parse_config(fname):
"""Parse a config file (like .ave and .cov files).
Expand All @@ -20,10 +22,11 @@ def parse_config(fname):
tmin, tmax, name, grad_reject, mag_reject,
eeg_reject, eog_reject
"""
fname = Path(fname)

reject_params = read_reject_parameters(fname)

with open(fname) as f:
lines = f.readlines()
lines = fname.read_text().splitlines()

cat_ind = [i for i, x in enumerate(lines) if "category {" in x]
event_dict = dict()
Expand Down Expand Up @@ -67,14 +70,17 @@ def read_reject_parameters(fname):
params : dict
The rejection parameters.
"""
with open(fname) as f:
lines = f.readlines()
fname = Path(fname)
lines = fname.read_text().splitlines()

reject_names = ["gradReject", "magReject", "eegReject", "eogReject", "ecgReject"]
reject_pynames = ["grad", "mag", "eeg", "eog", "ecg"]
reject = dict()
for line in lines:
words = line.split()
# Defensive check for empty lines
if not words:
continue
if words[0] in reject_names:
reject[reject_pynames[reject_names.index(words[0])]] = float(words[1])

Expand Down