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

write_raw_bids shoudn't write stim channels to electrodes.tsv #1022

Closed
scott-huberty opened this issue Jul 28, 2022 · 2 comments · Fixed by #1023
Closed

write_raw_bids shoudn't write stim channels to electrodes.tsv #1022

scott-huberty opened this issue Jul 28, 2022 · 2 comments · Fixed by #1023
Labels
Milestone

Comments

@scott-huberty
Copy link
Contributor

I suppose I will label this as a bug, as the current behaviour is inconsistent with the BIDS standard, per discussion in #1006

write_raw_bids shouldn't write stim channels to the electrodes.tsv sidecar file, because stim channels don't have associated electrodes.

I can amend the code in _write_electrodes_tsv, and submit a PR. I will suggest something like:

if ch['kind'] == FIFF.FIFFV_STIM_CH:
    continue

at the beginning of this for loop:

mne-bids/mne_bids/dig.py

Lines 140 to 152 in 54d50f6

for ch in raw.info['chs']:
if (
np.isnan(ch['loc'][:3]).any() or
np.allclose(ch['loc'][:3], 0)
):
x.append('n/a')
y.append('n/a')
z.append('n/a')
else:
x.append(ch['loc'][0])
y.append(ch['loc'][1])
z.append(ch['loc'][2])
names.append(ch['ch_name'])

@hoechenberger
Copy link
Member

hoechenberger commented Jul 28, 2022

+1 on fixing this, I like your proposal!

Edit:
I'd add a log message with severity DEBUG too

@scott-huberty
Copy link
Contributor Author

Okay! included a logger.debug message and submitted a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants