jadintredup / brainflow-notebooks Goto Github PK
View Code? Open in Web Editor NEWA remake of the NeurotechX EEG-Notebooks for the OpenBCI headset.
A remake of the NeurotechX EEG-Notebooks for the OpenBCI headset.
Currently the default behaviour is to assume that the serial port on windows is COM3
.
This was throwing a brainflow error
UNABLE_TO_OPEN_PORT_ERROR:2 ...
The error on my machine was due to the fact that the openbci cyton was actually streaming on COM5
( btw I was able to discover this using the OpenBCI GUI, which displayed the port being used )
This commit adds an optional input argument that 'manually overrides' the auto-detected serial port
Usage:
from eegnb.devices.eeg import EEG
thiseeg = EEG(device='cython', serial_port='COM5')
thiseeg.start(fn='thisoutfname.csv')
In the future we should add more automated functionality to figure out the correct channel and not have to have people add a manual override.
We also need to do some testing to find out what typical and atypical behaviour is here.
Hi Jadin, I tried the notebook and I was able to get the cyton board streaming to UART, however I have noticed the data is not saved properly at the end of the session from within Jupyter. I attach the error log here and a suggestion for improvement at the end
Cheers
Cris
setup:
-cloned the notebooks from Jadin (latest update pulled to my local repo: yesterday)
-connected cyton board and got the USB port number
-changed instruction 3 in N170 notebook to:
n170_exp.initialize_eeg(board_type='cyton',usb_port='/dev/cu.usbserial-DM00DS6T')
-ran succesfully N170 from the beginning until instruction 4:
subject_name = 'jadin_test'
duration = 10
trial_num = 3
n170_exp.run_trial(duration=duration,
subject=subject_name,
run=trial_num)
error log :
Beginning EEG Stream; Wait 5 seconds for signal to settle...
BrainFlowError Traceback (most recent call last)
in
2 duration = 10
3 trial_num = 3
----> 4 n170_exp.run_trial(duration=duration,
5 subject=subject_name,
6 run=trial_num)
~/git/brainflow-notebooks/experiments.py in run_trial(self, duration, subject, run)
239 data = self.board.get_board_data()
240 data_fn, event_fn = get_fns(subject, run, self.erp)
--> 241 DataFilter.write_file(data, data_fn, 'w')
242 self.mywin.close()
243 self.trials.to_csv(event_fn)
/opt/anaconda3/envs/bfnotebooks/lib/python3.8/site-packages/brainflow/data_filter.py in write_file(cls, data, file_name, file_mode)
515 res = DataHandlerDLL.get_instance ().write_file (data_flatten, data.shape[0], data.shape[1], file, mode)
516 if res != BrainflowExitCodes.STATUS_OK.value:
--> 517 raise BrainFlowError ('unable to write file', res)
518
519 @classmethod
BrainFlowError: GENERAL_ERROR:17 unable to write file
change suggestion
def get_fns(subject, run, paradigm):
data_fn = os.path.join('data', f'{subject}_{paradigm}_{run}.csv')
event_fn = os.path.join('data', f'{subject}_{paradigm}_{run}_EVENTS.csv')
becomes
def get_fns(subject, run, paradigm):
home = os.getenv("HOME")
if not os.path.isdir(os.path.join(home,'data')):
os.makedirs(os.path.join(home,'data'))
data_fn = os.path.join(home,'data', f'{subject}_{paradigm}_{run}.csv')
event_fn = os.path.join(home,'data', f'{subject}_{paradigm}_{run}_EVENTS.csv')
return data_fn, event_fn
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.