Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

TypeError: 'numpy.float64' object cannot be interpreted as an index #16

Open
siddharthdeshmukh opened this issue Oct 7, 2017 · 6 comments

Comments

@siddharthdeshmukh
Copy link

When running ex_csp_motor_imagery.py, getting error at line 36

trials, _ = eegtools.featex.windows(d.events[1], offsets, d.X)
W = np.zeros((ii.size, p, end - begin)) * np.nan

Numpy installed version is numpy-1.13.1+mkl

Tried with physionet data using edfplus, getting same error.

Error log:
trials, st = eegtools.featex.windows(start, offset, filt_data)
File "C:\Python27\lib\site-packages\eegtools\featex.py", line 65, in windows
W = np.zeros((ii.size, p, end - begin)) * np.nan
TypeError: 'numpy.float64' object cannot be interpreted as an index

@Irving-ren
Copy link

@siddnus Hi, I just occurred the same problem with numpy 1.15.0 on Ubuntu python 2.7 . Have you solved the issue yet?
Best
Ivring

@siddharthdeshmukh
Copy link
Author

@terminator9487 Hi.. I don't remember the exact solution now, but I think converting offset to int before passing it solved my issue.

x, y = offset
x = int(x)
y = int(y).

Can you try this?

@Irving-ren
Copy link

Thanks for your reply. However, I didn't really get it. where should I add the converting offset? the error was occurred in this file,right?
screenshot from 2018-08-29 14-37-26
I guess the detailed code is like this.
screenshot from 2018-08-29 14-37-11

what's the realistic meaning of x and y you mentioned before? the EEG event and labels?

@Irving-ren
Copy link

Thanks for your answer. And,the problem was solved!

@siddharthdeshmukh
Copy link
Author

Hi @terminator9487 , Sorry for the late reply, what was the solution in your case?

@Irving-ren
Copy link

Just adding the code you mentioned before.

offsetsX,offsetY = offsets
offsetsX = int(offsetsX)
offsetY = int(offsetY)
offsets = offsetsX,offsetY

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants