# more details here: https://pythonhosted.org/Pebble/ executor = ProcessPool(max_workers=2) # This will store the server response responses = [] stage = [9, 10] last_call_success = False plot_update_time = time() last_played = time() # data aquisition loop # this loop must run fast enough that all operations are completed before # the buffer fills up while True: buffer = server.read_buffer() # No more data available if buffer is None: break samples = buffer.shape[1] samples_read += samples t_now = samples_read / sampling_rate # push new data into running_window and remove old data running_window[:, 0:length - samples] = running_window[:, samples:] running_window[:, length - samples:] = buffer # Wait for buffer to fill up # We need exactly 60 seconds of data before we can stage