akaraspt / deepsleepnet

DeepSleepNet: a Model for Automatic Sleep Stage Scoring based on Raw Single-Channel EEG
Apache License 2.0
398 stars 153 forks source link

raw.to_data_frame() error #13

Closed WenJ2018 closed 6 years ago

WenJ2018 commented 6 years ago

Hello, I got the following error on PC in Windows 10.

python prepare_physionet.py --data_dir data --output_dir data/eeg_fpz_cz --select_ch "EEG Fpz-Cz" Extracting EDF parameters from data\SC4001E0-PSG.edf... EDF file detected Setting channel info structure... Creating raw.info structure... Reading 0 ... 7949999 = 0.000 ... 79499.990 secs... Traceback (most recent call last): File "prepare_physionet.py", line 218, in main() File "prepare_physionet.py", line 95, in main raw_ch_df = raw.to_data_frame(scale_time=100.0)[select_ch] TypeError: to_data_frame() got an unexpected keyword argument 'scale_time'

akaraspt commented 6 years ago

I think there have been some updates to the pandas and/or numpy packages, which affects the code that I used several months ago.

Can you install the following version:

numpy (1.11.1) pandas (0.18.1)

and have a try again?

Thanks

WenJ2018 commented 6 years ago

Thanks for replying. I used pip install pandas which I suppose would install the latest version. How can I specify the version numbers?

WenJ2018 commented 6 years ago

I used pip install numpy==1.11.1 which seemed to have worked. For numpy (1.11.1), it complained a lot but seems still ok. For pandas(0.18.1), it failed to install. If I use numpy (1.11.1) and pandas (0.23.0), I got the same error message about raw.to_data_frame().

akaraspt commented 6 years ago

You get the same error because you still use the new pandas version.

I am not sure why you got the error while installing the pandas version 0.18.1, but that's the installation problem (not the code).

Please refer to the following website: https://stackoverflow.com/questions/5226311/installing-specific-package-versions-with-pip

Hope this is helpful

WenJ2018 commented 6 years ago

Hello, Thanks for the link. I was able to install pandas-0.18.1 now, after installing visual studio 2015 build tools. But I still get the same error message about raw.to_data_frame(). So I checked numpy again. It seems that numpy 1.11.1 is too old for my tensorflow. Do you know which tensorflow version is needed?

WenJ2018 commented 6 years ago

Just to add that if I changed raw_ch_df = raw.to_data_frame(scale_time=100.0)[select_ch]

intoraw_ch_df = raw.to_data_frame()[select_ch] It would pass that line but shows the following:python prepare_physionet.py --data_dir data --output_dir data/eeg_fpz_cz --select_ch "EEG Fpz-Cz" Extracting EDF parameters from data\SC4001E0-PSG.edf... EDF file detected Setting channel info structure... Creating raw.info structure... Reading 0 ... 7949999  =      0.000 ... 79499.990 secs... Converting time column to int64... Traceback (most recent call last):   File "prepare_physionet.py", line 218, in     main()   File "prepare_physionet.py", line 103, in main     reader_raw.read_header()   File "C:\Users\Wen\CNNs\deepsleepnet-master\dhedfreader.py", line 90, in read_header     self.header = h = edf_header(self.file)   File "C:\Users\Wen\CNNs\deepsleepnet-master\dhedfreader.py", line 46, in edf_header     assert f.read(8) == '0       '   File "C:\Users\Wen\AppData\Local\conda\conda\envs\tensorflow\lib\encodings\cp1252.py", line 23, in decode     return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 2110: character maps to  I need to specify scale_time=100.0 somewhere else, correct? Where can I do that?

WenJ2018 commented 6 years ago

I decided not to change versions but instead to modify code so that the updated pandas and numpy would work.  A lot to modify but  I managed to run through the following without errors. They created eeg_fpz_cz and eeg_pz_oz subfolders under data folder. Should I see any files inside these subfolders? Thanks. python prepare_physionet.py --data_dir data --output_dir data/eeg_fpz_cz --select_ch 'EEG Fpz-Cz' python prepare_physionet.py --data_dir data --output_dir data/eeg_pz_oz --select_ch 'EEG Pz-Oz'

  From: Wen <wj_lg@yahoo.com>

To: akaraspt/deepsleepnet reply@reply.github.com Sent: Tuesday, May 29, 2018 1:02 PM Subject: Re: [akaraspt/deepsleepnet] raw.to_data_frame() error (#13)

Just to add that if I changed raw_ch_df = raw.to_data_frame(scale_time=100.0)[select_ch]

intoraw_ch_df = raw.to_data_frame()[select_ch] It would pass that line but shows the following:python prepare_physionet.py --data_dir data --output_dir data/eeg_fpz_cz --select_ch "EEG Fpz-Cz" Extracting EDF parameters from data\SC4001E0-PSG.edf... EDF file detected Setting channel info structure... Creating raw.info structure... Reading 0 ... 7949999  =      0.000 ... 79499.990 secs... Converting time column to int64... Traceback (most recent call last):   File "prepare_physionet.py", line 218, in     main()   File "prepare_physionet.py", line 103, in main     reader_raw.read_header()   File "C:\Users\Wen\CNNs\deepsleepnet-master\dhedfreader.py", line 90, in read_header     self.header = h = edf_header(self.file)   File "C:\Users\Wen\CNNs\deepsleepnet-master\dhedfreader.py", line 46, in edf_header     assert f.read(8) == '0       '   File "C:\Users\Wen\AppData\Local\conda\conda\envs\tensorflow\lib\encodings\cp1252.py", line 23, in decode     return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 2110: character maps to  I need to specify scale_time=100.0 somewhere else, correct? Where can I do that?

RahulRagesh commented 6 years ago

I looked upon the mne documentation on to_data_frame(). The parameter name must have got updated. By replacing scale_time with scaling_time resolved the issue for me.

Link to the documentation : https://martinos.org/mne/dev/generated/mne.io.RawArray.html#mne.io.RawArray.to_data_frame

RAMYA-2308 commented 1 year ago

Hello, I got the following error on PC in Windows 10.

python prepare_physionet.py --data_dir data --output_dir data/eeg_fpz_cz --select_ch "EEG Fpz-Cz" Extracting EDF parameters from data\SC4001E0-PSG.edf... EDF file detected Setting channel info structure... Creating raw.info structure... Reading 0 ... 7949999 = 0.000 ... 79499.990 secs... Traceback (most recent call last): File "prepare_physionet.py", line 218, in main() File "prepare_physionet.py", line 95, in main raw_ch_df = raw.to_data_frame(scale_time=100.0)[select_ch] TypeError: to_data_frame() got an unexpected keyword argument 'scale_time'

hai, have you sloved this?

RAMYA-2308 commented 1 year ago

Hello, I got the following error on PC in Windows 10.

python prepare_physionet.py --data_dir data --output_dir data/eeg_fpz_cz --select_ch "EEG Fpz-Cz" Extracting EDF parameters from data\SC4001E0-PSG.edf... EDF file detected Setting channel info structure... Creating raw.info structure... Reading 0 ... 7949999 = 0.000 ... 79499.990 secs... Traceback (most recent call last): File "prepare_physionet.py", line 218, in main() File "prepare_physionet.py", line 95, in main raw_ch_df = raw.to_data_frame(scale_time=100.0)[select_ch] TypeError: to_data_frame() got an unexpected keyword argument 'scale_time'

I've got the same error

cherishleon commented 1 year ago

You may need to install : mne=='0.20.7 see: https://github.com/emadeldeen24/ADAST/issues/2

hoorayrui commented 10 months ago

You may need to install : mne=='0.20.7 see: emadeldeen24/ADAST#2

Thank you! I 've got the same error ,I did what you said and solved the problem!