polycortex / pymuse Goto Github PK
View Code? Open in Web Editor NEWPython tools associated with Muse headband
Home Page: http://polycortex.polymtl.ca/
License: MIT License
Python tools associated with Muse headband
Home Page: http://polycortex.polymtl.ca/
License: MIT License
To do: add save()
and load()
functions somewhere so we can save the data, replay them, or train a machine learning system offline.
pyMuse is not good anymore as we would like to support any input.
add the possibility to extract a window size of N for processing and at the end, extracting a window of N-m elements.
This would fix the edge effects of signal processing filters.
Event detection can be made by learning features based on a machine learning system.
We should add two steps:
Take inspiration from:
import sys;
sys.path.append('..') # help python find open_bci_v3.py relative to scripts folder
import open_bci_v3 as bci
import os
import logging
import time
import timeit
from threading import Thread
# counter for sampling rate
nb_samples_out = -1
# try to ease work for main loop
class Monitor(Thread):
def __init__(self):
Thread.__init__(self)
self.nb_samples_out = -1
# Init time to compute sampling rate
self.tick = timeit.default_timer()
self.start_tick = self.tick
self.polling_interval = 10
def run(self):
while True:
# check FPS + listen for new connections
new_tick = timeit.default_timer()
elapsed_time = new_tick - self.tick
current_samples_out = nb_samples_out
print "--- at t: ", (new_tick - self.start_tick), " ---"
print "elapsed_time: ", elapsed_time
print "nb_samples_out: ", current_samples_out - self.nb_samples_out
sampling_rate = (current_samples_out - self.nb_samples_out) / elapsed_time
print "sampling rate: ", sampling_rate
self.tick = new_tick
self.nb_samples_out = nb_samples_out
time.sleep(self.polling_interval)
tick = timeit.default_timer()
start_tick = tick
def printData(sample):
global tick, start_tick
# os.system('clear')
print "----------------"
print("%f" % (sample.id))
print sample.channel_data
print sample.aux_data
print "----------------"
new_tick = timeit.default_timer()
elapsed_time = new_tick - tick
current_samples_out = nb_samples_out
print "--- at t: ", (new_tick - start_tick), " ---"
print "elapsed_time: ", elapsed_time
print "nb_samples_out: ", current_samples_out - nb_samples_out
sampling_rate = (current_samples_out - nb_samples_out) / elapsed_time
print "sampling rate: ", sampling_rate
tick = new_tick
if __name__ == '__main__':
port = '/dev/tty.usbserial-DB00MF30'
# port = '/dev/tty.OpenBCI-DN0096XA'
baud = 115200
logging.basicConfig(filename="test.log", format='%(asctime)s - %(levelname)s : %(message)s', level=logging.DEBUG)
logging.info('---------LOG START-------------')
monit = Monitor()
# if len(self.args) > 0:
# monit.polling_interval = float(self.args[0])
# daemonize thread to terminate it altogether with the main when time will come
monit.daemon = True
monit.start()
board = bci.OpenBCIBoard(port=port, scaled_output=False, log=True)
print("Board Instantiated")
board.ser.write('v')
print 'Sample Rate: ', board.getSampleRate()
time.sleep(10)
tick = timeit.default_timer()
start_tick = tick
board.start_streaming(printData)
# board.print_bytes_in()
The visualization interface should be able to generate visual stimuli and coordinate with the analysis pipeline.
Typical use for the P300 project, the visualization window would contain several boxes with a letter or a drawing, flashing at different (or unique) frequencies. The flashing sequence should be transmitted to the analysis pipeline in order to train a event detection model, based on the P300 ERP phenomenon.
Related to issue #9.
Need to replace matplotlib dependency to something else. Options are:
Related to #19.
We should discuss the way to do it. That can be by UDP message transmission or something else.
It seems that matplotlib is not thread safe and nothing happens when plt.show() is called.
As multiple threads are created and many loops are running into the program, the program does not stop when calling a Keyboard interrupts.
It seems because of a change in how Bluetooth works, the Muse2016 can't pair with a MacBook/work with muse-io , am I right in asserting that?
eeg_display.py calls ViewerSignal, which does not exist anymore. Alternatives Viewer and RawViewer are not compatible with the call.
One way to do it would be to use scipy.signal library: http://docs.scipy.org/doc/scipy/reference/signal.html#filtering
This new process should be implemented in processes.py: https://github.com/PolyCortex/pyMuse/blob/master/pymuse/processes.py
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.