fixed a bug which resulted in mne dropping some epochs extracted with fixed_length_windows, since they were marked bad. reason for this was that parts of the signal were cropped prior to extracting windows. windowing start and end samples are now relative to raw.first_samp
@@ -167,7 +167,9 @@ def create_fixed_length_windows(
if stop_offset_samples is None
else stop_offset_samples)
last_allowed_ind = stop - supercrop_size_samples
- starts = np.arange(start_offset_samples, last_allowed_ind + 1,
+ starts = np.arange(
+ ds.raw.first_samp + start_offset_samples,
+ last_allowed_ind + 1,
supercrop_stride_samples)
if not drop_samples and starts[-1] < last_allowed_ind:
@@ -178,10 +180,8 @@ def create_fixed_length_windows(
target = -1 if ds.target is None else ds.target
if mapping is not None:
target = mapping[target]
- if not isinstance(target, (np.integer, int)):
- raise ValueError(f"Mapping from '{target}' to int is required")
- fake_events = [[start, supercrop_size_samples, target]
+ fake_events = [[start, supercrop_size_samples, -1]
for i_start, start in enumerate(starts)]
metadata = pd.DataFrame({
'i_supercrop_in_trial': np.arange(len(fake_events)),
