csndl-iitd / realtime-sleep-staging

Using ML for identification of sleep stages in real time in humans
MIT License
0 stars 0 forks source link

Create Epoch_data_review #12

Open Tanvig opened 5 months ago

Tanvig commented 5 months ago

@gsaurabhr I’ve tried to create the epoch dataset from a single subject’s annotation file.

https://github.com/csndl-iitd/realtime-sleep-staging/tree/f11f1034802c5d1d593999e090aff084c3a06171/data/3D%20CNN%20Approach

This epoch dataset comprises 60 text files that contain the sleep stage for that particular 30-second epoch. The epoch duration is based on the difference between the mark-on and mark-off markers described in the annotation file (as the difference was approximately 30 seconds).

I’ve also added a CSV file so that you can review the data on which the epoch files were created.

Please review this data and kindly let me know if this is what we discussed. In that case, I will create epoch files for all the subjects.

gsaurabhr commented 5 months ago

The files in the folder should be epoched EEG data. The CSVs look good. You split the EEG array (2D array of 64 x #total samples) into data for each epoch (64 x #samples per epoch) and store it as numpy file (.npy). The naming convention is fine.

Also in some places the name includes "suj" instead of "sub". Fix that.

Tanvig commented 5 months ago

Update:

I have tried to fix the above suggested issue Link: https://github.com/csndl-iitd/realtime-sleep-staging/tree/ea54542218ba8cf3aa979585813867b19457a3dc/data/3D%20CNN%20Approach/subject29_l5nap_day1_epochs

Process followed:

Screenshot 2024-06-09 at 4 57 38 PM

Queries

Once these queries are resolved, I will replicate this process for all the subjects.

gsaurabhr commented 5 months ago

Looks good. Make the file names consistent. It will simplify your code later.

The txt and csv files are named "sujxxday1..." while the corresponding folder is named "subjectxx_I5nap_day1".

The sleep stages are labeled in the csv file, so you can read them from there whenever required. If you want, you can include that in the file names as a last substring: subj29_l5nap_day1epoch0w.npy for example. That way later when you want to read all the wake state files, you simply have to say glob("*_w.npy").

Tanvig commented 5 months ago

Updated the epochs data accordingly.

Link to the data: https://github.com/csndl-iitd/realtime-sleep-staging/tree/b59be0f2486ca97e6055ea7ecafd4b863f9281eb/data/3D%20CNN%20Approach

Note: