def museAgent(self, settings): self._message("Muse starting") muse = Muse(self.config.get('settings', 'api_config')) while True and not self.shouldThreadQuit: queries = muse.getQueries(self.config.get('feeds', 'urls').split(',')) for q in queries: if self.shouldThreadQuit: break urls = muse.search(q, 6) throttle = 0 for u in urls: if self.shouldThreadQuit: break try: self._message('Muse beginning download.') muse.download(u) self._message('Muse going to sleep.') time.sleep(60*60) # I think this should only block Muse agent, but it might block the whole process on device. except Exception as e: self._message('Problem downloading something') self._message("Muse terminated") return
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
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
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:
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)
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')
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, backend=options.backend, time_func=local_clock, interface=options.interface, name=options.name) muse.connect() print('Connected') muse.start() print('Streaming') while 1: try: sleep(1) except: break muse.stop() muse.disconnect()
def muse(): return Muse()
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()
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:
(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
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
from datetime import datetime, timedelta from muse import Muse from pymongo import MongoClient from pprint import pprint import collections import time import sys import os from apscheduler.schedulers.background import BackgroundScheduler muse = Muse(node=os.environ['steemnode']) rpc = muse.rpc mongo = MongoClient("mongodb://mongo") db = mongo.musedb # mvest_per_account = {} # def load_accounts(): # pprint("[MUSE] - Loading mvest per account") # for account in db.account.find(): # if "name" in account.keys(): # mvest_per_account.update({account['name']: account['vesting_shares']}) def update_props_history(): pprint("[MUSE] - Update Global Properties") props = rpc.get_dynamic_global_properties() for key in [ 'confidential_mbd_supply', 'confidential_supply',
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 = {
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
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")