add buffer
This commit is contained in:
@@ -63,8 +63,53 @@ class ParadigmRingBuffer:
|
||||
获取最新缓存中每个通道的数量
|
||||
@return:
|
||||
'''
|
||||
return self.nUpdate
|
||||
return self.nUpdate
|
||||
|
||||
# ========== 各范式数据访问接口 ==========
|
||||
def get_MIData(self):
|
||||
"""获取MI导联数据 (21通道 + 事件)"""
|
||||
data = self.getData(self.GetDataLenCount())
|
||||
rows_to_extract = [8, 15, 12, 14, 18, 23, 16, 59, 50, 58, 17, 45, 29, 11, 10, 19, 20, 61, 51, 60, 21, 64, 65]
|
||||
row_to_select = np.array(rows_to_extract)
|
||||
if data.shape[1] > 0:
|
||||
return data[row_to_select, :]
|
||||
return np.zeros((len(rows_to_extract), 0))
|
||||
|
||||
def get_SSMVEPData(self):
|
||||
"""获取SSMVEP导联数据 (8通道 + 事件)"""
|
||||
data = self.getData(self.GetDataLenCount())
|
||||
rows_to_extract = [13, 3, 2, 46, 9, 54, 47, 55, 64, 65]
|
||||
row_to_select = np.array(rows_to_extract)
|
||||
if data.shape[1] > 0:
|
||||
return data[row_to_select, :]
|
||||
return np.zeros((len(rows_to_extract), 0))
|
||||
|
||||
def getDataViaSSVEP(self, count):
|
||||
"""获取SSVEP数据 (8通道 + 事件)"""
|
||||
data = self.getData(count)
|
||||
rows_to_extract = [13, 3, 2, 46, 9, 54, 47, 55, 64]
|
||||
row_to_select = np.array(rows_to_extract)
|
||||
if data.shape[1] > 0:
|
||||
return data[row_to_select, :]
|
||||
return np.zeros((len(rows_to_extract), 0))
|
||||
|
||||
def get_concentrateData(self, count):
|
||||
"""获取专注力数据 (2通道)"""
|
||||
data = self.getData(count)
|
||||
rows_to_extract = [0, 1]
|
||||
row_to_select = np.array(rows_to_extract)
|
||||
if data.shape[1] > 0:
|
||||
return data[row_to_select, :]
|
||||
return np.zeros((len(rows_to_extract), 0))
|
||||
|
||||
def get_blinkData(self, count):
|
||||
"""获取眨眼数据 (2通道)"""
|
||||
data = self.getData(count)
|
||||
rows_to_extract = [0, 1]
|
||||
row_to_select = np.array(rows_to_extract)
|
||||
if data.shape[1] > 0:
|
||||
return data[row_to_select, :]
|
||||
return np.zeros((len(rows_to_extract), 0))
|
||||
|
||||
# reset buffer
|
||||
def resetAllPara(self):
|
||||
@@ -72,6 +117,4 @@ class ParadigmRingBuffer:
|
||||
self.currentPtr = 0
|
||||
self.readPtr = 0 # add by lizhenhua 清空读指针
|
||||
self.buffer = np.zeros((self.n_chan, self.n_points)) # add by lizhenhua 清空环形缓冲区
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user