Compare commits
2 Commits
b31bb18dfe
...
9690971f43
| Author | SHA1 | Date | |
|---|---|---|---|
| 9690971f43 | |||
| 5a5f103ef6 |
@@ -236,7 +236,7 @@ class Decoder_main(threading.Thread):
|
|||||||
if self.zmqServer.open_Impedance: # 阻抗检测状态不解码
|
if self.zmqServer.open_Impedance: # 阻抗检测状态不解码
|
||||||
return
|
return
|
||||||
data = self.zmqServer.paradigmBuffer.getDataViaSSVEP(50)
|
data = self.zmqServer.paradigmBuffer.getDataViaSSVEP(50)
|
||||||
# algo_log(f"SSVEP取出的:{data.shape}, data = {data[:20]}", level="DEBUG")
|
# algo_log(f"SSVEP取出的:{data.shape}, data = {data[:, :10]}", level="DEBUG")
|
||||||
data = data[:self.n_chan, :]
|
data = data[:self.n_chan, :]
|
||||||
if self.decodingSteps == 1 and hasattr(self,'dw'): # 开始预热
|
if self.decodingSteps == 1 and hasattr(self,'dw'): # 开始预热
|
||||||
self.dw.onlineInit() # 刺激闪烁的第1s重置 --在线数据采集时
|
self.dw.onlineInit() # 刺激闪烁的第1s重置 --在线数据采集时
|
||||||
@@ -287,6 +287,7 @@ class Decoder_main(threading.Thread):
|
|||||||
if trainTrial.shape[1] == (self.train_epoch[1] - self.train_epoch[0]) and isinstance(
|
if trainTrial.shape[1] == (self.train_epoch[1] - self.train_epoch[0]) and isinstance(
|
||||||
self.trainLabel, list) \
|
self.trainLabel, list) \
|
||||||
and self.trainLabel.count(self.currentLabel) < self.single_train:
|
and self.trainLabel.count(self.currentLabel) < self.single_train:
|
||||||
|
algo_log(f"SSMVEP训练集:{np.shape(self.trainData)}", level="DEBUG")
|
||||||
self.trainData.append(trainTrial)
|
self.trainData.append(trainTrial)
|
||||||
self.trainLabel.append(self.currentLabel)
|
self.trainLabel.append(self.currentLabel)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -35,3 +35,7 @@ python upperHost_stimmock/MI_headless.py
|
|||||||
# TODO
|
# TODO
|
||||||
1. mvep是否要把list freq 开放到config
|
1. mvep是否要把list freq 开放到config
|
||||||
2. 滤波器参数 放到config文件
|
2. 滤波器参数 放到config文件
|
||||||
|
|
||||||
|
# debug log
|
||||||
|
## MI
|
||||||
|
Epoch采集完成|收到命令: {'method': 'train'|取出的
|
||||||
@@ -152,9 +152,7 @@ class zmqServer(threading.Thread):
|
|||||||
msg = {'method': method, 'params': params}
|
msg = {'method': method, 'params': params}
|
||||||
msg_bytes = json.dumps(msg).encode('utf-8')
|
msg_bytes = json.dumps(msg).encode('utf-8')
|
||||||
|
|
||||||
if msg['method'] == 'beta_psd':
|
if msg['method'] != 'beta_psd':
|
||||||
algo_log(f"发送命令结果: {msg}", level="DEBUG", record_once=True)
|
|
||||||
else:
|
|
||||||
algo_log(f"发送命令结果: {msg}", level="DEBUG")
|
algo_log(f"发送命令结果: {msg}", level="DEBUG")
|
||||||
|
|
||||||
# 广播到所有命令客户端
|
# 广播到所有命令客户端
|
||||||
@@ -276,6 +274,22 @@ class zmqServer(threading.Thread):
|
|||||||
elif params == 2: #停止解码
|
elif params == 2: #停止解码
|
||||||
self.IsExitApp = True
|
self.IsExitApp = True
|
||||||
self.running = False
|
self.running = False
|
||||||
|
|
||||||
|
resp = {
|
||||||
|
"method": "predict_response",
|
||||||
|
"params": {
|
||||||
|
"code": 200,
|
||||||
|
"message": "ok"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
resp_bytes = json.dumps(resp, ensure_ascii=False).encode("utf-8")
|
||||||
|
self.cmd_socket.send_multipart([ident, b"", resp_bytes])
|
||||||
|
algo_log(f"predict 命令已即时回复客户端 {ident}", level="DEBUG")
|
||||||
|
except Exception as e:
|
||||||
|
algo_log(f"predict 命令回复失败: {e}", level="ERROR")
|
||||||
|
return
|
||||||
|
|
||||||
elif method == "rest":
|
elif method == "rest":
|
||||||
self.state_mode = 'rest'
|
self.state_mode = 'rest'
|
||||||
elif method == "impedance":
|
elif method == "impedance":
|
||||||
@@ -359,24 +373,24 @@ class zmqServer(threading.Thread):
|
|||||||
def detect_event(self, samples):
|
def detect_event(self, samples):
|
||||||
self.pack_contain_event = False
|
self.pack_contain_event = False
|
||||||
# 第65通道为事件通道
|
# 第65通道为事件通道
|
||||||
event = int(samples[-2][0])
|
events = np.array(samples[-2], dtype=np.int32).tolist()
|
||||||
# for idx, event in enumerate(events):
|
for idx, event in enumerate(events):
|
||||||
if event in self.events:
|
if event in self.events:
|
||||||
new_key = "".join(
|
new_key = "".join(
|
||||||
[
|
[
|
||||||
str(event),
|
str(event),
|
||||||
datetime.datetime.now().strftime("%Y-%m-%d \
|
datetime.datetime.now().strftime("%Y-%m-%d \
|
||||||
-%H-%M-%S"),
|
-%H-%M-%S"),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
self.currentLabel = event
|
self.currentLabel = event
|
||||||
if event == self.predict_event:
|
if event == self.predict_event:
|
||||||
self.count_events[new_key] = self.latency + 1
|
self.count_events[new_key] = self.latency + 1
|
||||||
else:
|
else:
|
||||||
self.count_events[new_key] = self.train_latency + 1
|
self.count_events[new_key] = self.train_latency + 1
|
||||||
self.event_inner_idx = self.device_info['frame_points'] - 1
|
self.event_inner_idx = idx
|
||||||
# algo_log(f"事件检测到: {event},索引: {idx}", level="DEBUG")
|
algo_log(f"事件检测到: {events},索引: {idx}", level="DEBUG")
|
||||||
self.pack_contain_event = True
|
self.pack_contain_event = True
|
||||||
|
|
||||||
# 倒计时并清理过期事件
|
# 倒计时并清理过期事件
|
||||||
drop_items = []
|
drop_items = []
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ algo_log_path = d:/Program Files/64chn_Decoder/logs
|
|||||||
algo_log_level = DEBUG
|
algo_log_level = DEBUG
|
||||||
console_output = 1
|
console_output = 1
|
||||||
save_train_data = 0
|
save_train_data = 0
|
||||||
zmqServer_host = 127.0.0.1
|
zmqServer_host = 10.200.27.140
|
||||||
|
|
||||||
; 64 导设备配置
|
; 64 导设备配置
|
||||||
[device_type_1]
|
[device_type_1]
|
||||||
|
|||||||
Reference in New Issue
Block a user