+ 2

Hello could you please tell what does window_delay mean here? def __init__(self, hostname='localhost', port=1972, n_channels=16

import sys import time import socket import numpy as np from FieldTrip import Client class BCI: def __init__(self, hostname='localhost', port=1972, n_channels=16, window_delay=50): self.client = Client() self.n_channels = n_channels self.data_x = np.zeros((0, n_channels)) self.data_y = [] while not self.client.isConnected: try: self.client.connect(hostname, port) except socket.error: print("Failed to connect at " + hostname + ":" + str(port)) time.sleep(1) self.buffer_start_index = self.client.poll()[0] self.transition_indexes = [self.client.poll()[0] - self.buffer_start_index] self.transition_classes = [] self.min_rows_per_chunk = sys.float_info.max self.window_delay = window_delay def set_new_class(self, new_class): poll = self.client.poll()[0] self.transition_indexes += [poll - self.buffer_start_index] self.transition_classes += [new_class] if poll - self.buffer_start_index > 100000 or new_class is None: self.transition_indexes = self.transition_indexes[:-1] self.transition_classes = self.transition_classes[:-1] try: self.data_x = np.vstack((self.data_x, self.client.getData([self.buffer_start_index + self.window_delay, self.buffer_start_index + self.transition_indexes[-1] + self.window_delay]))) except: time.sleep(1) self.data_x = np.vstack((self.data_x, self.client.getData([self.buffer_start_index + self.window_delay, self.buffer_start_index + 1 +

10th Dec 2020, 11:06 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
1 Réponse