Frederic-vW / eeg_microstates

EEG microstate analysis
MIT License
36 stars 17 forks source link

read_edf err #1

Closed ZyfGitH closed 4 years ago

ZyfGitH commented 5 years ago

I get the data and it's length is 52 in function read_edf , so it don't reshape (250,30,192), and I am Chinese ,I want to know why so,pease receive it,Thanks

Frederic-vW commented 5 years ago

Hi ZyfGitH, did you try and print intermediate results of the read_edf function, e.g. print(header), print(data.shape) and print(nr, n_per_rec, n_ch, n_total), somewhere around line 106, before re-shaping? If I could access your edf file, I could try and identify the error.

ZyfGitH commented 5 years ago

thank you,I debug the program ,and I can get the header,the data.shape is (52,) before re-shaping,and I also get (nr, n_per_rec, n_ch, n_total) is (192,250,30,1440000) so I believe the result is right before line 97 ,but then the data is not what I want to see.Is the edf file error?

Frederic-vW commented 5 years ago

I wonder that your data.shape is (52,). The test.edf file has size (1440000,) the result of: nr n_per_rec n_ch, for which you seem to get the correct values, as you state above. If you use the test.edf file, and if you put the line: print(data.shape) before the reshape commands, you should get (1440000,) Please check if your edf file uses 16-bit values, as my code does not check. Otherwise, adapt dtype in: data = np.fromfile(fp, sep='', dtype=np.int16, count=n_total)

JAMIL8051 commented 4 years ago

Hello! I have just a small question regarding the k-means function that returns a variable called maps. This variable is a list that has no. of elements = no. of maps. Each element depend on the no. of channels on the raw data. So can I consider the element as an N-dimensional vector that has N dimension = no. of channels in the raw data? For example, in my data, there are 12 channels and no. of clusters = 4. So I get 4 maps each of size rows 12 by column 1. Can I say that it is now a 12-dimensional vector?

Thanks in Advance

Frederic-vW commented 4 years ago

Hi, you are correct, each of your microstates should be a 12-dimensional vector (array). If you want the correct Python language, the variable 'maps' should be a Numpy 'array', not a Python 'list', you can check that with print(type(maps)). In any case, the first dimension indexes the individual microstates, and the second dimension are EEG channels. Does that help? Kind regards, Fred

JAMIL8051 commented 4 years ago

Hi! Many many thanks for the confirmation. I was in so much doubt!

Best regards Jamil