def _makeflat(self, start=None, end=None, groups = False):
eeg = list()
for sub in self.data[start:end]:
if len(sub) % self.chunk_len == 0:
eeg.append(sub.reshape([-1, self.chunk_len,3]))
else:
print('ERROR: Please choose a chunk length that is a factor of {}. Current len = {}'.format(self.samples_per_epoch, len(sub)))
return [0,0]
hypno = list()
group = list()
hypno_repeat = self.samples_per_epoch / self.chunk_len
idx = 0
for sub in self.hypno[start:end]:
hypno.append(np.repeat(sub, hypno_repeat))
group.append(np.repeat(idx, len(hypno[-1])))
idx += 1
if groups:
return np.vstack(eeg), np.hstack(hypno), np.hstack(group)
else:
return np.vstack(eeg), np.hstack(hypno)
评论列表
文章目录