<commit_before>"""This script receives raw EEG data from the muse and pushes it to an lsl outlet
Adapted from:

"""
from server import *
import time
from pylsl import StreamInfo, StreamOutlet

PORT = '1234'
info = StreamInfo('Muse', 'EEG', 4, 220, 'float32',
                  'MuseName')

info.desc().append_child_value("manufacturer", "Muse")
channels = info.desc().append_child("channels")

for c in ['TP9-l_ear', 'FP1-l_forehead', 'FP2-r_forehead', 'TP10-r_ear']:
    channels.append_child("channel") \
        .append_child_value("label", c) \
        .append_child_value("unit", "microvolts") \
        .append_child_value("type", "EEG")
# specify info, chunk size (each push yields one chunk), and maximum buffered data
outlet = StreamOutlet(info, 1, 360)


def process(data, timestamp, index):
    outlet.push_sample(data, timestamp)

    if index % 220 == 0:
        print('New Second! @', index, timestamp)


# connect to the server (move start and top to separate MUSE class later)
try:
    muse_server = PylibloServer(PORT, process)
except ServerError:
    muse_server = False

if muse_server:
    muse_server.start()<commit_msg>Added rteeg repo and and comment edits<commit_after>"""This script receives raw EEG data from the muse and pushes it to an lsl outlet
Adapted from:

"""
from server import *
import time
from pylsl import StreamInfo, StreamOutlet

PORT = '1234'
info = StreamInfo('Muse', 'EEG', 4, 220, 'float32',
                  'MuseName')

info.desc().append_child_value("manufacturer", "Muse")
channels = info.desc().append_child("channels")

for c in ['TP9-l_ear', 'FP1-l_forehead', 'FP2-r_forehead', 'TP10-r_ear']:
    channels.append_child("channel") \
        .append_child_value("label", c) \
        .append_child_value("unit", "microvolts") \
        .append_child_value("type", "EEG")
# specify info, chunk size (each push yields one chunk), and maximum buffered data
outlet = StreamOutlet(info, 1, 360)


def process(data, timestamp, index):
    outlet.push_sample(data, timestamp)

    # test for response
    if index % 220 == 0:
        print('New Second! @', index, timestamp)


# connect to the server
try:
    muse_server = PylibloServer(PORT, process)
except ServerError:
    muse_server = False

if muse_server:
    muse_server.start()
{'fraction_non_alphanumeric': 0.12582200789127576, 'fraction_numerical': 0.020166593599298552, 'mean_word_length': 3.982532751091703, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7383435', 'n_tokens_mistral': 794, 'n_tokens_neox': 731, 'n_words': 219}