- MNE-Python version: v0.22
- operating system: linux
Hi there, doing some cooking to run regression stats for which the order of epochs matters.
1) I start with a list called epos_list, containing roughly the same numbers of epochs per bins, and most importantly, all of them with the correct times of “-1 -0 sec”:
epos_list
[<EpochsFIF | 45 events (all good), -1 - 0 sec, baseline [0, 0] sec, ~24.8 MB, data loaded, with metadata,
'12': 9
'22': 6
'32': 30>,
<EpochsFIF | 45 events (all good), -1 - 0 sec, baseline [0, 0] sec, ~24.8 MB, data loaded, with metadata,
'12': 15
'22': 15
'32': 15>,
[....]
2) I concatenate those making sure the order I defined in metadata is preserved:
#recreate an Epochs array for stats
if bidx == ['1', '2', '3', '4', '5']:
data = np.concatenate([epos_list[0].get_data(),
epos_list[1].get_data(),
epos_list[2].get_data(),
epos_list[3].get_data(),
epos_list[4].get_data()])
else:
print(f'Indexing error : {sid}')
3) I create an EpochsArray with these data for subsequent single-trial analysis:
data_epo = mne.EpochsArray(data, info = blah.info)
and surprise, data_epo
shows incorrect times!
<EpochsArray | 224 events (all good), 0 - 1 sec, baseline off, ~94.6 MB, data loaded,
'1': 224>
4) To make sure, the info I provided have the right times:
blah.times
array([-1. , -0.998, -0.996, -0.994, -0.992, -0.99 , -0.988, -0.986,
-0.984, -0.982, -0.98 , -0.978, -0.976, -0.974, -0.972, -0.97 ,
[...] -0.016, -0.014, -0.012, -0.01 ,
-0.008, -0.006, -0.004, -0.002, 0. ])
What’s going on with EpochsArray?
Troubleshooting:
- the same results is returned when using the more straightforward:
data_epo = mne.EpochsArray(mne.concatenate_epochs(epos_list), info = blah.info)
(mine is convoluted to insure proper indexing)
- the same issue is there when using directly the info of the same epochs that actually fed the epochs list (blah being a subset of those anyways):
data_epo = mne.EpochsArray(data, info = epos[0].info)
Of course, east workaround by adding the proper times but unfortunately I did not see this coming at all when analysing data and lost a day of work troubleshooting this seeing the nonsensical stat outcomes
update: data_epo.times = blah.times
will not do as a simple workaround
Cheers,
Virginie