If you have a question or issue with MNE-Python, please include the following info:
MNE version: e.g. 1.4.0
operating system: e.g. macOS 11.7.3 (2
I have a 1000s .bdf file, when I do
raw=mne.io.read_raw_edf() to read it,
event = mne.make_fixed_length_events(raw, start=0, stop=None, duration=10,first_samp=False) to get events
mne.Epochs(raw, events, tmin=0,event_id=1, tmax=10, baseline=None, preload=True) to epoch
Problem:
1.1: i can only get 30s’ epoch, which has 3 events.
1.2: while I export it as ‘.vhdr’ and use mne.io.read_raw_brainvision to import it and do epoch again, I can get 100 events that are right.
1.3: when I do mne.Epochs(raw, events, tmin=0,event_id=1, tmax=10, baseline=None) which preload=False, I can get 100 events that are right.
I wonder what the inner problem is.
Can I transfer rawEDF to rawBrainVision without export?
what’s the problem applying mne.Epoch fucntion to rawEDF?
I don’t think this answers your questions, but may be helpful. Can you try the function mne.make_fixed_length_epochs(raw, duration=10.0). This way, you don’t have to deal with the events.
Regarding your question - check your dataset raw.times just to confirm that your times in your raw file are what you expect. And also check your events variable includes events that extend out as far as you are expecting.
I fixed it one day and failed, Now I have used your method, and it works, just like magic. Thank you very much!
I checked the raw.times, it has something wrong. Although numerical value is right when I did raw.times[-1] - raw.times[-2] it gets 0.009999999999763531, but not 0.01 (sample rate is 100).
and when i modify the raw.times, but get error: AttributeError: can’t set attribute.
Hence, I get new problem: how do I modify the raw.times?
This is probably OK / not a problem. The “error” in sampling period is about 0.000000002 % and the error in sample rate is the same. This will not make a meaningful difference to any calculations. It might even reflect the actual sampling rate/times; hardware devices don’t always achieve the exact sampling frequencies they advertise.