Skip to content

Commit 12adc62

Browse files
committed
[Fix] fix bad channels errors
1 parent 6ffb8bb commit 12adc62

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

spm/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "25.01.beta1.post3"
1+
__version__ = "25.01.beta1.post4"

spm/utils/spm_mne_converter.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,12 @@ def spm_2_mne_raw(D):
177177
)
178178
)
179179
# np.savetxt(D.path()+'/tra_matrix_from_spm.tsv', D.sensors('MEG').tra, delimiter='\t')
180-
bad_channels = D.badchannels()[0].astype(int) # matlab index = (python index + 1)
181-
if D.badchannels().size == 1:
182-
info["bads"] = [channel_names[bad_channels]]
183-
elif D.badchannels().size != 0:
184-
info["bads"] = [channel_names[i] for i in bad_channels]
180+
bad_channels = D.badchannels()
181+
if len(bad_channels) > 0:
182+
info["bads"] = [
183+
channel_names[i - 1] # python index = matlab index - 1
184+
for i in bad_channels
185+
]
185186
raw = mne.io.RawArray(data, info)
186187
return raw
187188

0 commit comments

Comments
 (0)