예제 #1
0
def connect_muse(address, device_type, host, port):
    muse = Muse(address=address,
                device_type=device_type,
                host=host,
                port=port,
                backend=backend,
                interface=None)
    muse.connect()
    print("muse connected %s" % (address))
    muse.start()
    print("muse streaming from %s" % (address))
    return muse
예제 #2
0
                  type='string',
                  default="00:55:DA:B0:06:D6",
                  help="device mac address.")

(options, args) = parser.parse_args()

full_time = []
full_data = []


def process(data, timestamps):
    full_time.append(timestamps)
    full_data.append(data)


muse = Muse(options.address, process)

muse.connect()
muse.start()

while 1:
    try:
        sleep(1)
    except:
        break

muse.stop()
muse.disconnect()

full_time = np.concatenate(full_time)
full_data = np.concatenate(full_data, 1).T
예제 #3
0
for c in ['TP9', 'AF7', 'AF8', 'TP10', 'Right AUX']:
    channels.append_child("channel") \
        .append_child_value("label", c) \
        .append_child_value("unit", "microvolts") \
        .append_child_value("type", "EEG")
outlet = StreamOutlet(info, 12, 360)


def process(data, timestamps):
    for ii in range(12):
        outlet.push_sample(data[:, ii], timestamps[ii])


muse = Muse(address=options.address,
            callback_eeg=process,
            backend=options.backend,
            time_func=local_clock,
            interface=options.interface,
            name=options.name)

muse.connect()
print('Connected')
stop_eeg = [0]
np.savetxt("/home/pi/Experiments/Auditory_Bird_Oddball/Stop_EEG1.csv",
           (stop_eeg),
           delimiter=',',
           fmt="%s")
muse.start()
print('Streaming')

while os.path.isfile(
        "/home/pi/Experiments/Auditory_Bird_Oddball/Stop_EEG1.csv") == True:
예제 #4
0

def findMuse():
        scanner = Scanner()
        devices = scanner.scan(10.0)

        for dev in devices:
            # print("Device {} ({}), RSSI={} dB".format(dev.addr, dev.addrType, dev.rssi))
            for (adtype, desc, value) in dev.getScanData():
                if ("Muse" in value) or ("muse" in value):
                    return dev.addr  # returns the mac address of the first muse found
                # if no muse found
                print("No Muses found!")

#Iniciamos Clase Muse
muse = Muse(address="00:55:da:b5:0d:79",callback=eeg)
#muse = Muse(address="00:55:DA:B7:0B:E9",eeg=True,callback=eeg,accelero=False,giro=False)
#muse = Muse(address="00:06:66:6C:05:91", eeg=True, callback=eeg, accelero=False, giro=False)


def runListener():
    try:
        print("Connecting to Muse ...")
        muse.connect()
        print("Muse connected")

        muse.start()
        print("Starting streaming")

        while True:
            time.sleep(1)
예제 #5
0
파일: muse-lsl.py 프로젝트: k1sauce/muse
info.desc().append_child_value("manufacturer", "Muse")
channels = info.desc().append_child("channels")

for c in ['TP9', 'AF7', 'AF8', 'TP10', 'Right AUX']:
    channels.append_child("channel") \
        .append_child_value("label", c) \
        .append_child_value("unit", "microvolts") \
        .append_child_value("type", "EEG")
outlet = StreamOutlet(info, 12, 360)


def process(data, timestamps):
    for ii in range(12):
        outlet.push_sample(data[:, ii], timestamps[ii])

muse = Muse(address=options.address, callback=process)

muse.connect()
print('Connected')
muse.start()
print('Streaming')

while 1:
    try:
        sleep(1)
    except:
        break

muse.stop()
muse.disconnect()
print('Disonnected')
예제 #6
0
def muse():
    return Muse()
예제 #7
0
for c in ['TP9', 'AF7', 'AF8', 'TP10', 'Right AUX']:
    channels.append_child("channel") \
        .append_child_value("label", c) \
        .append_child_value("unit", "microvolts") \
        .append_child_value("type", "EEG")
outlet = StreamOutlet(info, 12, 360)


def process(data, timestamps):
    for ii in range(12):
        outlet.push_sample(data[:, ii], timestamps[ii])


muse = Muse(address=options.address,
            callback=process,
            backend=options.backend,
            time_func=local_clock,
            interface='/dev/ttyACM0')

muse.connect()
print('Connected')
muse.start()
print('Streaming')

while 1:
    try:
        sleep(1)
    except:
        break

muse.stop()
예제 #8
0
import sys
sys.path.append('./peerplays/peerplays')
sys.path.append('./peerplays')

from datetime import datetime, timedelta
from muse import Muse
from pymongo import MongoClient
from pprint import pprint
import collections
import json
import time
import os


muse = Muse(node=os.environ['steemnode'])
rpc = muse.rpc

mongo = MongoClient("mongodb://mongo:27017")
db = mongo.musedb

init = db.status.find_one({'_id': 'height'})
if(init):
  last_block = init['value']
else:
  last_block = 1

cache_witnesses_ids = {}
cache_witnesses_names = {}

# ------------
# For development:
예제 #9
0
(options, args) = parser.parse_args()

countACC = 0


def process():
    global now
    global countACC
    now = time.time()
    countACC += 1.0


muse = Muse(address=options.address,
            device_type=options.device_type,
            host=options.host,
            port=options.port,
            callback=process,
            backend=options.backend,
            interface=None)

muse.connect()
print('Connected')
muse.start()
print('Streaming')
idx = 0
losshist = [0 for i in range(10)]
while 1:
    try:
        sleep(1)
        dataloss = max(0.0, 100.0 - countACC * 3 / 50 * 100.0)
        losshist[idx] = dataloss
예제 #10
0
                  type='string',
                  default=None,
                  help="name of the device.")

(options, args) = parser.parse_args()

full_time = []
full_data = []


def process(data, timestamps):
    full_time.append(timestamps)
    full_data.append(data)


muse = Muse(address=options.address, callback_eeg=process, name=options.name)

muse.connect()
muse.start()

while 1:
    try:
        sleep(1)
    except:
        break

muse.stop()
muse.disconnect()

full_time = np.concatenate(full_time)
full_data = np.concatenate(full_data, 1).T
예제 #11
0
from datetime import datetime
from muse import Muse
from pymongo import MongoClient
from pprint import pprint
from time import gmtime, strftime
from apscheduler.schedulers.background import BackgroundScheduler
import collections
import time
import sys
import os

dct = Muse(node='ws://muse.peerplaysdb.com')
rpc = dct.rpc

# mongo = MongoClient("mongodb://mongo")
# db = mongo.peerplaysdb

# misses = {}

# Command to check how many blocks a witness has missed
# def check_misses():
#     global misses
#     witnesses = rpc.get_witnesses_by_vote('', 100)
#     for witness in witnesses:
#         owner = str(witness['owner'])
#         # Check if we have a status on the current witness
#         if owner in misses.keys():
#             # Has the count increased?
#             if witness['total_missed'] > misses[owner]:
#                 # Update the misses collection
#                 record = {
예제 #12
0
device_type = "muse"

countACC = 0


def process():
    global now
    global countACC
    now = time.time()
    countACC += 1.0


muse = Muse(address=address,
            device_type=device_type,
            host=host,
            port=port,
            callback=process,
            backend=backend,
            interface=None)

muse.connect()
print('Connected')
muse.start()
print('Streaming')
idx = 0
losshist = [0 for i in range(10)]
while 1:
    try:
        time.sleep(1)
        dataloss = max(0.0, 100.0 - countACC * 3 / 50 * 100.0)
        losshist[idx] = dataloss
예제 #13
0
파일: spitData.py 프로젝트: imbi7py/Amuse
    scanner = Scanner()
    devices = scanner.scan(10.0)

    for dev in devices:
        # print("Device {} ({}), RSSI={} dB".format(dev.addr, dev.addrType, dev.rssi))
        for (adtype, desc, value) in dev.getScanData():
            if ("Muse" in value) or ("muse" in value):
                return dev.addr  # returns the mac address of the first muse found
            # if no muse found
            print("No Muses found!")


#Iniciamos Clase Muse
muse = Muse(address=findMuse(),
            eeg=True,
            callback=eeg,
            accelero=False,
            giro=False)
#muse = Muse(address="00:55:DA:B7:0B:E9",eeg=True,callback=eeg,accelero=False,giro=False)
#muse = Muse(address="00:06:66:6C:05:91", eeg=True, callback=eeg, accelero=False, giro=False)


def runListener():
    try:
        print("Connecting to Muse ...")
        muse.connect()
        print("Muse connected")

        muse.start()
        print("Starting streaming")