正如您自己和@JoeKington在评论中所讨论的,这应该可以工作(我删除了输入内容进行测试)
import numpy as npsample_rate = 400Nyquist = sample_rate/2.0fneeg = 'data.eeg't = 10 ch = 32le = t*sample_rateEEG = np.fromfile(fneeg, 'int16').reshape(ch, le, order='F')
如果不进行重塑,您将获得:
In [45]: EEGOut[45]: array([ -39, -25, -22, ..., -168, -586, -46], dtype=int16)In [46]: EEG.shapeOut[46]: (128000,)
重塑:
In [47]: EEG.reshape(ch, le, order='F')Out[47]: array([[ -39, -37, -12, ..., 5, 19, 21], [ -25, -20, 7, ..., 20, 36, 36], [ -22, -20, 0, ..., 18, 34, 36], ..., [ 104, 164, 44, ..., 60, -67, -168], [ 531, 582, 88, ..., 29, -420, -586], [ -60, -63, -92, ..., -17, -44, -46]], dtype=int16)In [48]: EEG.reshape(ch, le, order='F').shapeOut[48]: (32, 4000)



