rb643 / resting_state_eeg

8 stars 5 forks source link

Importing error #11

Open rb643 opened 6 years ago

rb643 commented 6 years ago

For some reason the first reading step now gives an error when reading in all bdf files...


ImportError Traceback (most recent call last)

in () ----> 1 from data import raws, events, n 2 3 for raw in raws(): 4 print(raw.info['subject_info']) ImportError: cannot import name raws
janfreyberg commented 6 years ago

Sorry that it took me so long to look at this.

Are you still running the notebook in the same folder as the folder data?

(and do you have a different package called data installed by any chance?)

rb643 commented 6 years ago

Yep still the same notebook, only thing is I switched to a newer versions of python now (and Ubuntu). No package called data that I'm aware of

janfreyberg commented 6 years ago

What happens when you just do:

import data
hasattr(data, 'raws')

?

On Mon, Mar 26, 2018 at 5:51 PM, rb643 notifications@github.com wrote:

Yep still the same notebook, only thing is I switched to a newer versions of python now (and Ubuntu). No package called data that I'm aware of

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/rb643/resting_state_eeg/issues/11#issuecomment-376234825, or mute the thread https://github.com/notifications/unsubscribe-auth/AD5yCbWwUzVu4zHJIKAO7zxFtQWlugVwks5tiRyngaJpZM4SaMJ_ .

rb643 commented 6 years ago

File "data/init.py", line 40 warnings.warn(f"Expected 4 events, but got {eventarray.shape[0]}.") ^ SyntaxError: invalid syntax

janfreyberg commented 6 years ago

And you said you switched to newer versions of python? What do you get when you type python --version at the terminal?

f-strings are python 3.6 I think...

rb643 commented 6 years ago

Not behind my desktop until next week, but yes I'm using Python 3.6 since I think

rb643 commented 6 years ago

actually on my desktop I have custom anaconda 2.7.11 apparently :)

rb643 commented 6 years ago

And with "import data" I just get an import error that says there is no module called data..

janfreyberg commented 6 years ago

Hmm. So on 2.7 it shouldn't work I believe - just because it uses "relative imports", which are a new python 3 feature as far as I know.

Frustrating! I'll take another look.

rb643 commented 6 years ago

With python 3.6 I still get the same error though ("no module named data")

rb643 commented 6 years ago

Oh wait, I didn't realise notebooks reverts to the default python kernel

janfreyberg commented 6 years ago

Does it work with the 3.6 kernel?

(I tend to start jupyter notebook after I activate the right environment to make sure it always uses the right kernel)

rb643 commented 6 years ago

Yeah I tried that, but when I print sys.info its still saying its on the 2.7 kernel.. So will probs need to check my version control..

rb643 commented 6 years ago

Well that took longer than expected, but apparently installing mayavi via pip automatically downgrades python back to 2.7 :) Solved that, but got a new one now. In Python 3.6 there seems to be no raws attribute.. Is it possible MNE doesn't support 3.6?

rb643 commented 6 years ago

Ok turns out the event array shape is far from consistent and that seems to be what is causing at least some of the errors... In some cases there are 5 dimensions and in some cases (I think the newer ones) there are a few with 2 dimensions (probably cause we fixed the triggers codes later). So the event array renaming doesn't work (in the init file).. Any smart suggestions on how to make the naming more adaptive?

rb643 commented 6 years ago

Also, it doesn't really seem to be reading the channel triggers correctly anyway as they don't show up in the eventarray...