Closed RobinGuillard closed 4 years ago
First,
raw = raw.load_data() # load data into memory
line seems useless because,
raw = CreateRaw(raw[picks_chan][0], picks_chan, ch_types=['emg']) # pick channels and load
actual load the data.
The probable explanation is that raw.times
is important. When we use CreateRaw, I believe that raw.times
is reset.
Therefore raw.times
is not the same in the first and second example.
How could it explain such big different ?
Conclusion:
sfreq
) is false, we should trust time stamps (raw.times
) instead. If we need sfreq
we could estimate it.I think it is most probably the second option: in fact, when I downloaded the datas on edf format, the download occured on the "period off interest" (sleep onset to awakening) whereas the whole recording was generally longer (we plugged the device before the dinner most of the time).
I don't know, it should be investigated properly, to do so:
Actually both option 1 and option 2 could be right.
Maybe solved:
1) the sample rate is 250 Hz (or almost) and not 200 Hz which explains the initial issue presented here. 2) when aligning for sleep stages, epochs for sleep staging in the CSV are always starting at "round hours" (ie : 22h50:00, then 22h50:30... and so on) whereas recordings start at random hours ( i.e. 22h50:14 for example). This difference observed accounts for a delta between the start of sleep stage annotations and the recording. What should we do? We should start the sleep staging annotation process at the date "hour of first epoch in CSV" - "hour of first sample in recording (in raw.info["meas_date"]). For the first partial epoch, we should put the same sleep stage as in the first epoch of the csv file (most probably, it will be "awake").
I think you would guess that these lines give the same output:
1)
REPONSE: Epochs done, shape (115700, 2, 50)
2)
REPONSE: Epochs done, shape (104900, 2, 50)
Odd isn't? If you know why, don't hesitate to tell me!