def present(duration=300): nsamples = int(60 * duration) info = StreamInfo('Markers', 'Markers', 1, 0, 'int32', 'myuidw43536') outlet = StreamOutlet(info) markernames = [1, 2] n_trials = 1 screenRes = [800, 600] win = visual.Window(screenRes, fullscr=True, allowGUI=False, monitor='testMonitor', screen=0, units='deg', name='win', color=(128, 128, 128), colorSpace='rgb255') # create fixation cross fCS = 60 fCP = [0, 0] fixation = visual.ShapeStim(win, lineColor='#000000', lineWidth=3.0, vertices=((fCP[0] - fCS / 2, fCP[1]), (fCP[0] + fCS / 2, fCP[1]), (fCP[0], fCP[1]), (fCP[0], fCP[1] + fCS / 2), (fCP[0], fCP[1] - fCS / 2)), units='pix', closeShape=False, name='fixCross') fixation.autoDraw = True start = time() for i in range(nsamples): fixation.draw() #outlet.push_sample([markernames[0]], time()) win.flip() #if (time() - start) > duration: #break event.clearEvents() print(time() - start) win.close()
def create_lsl_output(self): """Creates an LSL Stream outlet""" info = StreamInfo(name=self.lsl_streamname, type='Markers', channel_count=1, channel_format='int8', nominal_srate=IRREGULAR_RATE, source_id='marker_stream', handle=None) if self.flash_mode == 1: info.desc().append_child_value('flash_mode', 'Row and Column') elif self.flash_mode == 2: info.desc().append_child_value('flash_mode', 'Single Value') info.desc().append_child_value('num_rows', str(self.number_of_rows)) info.desc().append_child_value('num_cols', str(self.number_of_columns)) return StreamOutlet(info)
def __init__(self): self._time_dilation = 1 self._sfreq = int(1) self.subscriber = pubsub_v1.SubscriberClient() # The `subscription_path` method creates a fully qualified identifier # in the form `projects/{project_id}/subscriptions/{subscription_id}` self.subscription_path = self.subscriber.subscription_path( 'vae-cloud-model', 'test_topic_out-sub') self.streaming_pull_future = self.subscriber.subscribe( self.subscription_path, callback=self.callback) info = StreamInfo('PubSub', 'PubSubInference', 1, 0, 'string', 'gcppubsub') # next make an outlet self.outlet = StreamOutlet(info) self.start()
def run_events_sim(name='events_example'): info = StreamInfo(name=name, type='EEG', channel_count=1, channel_format='float32', source_id='myuid34234') # channels labels (in accordance with XDF format, see also code.google.com/p/xdf) chns = info.desc().append_child("channels") for label in ['STIM']: ch = chns.append_child("channel") ch.append_child_value("label", label) outlet = StreamOutlet(info) # send data and print some info every 5 sec print('now sending data...') while True: outlet.push_sample([42]) time.sleep(1) print('42 sent') pass
def __init__(self, controller): super().__init__() self.init_time = time.time() self.controller = controller self.alarm_threshold = controller.detection_threshold_up self.alarm_deque = controller.alarm_deque self.up_sound = sa.WaveObject.from_wave_file('./sounds/up-sound.wav') self.wait_time = 20 #Speed control info = StreamInfo(name='Oddball_speed', type='Markers', channel_count=1, nominal_srate=0, channel_format='string', source_id='velocity') self.oddball_speed_outlet = StreamOutlet(info)
def create_lsl(self): # default parameters eeg_name = 'OpenBCI_EEG' eeg_type = 'EEG' eeg_chan = self.eeg_channels eeg_hz = self.sample_rate eeg_data = 'double64' eeg_id = 'openbci_eeg_id' # create StreamInfo self.info_eeg = StreamInfo(eeg_name, eeg_type, eeg_chan, eeg_hz, eeg_data, eeg_id) # channel locations chns = self.info_eeg.desc().append_child('channels') if self.eeg_channels == 16: labels = [ 'Fp1', 'Fp2', 'C3', 'C4', 'T5', 'T6', 'O1', 'O2', 'F7', 'F8', 'F3', 'F4', 'T3', 'T4', 'P3', 'P4' ] else: labels = ['Fp1', 'Fp2', 'C3', 'C4', 'T5', 'T6', 'O1', 'O2'] for label in labels: ch = chns.append_child("channel") ch.append_child_value('label', label) ch.append_child_value('unit', 'microvolts') ch.append_child_value('type', 'EEG') # additional Meta Data self.info_eeg.desc().append_child_value('manufacturer', 'OpenBCI Inc.') # create StreamOutlet self.outlet_eeg = StreamOutlet(self.info_eeg) print("--------------------------------------\n" + "LSL Configuration: \n" + " Stream: \n" + " Name: " + eeg_name + " \n" + " Type: " + eeg_type + " \n" + " Channel Count: " + str(eeg_chan) + "\n" + " Sampling Rate: " + str(eeg_hz) + "\n" + " Channel Format: " + eeg_data + " \n" + " Source Id: " + eeg_id + " \n" + "Electrode Location Montage:\n" + str(labels) + "\n" + "---------------------------------------\n")
def update(self): if isinstance(self.i.data, pd.core.frame.DataFrame): if not self._outlet: labels = list( self.i.data.select_dtypes( include=[self._dtypes[self._format]])) info = StreamInfo(self._name, self._type, len(labels), self._rate, self._format, self._source) channels = info.desc().append_child('channels') for label in labels: if not isinstance('string', type(label)): label = str(label) channels.append_child('channel').append_child_value( 'label', label) self._outlet = StreamOutlet(info) values = self.i.data.select_dtypes( include=[self._dtypes[self._format]]).values stamps = self.i.data.index.values.astype(np.float64) for row, stamp in zip(values, stamps): self._outlet.push_sample(row, stamp)
def __init__(self, root, datarate=250): super(BalanceBoardLSLOut, self).__init__(root, "LSLOut") logging.debug("Configuring LSL stream for 'wobble' data...") # configure LSL stream self.info = StreamInfo('BalanceBoard', 'wobble', 9, datarate, 'float32', self.root.id) # append some meta-data self.info.desc().append_child_value("manufacturer", "play") channels = self.info.desc().append_child("channels") for c in [ "accx", "accy", "accz", "acclinx", "accliny", "acclinz", "yaw", "pitch", "roll" ]: channels.append_child("channel") \ .append_child_value("label", c) \ .append_child_value("type", "wobble") # next make an outlet; we set the transmission chunk size to 32 samples and # the outgoing buffer size to 360 seconds (max.) self.outlet = StreamOutlet(self.info, 32, 360)
def start_lsl(): # Initialize an LSL stream by providing the stream-name ('BioSemi'), # signal type ('EEG'), number of channels (8 for the OpenBCI Mark IV headset), # sampling frequency (250 for the OpenBCI Mark IV headset), the data type ('float32'), # and the user-id. info = StreamInfo('BioSemi', 'EEG', 8, 250, 'float32', 'myuid34234') # Create a server outlet. outlet = StreamOutlet(info) while True: # Create random 8-channel sample. mysample = [random.random(), random.random(), random.random(), random.random(), random.random(), random.random(), random.random(), random.random()] # Send the signal and wait 4ms for the next data post (emulating 250 Hz sampling rate). outlet.push_sample(mysample) time.sleep(0.04)
def stream(): #print(address) #print(name) print( "Creating LSL stream for EEG. \nName: OpenBCIEEG\nID: OpenBCItestEEG\n" ) info_eeg = StreamInfo('OpenBCIEEG', 'EEG', 16, 250, 'float32', 'OpenBCItestEEG') # print("Creating LSL stream for AUX. \nName: OpenBCIAUX\nID: OpenBCItestEEG\n") # info_aux = StreamInfo('OpenBCIAUX', 'AUX', 3, 250, 'float32', 'OpenBCItestAUX') info_eeg.desc().append_child_value("manufacturer", "OpenBCI") eeg_channels = info_eeg.desc().append_child("channels") for c in [ 'Fp1', 'Fp2', 'C3', 'C4', 'P7', 'P8', 'O1', 'O2', 'F7', 'F8', 'F3', 'F4', 'T7', 'T8', 'P3', 'P4' ]: eeg_channels.append_child("channel") \ .append_child_value("label", c) \ .append_child_value("unit", "microvolts") \ .append_child_value("type", "EEG") # eeg_outlet = StreamOutlet(eeg_info, LSL_EEG_CHUNK) outlet_eeg = StreamOutlet(info_eeg) # outlet_aux = StreamOutlet(info_aux) def lsl_streamers(sample): outlet_eeg.push_sample( np.array(sample.channels_data) * SCALE_FACTOR_EEG) # outlet_aux.push_sample(np.array(sample.aux_data)*SCALE_FACTOR_AUX) #board = OpenBCICyton(port='COM3', daisy=True) board = OpenBCICyton(port='/dev/tty.usbserial-DM01N7JO', daisy=True) board.start_stream(lsl_streamers)
def main(): srate = 100 name = 'Dummy Device' type = 'ECG' n_channels = 4 info = StreamInfo(name, type, n_channels, srate, 'float32', 'uid34234') outlet = StreamOutlet(info) start_time = local_clock() sent_samples = 0 print("now sending data...") while True: elapsed_time = local_clock() - start_time required_samples = int(srate * elapsed_time) - sent_samples for sample_ix in range(required_samples): mysample = [rand() for _ in range(n_channels)] outlet.push_sample(mysample) sent_samples += required_samples time.sleep(0.01)
def main(): # first create a new stream info (here we set the name to MyMarkerStream, # the content-type to Markers, 1 channel, irregular sampling rate, # and string-valued data) The last value would be the locally unique # identifier for the stream as far as available, e.g. # program-scriptname-subjectnumber (you could also omit it but interrupted # connections wouldn't auto-recover). The important part is that the # content-type is set to 'Markers', because then other programs will know how # to interpret the content info = StreamInfo('MyMarkerStream', 'Markers', 1, 0, 'string', 'myuidw43536') # next make an outlet outlet = StreamOutlet(info) print("now sending markers...") markernames = ['Test', 'Blah', 'Marker', 'XXX', 'Testtest', 'Test-1-2-3'] while True: # pick a sample to send an wait for a bit outlet.push_sample([random.choice(markernames)]) time.sleep(random.random() * 3)
def __init__(self): # check device manager for correct COM port. self.board = bci.OpenBCIBoard(port='COM3', filter_data=True, daisy=False) # setup LSL streams = resolve_byprop('name', self.LSL_STREAM_NAME, timeout=2.5) try: self.inlet = StreamInlet(streams[0]) except IndexError: raise ValueError('Make sure stream name="%s", is opened first.' % LSL_STREAM_NAME) self.running = True self.samples = [] info = StreamInfo(self.LSL_BCI_STREAM_NAME, 'eeg', self.LSL_BCI_NUM_CHANNELS, self.LSL_BCI_SAMPLE_RATE, 'float32', 'uid2') self.outlet = StreamOutlet(info)
def main(): info = StreamInfo(name='Oddball_speed', type='Markers', channel_count=1, nominal_srate=0, channel_format='string', source_id='velocity') outlet = StreamOutlet(info) state = False try: while True: command = "500" if state else "1100" state = not state outlet.push_sample([command]) sleep_time = random.randint(18, 28) print("New ITI for odd ball is ", command) print("Sleeping for ", sleep_time) time.sleep(sleep_time) except KeyboardInterrupt: print("Press Ctrl-C to terminate while statement")
def run(self): outlet = StreamOutlet(self.info) count = 0.0 print("now sending data...") self.is_running = True while self.is_running: # make a new random 8-channel sample; this is converted into a # pylsl.vectorf (the data type that is expected by push_sample) # mysample = [rand() for c in range(self.channel_count)] mysample = [] for c in range(self.channel_count): if c == 0: mysample.append(rand()) else: smpl = sin((c**2) * 2 * pi * count * self.samplestep) mysample.append(smpl) count += 1.0 # now send it and wait for a bit outlet.push_sample(mysample) time.sleep(self.samplestep)
def __init__(self, cfg_filename): # load in the cfg self.cfg = esys_cfg.create_config(cfg_filename) # psychopy setup self.window = visual.Window(self.cfg.resolution) # preload all of stimuli, in sorted order self.loaded_stims = {} for trial_name, trial in self.cfg.trials.iteritems(): stimuli_type = trial.stimuli_type path_prefix = '%s/' % trial.stimuli_folder if stimuli_type == 'images': self.loaded_stims[trial_name] = [ visual.ImageStim(self.window, '%s%s' % (path_prefix, stim_file)) for stim_file in trial.files[:-1] ] self.fix_file = visual.ImageStim( self.window, '%s%s' % (path_prefix, trial.files[-1])) elif stimuli_type == 'sounds': self.loaded_stims[trial_name] = [ sound.Sound('%s%s' % (path_prefix, stim_file)) for stim_file in trial.files[:-1] ] self.fix_file = sound.Sound('%s%s' % (path_prefix, trial.files[-1])) else: print('Unsupported stimuli_type: %s' % stimuli_type) raise ValueError # setup LSL # TODO generalize uid info = StreamInfo(self.LSL_STREAM_NAME, self.LSL_STREAM_TYPE, self.LSL_NUM_CHANNELS, self.LSL_SAMPLE_RATE, 'string', 'uid1') self.outlet = StreamOutlet(info)
def send_data(data, tag='random_tag', modality='NA', n_channels=2, s_freq=128, dtype='float32', device_id='random_id', cond='inf', breaks=0.1): if not isinstance(data, (np.ndarray, mne.EpochsArray)): raise Exception('data must be either an ndarray or EpochsArray') if isinstance(data, np.ndarray): raw_data = data else: raw_data = data.get_data() if raw_data.size != n_channels: raise Exception('raw_data.size must be equal to n_channels') if modality == 'NA': print('warning: modality is set to NA, consider setting it to', 'an actual modality (EEG, ECG, etc.)') if tag == 'random_tag': print("warning: tag is set to 'random_tag', consider setting", 'it to an actual tag (such as your device name)') info = StreamInfo(tag, modality, n_channels, s_freq, dtype, device_id) outlet = StreamOutlet(info) print('sending data...') if cond == 'inf': print("cond set to 'inf', will send data indefinitely, until external", 'interruption occurs') while True: outlet.push_sample(data) time.sleep(breaks)
def initializeOutlet(interface): """ Initializes and returns an LSL outlet :param interface: Interface the Python interface to communicate with node :return: StreamOutlet returns a labstreaminglayer StreamOutlet """ numChans = None while not numChans: msg = interface.recv() try: dicty = json.loads(msg) numChans = dicty.get('numChans') sampleRate = dicty.get('sampleRate') except ValueError as e: print(e) info = StreamInfo('OpenBCI_EEG', 'EEG', numChans, sampleRate, 'float32', 'myuid34234') outlet = StreamOutlet(info) print('init') return outlet
def __init__(self, class_list=[1, 3], classes_rand=True, target_list=[1, 2], targets_rand=True): """ :param class_list: A list of integers comprising different class ids. Default: [1, 3] :param classes_rand: If True, classes are chosen randomly from list. If False, the list is cycled. Default: True :param target_list: A list of integers comprising different target ids. Default: [1, 2] :param targets_rand: If True, targets are chosen randomly from list. If False, the list is cycled. Default: True """ stream_name = 'GeneratedCentreOutMarkers' stream_type = 'Markers' outlet_info = StreamInfo(name=stream_name, type=stream_type, channel_count=1, nominal_srate=0, channel_format='string', source_id='centreoutmarkergen1234') outlet_xml = outlet_info.desc() channels_xml = outlet_xml.append_child("channels") chan_xml = channels_xml.append_child("channel") chan_xml.append_child_value("label", "EventMarkers") chan_xml.append_child_value("type", "generated") self.outlet = StreamOutlet(outlet_info) print("Created outlet with name {} and type {}".format( stream_name, stream_type)) self.class_list = class_list self.classes_rand = classes_rand self.target_list = target_list self.targets_rand = targets_rand self.next_transition = -1 self.in_phase = 'evaluate' self.trial_ix = 0 self.class_id = self.class_list[0] self.target_id = self.target_list[0]
def __setup_output_stream(self, stream_name, stream_type): """ Initialize a LSL outlet of particular name and type Parameters ---------- stream_name : str Name of LSL outlet to initialize. Can be anything. stream_type : str Type of LSL outlet to initialze. Typical choices are 'marker', 'data', or 'eeg'. Returns ------- outlet : LSL Outlet Creates a LSL-ready outlet for streaming data over the network. """ # Identify the type of data we are sending back. if stream_type.casefold() == 'marker'.casefold(): info = StreamInfo(stream_name, stream_type, channel_count=1, nominal_srate=0, channel_format='string', source_id='single314uid') elif stream_type.casefold() == 'data'.casefold(): info = StreamInfo(stream_name, stream_type, channel_count=1, nominal_srate=0, source_id='single314uid') # Make the stream outlet using the infor provided above print('...setting up LSL outlet object...') outlet = StreamOutlet(info) return outlet
def __init__(self, lsl_data_name=config.INFERENCE_LSL_NAME, lsl_data_type=config.INFERENCE_LSL_TYPE ): # default board_id 2 for Cyton self.lsl_data_type = lsl_data_type self.lsl_data_name = lsl_data_name # TODO need to change the channel count when adding eeg info = StreamInfo(lsl_data_name, lsl_data_type, channel_count=config.EYE_TOTAL_POINTS_PER_INFERENCE, channel_format='float32', source_id='myuid2424') info.desc().append_child_value("apocalyvec", "RealityNavigation") # chns = info.desc().append_child("eeg_channels") # channel_names = ["C3", "C4", "Cz", "FPz", "POz", "CPz", "O1", "O2", '1','2','3','4','5','6','7','8'] # for label in channel_names: # ch = chns.append_child("channel") # ch.append_child_value("label", label) # ch.append_child_value("unit", "microvolts") # ch.append_child_value("type", "EEG") chns = info.desc().append_child("eye") channel_names = [ 'left_pupil_diameter_sample', 'right_pupil_diameter_sample' ] for label in channel_names: ch = chns.append_child("channel") ch.append_child_value("label", label) ch.append_child_value("unit", "mm") ch.append_child_value("type", "eye") self.outlet = StreamOutlet(info, max_buffered=360) self.start_time = local_clock() self.inlet = None self.connect_inference_result_stream()
def create_lsl_output(self): """Creates an LSL Stream outlet""" info = StreamInfo( name=self.config.lsl_streamname.get(), type="P300_Marker", channel_count=1, channel_format="int8", nominal_srate=IRREGULAR_RATE, source_id="marker_stream", handle=None, ) if self.config.flash_mode == 1: info.desc().append_child_value("flash_mode", "Row and Column") elif self.config.flash_mode == 2: info.desc().append_child_value("flash_mode", "Single Value") info.desc().append_child_value("num_rows", str(self.config.number_of_rows.get())) info.desc().append_child_value( "num_cols", str(self.config.number_of_columns.get())) return StreamOutlet(info)
def marker_gen(self, **kwargs): # Put the known information of the stream in a tuple. It is better to know as much # as possible if more than one kit is running LSL at the same time. kwargs_list_info = [] for key, val in kwargs.items(): kwargs_list_info.append(val) name = kwargs_list_info[0] type = kwargs_list_info[1] channel_count = kwargs_list_info[2] nominal_srate = kwargs_list_info[3] channel_format = kwargs_list_info[4] source_id = kwargs_list_info[5] print('Stream Info List: ', name, type, channel_count, nominal_srate, channel_format, source_id) # The StreamInfo object stores the declaration of a data stream. self.info = StreamInfo(name, type, channel_count, nominal_srate, channel_format, source_id) # Create Outlet. self.outlet = StreamOutlet(self.info)
def _setup_outlet(self): sample_size = self.CONNECTIONS * len(self.freqParams) if sample_size == 0: return info = StreamInfo('RValues', 'Markers', sample_size, IRREGULAR_RATE, cf_float32, "RValues-{}".format(getpid())) info.desc().append_child_value("correlation", "R") mappings = info.desc().append_child("mappings") buffer_keys = list(self.buffers.keys()) pair_index = [ a for a in list( product(np.arange(0, len(buffer_keys)), np.arange(0, len(buffer_keys)))) if a[0] < a[1] ] for pair in pair_index: mappings.append_child("mapping") \ .append_child_value("from", buffer_keys[pair[0]]) \ .append_child_value("to", buffer_keys[pair[1]]) return StreamOutlet(info)
def create_noisy_test_source(freq=10, noise_freq=60, sps=250): ''' create fake lsl stream of source data ''' assert freq < (sps / 2), "frequence must be less than nquist" stream_name = "Test_Signal_" + str(freq) + "_Hz_" stream_id = stream_name + time.strftime("_%d_%m_%Y_%H_%M_%S_") info = StreamInfo(stream_name, 'EEG', 8, 250, 'float32', stream_id) outlet = StreamOutlet(info) delay = 1.0 / sps def _target(): idx = 0 while True: time.sleep(delay) idx += 1 new_val = np.sin(2 * np.pi * freq * (idx * delay)) + np.sin(2 * np.pi * noise_freq * (idx * delay)) outlet.push_sample([new_val for i in range(8)]) _thread = Thread(target=_target) _thread.start()
def _start_muse(self, duration): if sys.platform in ["linux", "linux2", "darwin"]: # Look for muses muses = list_muses() #self.muse = muses[0] # Start streaming process self.stream_process = Process(target=stream, args=(self.muses[0]['address'], )) self.stream_process.start() # Create markers stream outlet self.muse_StreamInfo = StreamInfo('Markers', 'Markers', 1, 0, 'int32', 'myuidw43536') self.muse_StreamOutlet = StreamOutlet(self.muse_StreamInfo) # Start a background process that will stream data from the first available Muse print("starting background recording process") print('will save to file: %s' % self.save_fn) self.recording = Process(target=record, args=(duration, self.save_fn)) self.recording.start()
def __init__(self, lsl_data_type, num_channels, sampling_rate): # default board_id 2 for Cyton self.lsl_data_type = lsl_data_type self.lsl_num_channels = num_channels self.sampling_rate = sampling_rate with open('data/s01.dat', "rb") as f: deap_data = pickle.load(f, encoding="latin1") deap_data = np.array(deap_data['data']) # flatten so we have a continuous stream self.deap_data = deap_data.reshape( deap_data.shape[1], deap_data.shape[0] * deap_data.shape[2]) self.dreader = None self.stream_process = None info = StreamInfo('DEAP Simulation', 'EEG', num_channels, self.sampling_rate, 'float32', 'deapcontinuous') self.outlet = StreamOutlet(info, 32, 360) self.streams = resolve_byprop('name', self.lsl_data_type, timeout=1) if len(self.streams) < 1: raise AttributeError( 'Unable to find LSL Stream with given type {0}'.format( lsl_data_type)) self.inlet = StreamInlet(self.streams[0]) pass
def create_lsl(self, name='OpenBCI_Cyton_8', type='EEG', channel_count=8, nominal_srate=250.0, channel_format='float32', source_id='Cyton_0'): self.info_eeg = StreamInfo(name=name, type=type, channel_count=channel_count, nominal_srate=nominal_srate, channel_format=channel_format, source_id='') chns = self.info_eeg.desc().append_child('channels') self.labels = ['Fp1', 'Fp2', 'C3', 'C4', 'T5', 'T6', 'O1', 'O2'] for label in self.labels: ch = chns.append_child("channel") ch.append_child_value('label', label) ch.append_child_value('unit', 'microvolts') ch.append_child_value('type', 'EEG') self.info_eeg.desc().append_child_value('manufacturer', 'OpenBCI Inc.') self.outlet_eeg = StreamOutlet(self.info_eeg) print("--------------------------------------\n" + \ "LSL Configuration: \n" + \ " Stream 1: \n" + \ " Name: " + name + " \n" + \ " Type: " + type + " \n" + \ " Channel Count: " + str(channel_count) + "\n" + \ " Sampling Rate: " + str(nominal_srate) + "\n" + \ " Channel Format: " + channel_format + " \n" + \ " Source Id: " + source_id + " \n")
def run_events_sim(name="events_example"): info = StreamInfo( name=name, type="EEG", channel_count=1, channel_format="float32", source_id="myuid34234", ) # channels labels (in accordance with XDF format, see also # code.google.com/p/xdf) chns = info.desc().append_child("channels") for label in ["STIM"]: ch = chns.append_child("channel") ch.append_child_value("label", label) outlet = StreamOutlet(info) # send data and print some info every 5 sec while True: outlet.push_sample([42]) time.sleep(1) pass
def InitLslArduino(): name = 'HX711' type = 'ForceSensor' n_channels = 1 srate = 80 info = StreamInfo(name, type, n_channels, srate, 'float32', 'IntTrmr1001') # append some meta-data info.desc().append_child_value("manufacturer", "Arduino") channel_names = ['ForceSensor'] chns = info.desc().append_child("channels") for label in channel_names: ch = chns.append_child("channel") ch.append_child_value("label", label) ch.append_child_value("unit", "a.u.") ch.append_child_value("type", "Arduino") # next make an outlet; we set the transmission chunk size to 32 samples and # the outgoing buffer size to 360 seconds (max.) outlet = StreamOutlet(info, 80, 30) return outlet