- MNE-Python version: 0.23.0
- operating system: Windows 10
As briefly as possible, here is my problem:
I can not concatenate or combine_evoked my data due to difference in time instants (?)
Explanation of work:
- EEG data from multiple subjects. Each has a marker, but I want to epochs for pre-marker and post-marker.
- Pre-marker epoch is fine: epoch tmin = -0.2, epoch tmax = constant (for all subjects). Post-marker epoch is not fine: epoch tmin = positive variable time, epoch tmax = tmin + a constant.
In both cases, the duration of the epoch is designed to be the same within the group. The problem that I’ve noticed is that when I provide the variable time and constant value for the post-marker tmin and tmax, it performs float arithmetic to calculate the times and values like 3.99999999999995 are created as well as values like 4.0.
This wasn’t a problem for me until I tried to concatenate the data to do some initial group analyses on it. I tried to fix this by converting the values from floats to decimals (see: https://www.pythontutorial.net/advanced-python/python-decimal/) but mne throws an error unless the value is a float type.
A simple illustrative code:
tmin = 0.575 tmax = 4.055 raw = mne.io.read_raw_brainvision(vhdr_fname=eeg_file) events_from_annot, event_dict = mne.events_from_annotations(raw_data) epoch = mne.Epochs(raw_data, events_from_annot, event_dict['marker1'], tmin=tmin, tmax=tmax, baseline=(None, None), preload=True) print(epoch.tmax - epoch.tmin) #3.4799999999999995 #if you use tmin=0.650 and tmax=4.13 instead, it returns 3.48 #the tmax of both of these examples are just tmin+constant #and for almost 1/5th of all my data samples, it returns a value like 3.47999999999995 instead of 3.48 #therefore, when trying to concatenate or combine_evoked these epochs together, it throws an error saying the times are not the same.
So, is there some way I can easily continue with my analyses even though this values do not match exactly? Any help would be greatly appreciated.