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

Add mne.preprocessing.unify_bad_channels #12014

Merged
merged 45 commits into from
Sep 28, 2023
Merged
Changes from 2 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a85093c
adding unify channels to preproc
anaradanovic Sep 25, 2023
02ecd49
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 25, 2023
0284caa
Update mne/preprocessing/unify_bads.py
anaradanovic Sep 25, 2023
c3e9794
Update mne/preprocessing/unify_bads.py
anaradanovic Sep 25, 2023
aeb7a42
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 25, 2023
32f8b35
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 25, 2023
c222956
updates to inprogress work unify bads
anaradanovic Sep 25, 2023
0fa5b18
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 25, 2023
2c200a1
Move unify_bad_channels function to preprocessing/bads.py
anaradanovic Sep 26, 2023
80c329d
add function to namespace
anaradanovic Sep 26, 2023
fc91787
style fixes
anaradanovic Sep 26, 2023
d77cfc1
Merge branch 'unifying_bads' of github.com:anaradanovic/mne-python in…
anaradanovic Sep 26, 2023
58b96c3
test draft
nordme Sep 26, 2023
7c28118
make functions work
nordme Sep 26, 2023
d89431e
style fixes
nordme Sep 26, 2023
9b745cb
style fix
nordme Sep 27, 2023
b32f318
fixes
nordme Sep 27, 2023
023db18
adding ch_name check to function
anaradanovic Sep 27, 2023
ce03592
moving len check to first check
anaradanovic Sep 27, 2023
dc8a71a
reconcile with Ana
nordme Sep 27, 2023
d64c00c
Merge remote-tracking branch 'anaradanovic/unifying_bads' into unifych
nordme Sep 27, 2023
7e38dd5
changing ch_name check
anaradanovic Sep 27, 2023
10b2e99
Merge remote-tracking branch 'anaradanovic/unifying_bads' into unifych
nordme Sep 27, 2023
2d4528e
Update mne/preprocessing/bads.py
anaradanovic Sep 27, 2023
a525f33
Update mne/preprocessing/bads.py
anaradanovic Sep 27, 2023
ccba935
Update mne/preprocessing/bads.py
anaradanovic Sep 27, 2023
e005014
Update mne/preprocessing/bads.py
anaradanovic Sep 27, 2023
adfb46b
Update mne/preprocessing/bads.py
anaradanovic Sep 27, 2023
cfa1c74
Update mne/preprocessing/bads.py
anaradanovic Sep 27, 2023
3085fa0
Update mne/preprocessing/bads.py
anaradanovic Sep 27, 2023
12b8e84
Update mne/preprocessing/bads.py
anaradanovic Sep 27, 2023
9cb0cf3
further changes on unify_bad_channels
anaradanovic Sep 27, 2023
52c4d21
Apply suggestions from code review
drammock Sep 27, 2023
83407f6
fixes for Ana fixes
nordme Sep 27, 2023
fe15459
Merge remote-tracking branch 'anaradanovic/unifying_bads' into unifych
nordme Sep 27, 2023
df45b86
move tests file
nordme Sep 27, 2023
8b37d1e
Update mne/channels/channels.py
drammock Sep 27, 2023
2cfc6da
Merge remote-tracking branch 'anaradanovic/unifying_bads' into unifych
nordme Sep 27, 2023
b7834d5
Apply more suggestions from code review
drammock Sep 27, 2023
47db7e6
Merge remote-tracking branch 'anaradanovic/unifying_bads' into unifych
nordme Sep 27, 2023
0309925
Apply suggestions from code review
nordme Sep 27, 2023
6c610d1
pytest fix
nordme Sep 27, 2023
292c3e4
Update mne/channels/channels.py
larsoner Sep 28, 2023
2fa2fdf
Merge pull request #1 from nordme/unifych
anaradanovic Sep 28, 2023
7f80011
tst:ping CIs
anaradanovic Sep 28, 2023
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
26 changes: 26 additions & 0 deletions mne/preprocessing/unify_bads.py
larsoner marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# %%
def unifying_bads(
larsoner marked this conversation as resolved.
Show resolved Hide resolved
list_instances,
larsoner marked this conversation as resolved.
Show resolved Hide resolved
larsoner marked this conversation as resolved.
Show resolved Hide resolved
):
common_bad_channels = []
# first check that each object is mne object

anaradanovic marked this conversation as resolved.
Show resolved Hide resolved
# then interate through the objects to get ch names as set
ch_set_1 = list_instances[0].info["bads"]
common_bad_channels.extend(ch_set_1)

anaradanovic marked this conversation as resolved.
Show resolved Hide resolved
for inst in list_instances[1:]:
ch_set_2 = set(inst.info["bads"])
set_of_bads = set(common_bad_channels)
new_bads = ch_set_2.difference(set_of_bads)

if len(new_bads) > 1:
common_bad_channels.extend(list(new_bads))

new_instances = []

for inst in list_instances:
inst.info["bads"] = common_bad_channels
new_instances.append(inst)

return new_instances
Loading