def main(): global numReplicate ns = NameServer(numReplicate) ds1 = DataServer("node1") ds2 = DataServer("node2") ds3 = DataServer("node3") ds4 = DataServer("node4") ns.add(ds1) ns.add(ds2) ns.add(ds3) ns.add(ds4) ds1.start() ds2.start() ds3.start() ds4.start() # print("===") ns.operator() ''' print("?????") ds1.join() ds2.join() ds3.join() ds4.join() ''' return 0
return stage # The main function begins if __name__ == "__main__": # request an authorization token token = request_token() # DataServer is a fake data server that reads data from an offline # EDF file instead of a real EEG device. This is for demonstration # purpose only. Buffer size is the time within which you must read data # otherwise a buffer overflow occurs. Your EEG device manufacturer will # have their own libraries to read real-time data. Please adapt this code # accordingly server = DataServer(buffer_size=BUFFER_SIZE) # Sampling rate of the data sampling_rate = server.sampling_rate # total samples read samples_read = 0 # running_window is exactly 60 seonds long # the real-time module operates on 60 seconds (two epochs) of data # to score the latest 30 seconds (one epoch) length = 60 * sampling_rate running_window = np.zeros((5, length)) blank_data = np.zeros((length)) sleep_stages = [] # Plot realtime data for last 30 seconds or 1 epoch # We use the multiprocessing library to make asynchrnous