I have one unique raw file which contains EEG data for different conditions in bdf format.
I want to be able to separate each condition in its dedicated .fif file.
For now, I have been able to use my unique raw file and save smaller .fif thanks to crop method.
However, later in the pipeline, I want to be able to retrieve all the events of the .fif file specific to a condition. So, I apply mne.find_events() on this condition file but this outputs events onset based on the original longer bdf file which thus does not correspond to correct times.
In practice: I have my original bdf file ranging from 0 to 913sec. I have one of the condition with first event at timepoint 582703 and last event at timepoint 681316 (which corresponds to 96.3s duration for that condition with my sampling frequency at 1024Hz).
Later, when I read that smaller file its range does not start with 0 but EEG.times do start at 0 and when using mne.find_events() on that smaller condition fif file the first event is still at timepoint 582703 which is out of the time duration of the file (582703/1024 = 569sec).
How can I get my events according to the new duration of the file and not the original .bdf file.
The only solution I came with so far is not based on dedicated MNE methods but consists of extracting events from the original bdf file, croping the data thanks to tmin and tmax and then filtering the original events list inside the cropped time range and then substracting the tmin from all the events time points.
If you have any solution that use MNE dedicated function or more straightforward please do not hesitate to share your solution.