Hi!
For some reason the last event is removed when I cropped my data, which to my understanding should not be possible, as I’m defining the tmax according to the last event. I also tried using tmax=None, but also here it’s removed.
Furthermore, I’m having a lot of issues when using events later in my code, as the events are not updated accordingly when the data is cropped.
Is there a bug or am I doing something wrong?
def crop_data(self, raw_intensity):
event_dict_trans = {val: int(key) for key, val in self.annotation_names.items()}
events, event_dict = mne.events_from_annotations(raw_intensity, event_dict_trans)
sfreq = raw_intensity.info["sfreq"]
new_tmin = max(events[0][0] / sfreq - 10, 0) #Always ensure the tmin is non-negative.
new_tmax = events[-1][0] / sfreq + self.stimulus_duration[str(events[-1][2])] + 3
raw_intensity = raw_intensity.crop(tmin=new_tmin, tmax=new_tmax)
return raw_intensity
MNE version: 1.10.2
Windows: 11