question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IndexError with asr.fit() for a [100s-150s] window and sfreq=500 Hz

See original GitHub issue

Hi,

Thank you for this great library! I am facing a weird problem while trying to use asr.fit(). Following your ASR example, below is the code I want to run:

start_window = 100 
end_window = 150
sfreq = 500
asr = ASR(sfreq=sfreq,method='riemann')
train_idx = np.arange(start_window * sfreq, end_window * sfreq, dtype=int)
_, sample_mask = asr.fit(EEG_filt_data[:, train_idx])

But I get the following error:

  File ".../EEG_preprocessing.py", line 367, in <module>
    _, sample_mask = asr.fit(EEG_filt_data[:, train_idx])

  File ".../anaconda3/envs/mne/lib/python3.8/site-packages/meegkit/asr.py", line 173, in fit
    clean, sample_mask = clean_windows(

  File ".../anaconda3/envs/mne/lib/python3.8/site-packages/meegkit/asr.py", line 393, in clean_windows
    clean = np.delete(X, sample_mask2remove, 1)

  File "<__array_function__ internals>", line 5, in delete

  File ".../anaconda3/envs/mne/lib/python3.8/site-packages/numpy/lib/function_base.py", line 4480, in delete
    keep[obj,] = False

IndexError: arrays used as indices must be of integer (or boolean) type

It seems that the problem occurs only in the following situation (I don’t know why):

  • clean window of50s length;
  • start_window fixed at 100;
  • sfreq fixed at 500.

Indeed when I change one variable while keeping fixed the others (giving for instance 50, 100 and 499) it works fine. Maybe it is due to some kind of multiple relationship?

Versions used: numpy = 1.20.1 mne = 0.22.1

Thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
A-Fermocommented, Jun 3, 2021

Oh that’s right! So the problem occurs only when we have pyriemann already installed (from pypi) beforehand. Thank you again. Best.

0reactions
nbaracommented, Jun 3, 2021

Actually my requirements.txt should already force you to install pyriemann from github, instead of the pipy which conflicts with sklearn:

https://github.com/nbara/python-meegkit/blob/f2fe945acf16b7698b0efa8b8c062afbd65ffb75/requirements.txt#L15

Read more comments on GitHub >

github_iconTop Results From Across the Web

IndexError: list index out of range in model.fit() - Stack Overflow
I am new in using tensorflow. I am trying to train my network with images of shape (16*16). I have divided 3 grayscale...
Read more >
Nicolas Barascud python-meegkit Issues - Giters
TRCA has Low Accuracy for Identifying 8 Targets in 16-23 Frequency Range? ... IndexError with asr.fit() for a [100s-150s] window and sfreq=500 Hz....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found