brainflow-dev / brainflow Goto Github PK
View Code? Open in Web Editor NEWBrainFlow is a library intended to obtain, parse and analyze EEG, EMG, ECG and other kinds of data from biosensors
Home Page: https://brainflow.org/
License: MIT License
BrainFlow is a library intended to obtain, parse and analyze EEG, EMG, ECG and other kinds of data from biosensors
Home Page: https://brainflow.org/
License: MIT License
Hi,
I want to make some changes in .java files in this directory:
https://github.com/brainflow-dev/brainflow/tree/master/java-package/brainflow/src/main/java/brainflow
then, how can I compile them and make .class files?
I use the command bellow in windows CMD, but its output has a lot of errors. I attached the picture of the errors in this question.
javac BoardShim.java
I just realized that on linux openmp linked dynamically, it means that this library should be installed on user's PC... It's not good for portability. Need to link statically or dont link at all.
For MSVC we dont have such issue because openmp is a part of MSVC runtime which we link statically.
On MacOS OpenMP is not preinstalled in CI, so provided libraries dont have such dependency.
Hi,
I just have a quick question about the difference between the two Java .jar files available. What is the difference between the one with and the one without dependencies?
Thanks
Good day.
I'm trying to build a kernel for MATLAB. The instructions for windows say: "Build it as a cmake project manually or use batch files from tools directory". Tell me, please, what should I collect: a release or the entire downloaded repository (containing the CMakeLists.txt file). It’s just that I just need to start the MATLAB scripts now. Also visual studio 2019: which commands for building a project should I run manually?
Best regards
I think we need to add instructions how to compile it and fix DllImport statements to load correct library.
IMO its not required to provide precompiled libraries for it but we can consider this option too
Good afternoon!
An example was launched with getting raw data from a SYNTHETIC_BOARD. In accordance with the documentation indicated Board Id: CYTON_DAISY_BOARD and BrainFlowInputParams.serial_port: COM3. Got an error (screen below). Tell me, please, how to fix it (perhaps somewhere there are examples not with a SYNTHETIC_BOARD)?
Best regards,
Dmitriy
When I run the code using synthetic board I get the following error :
Traceback (most recent call last):
File "band_power.py", line 7, in
from brainflow.data_filter import DataFilter, FilterTypes, AggOperations, WindowFunctions
ImportError: cannot import name 'WindowFunctions' from 'brainflow.data_filter' (C:\ProgramData\Anaconda3\lib\site-packages\brainflow\data_filter.py)
When streaming from the OpenBCI Cyton Daisy WiFi setup, I only get 8 channels of data (1-8). Channels 9-16 are all 0s. There was a similar issue in the OpenBCI GUI I reported (OpenBCI/OpenBCI_GUI#837). Here is the code I used to collect data:
import pandas as pd
from brainflow.board_shim import BoardShim, BrainFlowInputParams
params = BrainFlowInputParams()
# default IP when connecting to board directly
params.ip_address = '192.168.4.1'
params.ip_port = 6227 # random port that was available
board = BoardShim(6, params)
board.prepare_session()
board.start_stream()
# other code is in here for collecting data
time.sleep(3)
data = board.get_board_data() # get all data and remove it from internal buffer
board.stop_stream()
board.release_session()
df = pd.DataFrame(data.T)
df.drop([0] + list(range(20, 30)), inplace=True, axis=1)
df.to_csv('test_data.csv', index=False)
If you examine the channels 1-8, they are fine, but channels 9-16 are all 0s.
I was using version 3.4.1 on Ubuntu. I don't have the headset for a week or two so can't test the latest versions that were released, but it didn't look like anything was committed to the code that would fix this problem.
Hi, i just took an openbci helmet and i'm trying to use brainflow to connect with the dongle.
The problem is that when i try to connect i get the error: unable_to_open_port_error .
I'm on macOs 10.13.6 and I've already tried several things.
I tried to fix ftdi, the dongle is visible using the "ls -l / dev / tty *" command and also the openbci GUI connects without problems.
I think I miss something about the API but I can't understand what.
Any help is welcome
Hi, first of all i wanted to thanks for your work, for sharing and maintain all this amazing project, its been really helpful!, i´m trying to set up unreal engine 4.25 to work with brainflow, i'm decided to make a custom build including brainflow library via Nuget package, (since I'm quite noob , i don't know if this is the best way to approach this or maybe build them as a plugin modules?), so i build the editor, but i went i wanted to call some function, it cant find the module, i'm aware you already work with ue4 too, so i wanted to know a recommendation to go thru this, any light would be very helpful, im trying to use this using the emulator for testing a bci-cython board since right now i dont own one, (in there a way to integrate emulator in to unreal for testing?) thanks appreciated any help!
Its a duplicate for https://github.com/OpenBCI/brainflow/issues/153
GSON requires java.sql module specified in modue-info file, its simple to add it there but since users may be unaware of it we can consider moving to another json library which does not require such dependencies
Will there be methods useful in Neurofeedback designs, such as Phase, Coherence, Synchrony, etc.? These terms don't always have the same algorithm across different platforms so it might be a challenge to determine what algorithm(s) to include in BrainFlow.
In java9 modules were added, as of right now brainflow uses java 8 and has no modules. It makes it hard to use it in java 11 apps . At the same time we need to keep java 8 version for existing apps which do not support newer java versions.
We can add modules-info.java file for java > 8 and build 2 versions of java package in CI
Hi,
I am using a cyton + daisy serial setup and a custom java program. I am running into an issue where data only appears in the ring buffer in large chunks every half a second. Is there a way to get data to appear at the board's sampling rate of 125 Hz or every 8 milliseconds?
Thanks
BandPower calculation is wrong, it should be an integral instead average of Y values
I'm using a cyton+daisy+wifi board, and I have 31 rows of data when I collect data. The first column is 1.0 through 255.0, repeating. What is this supposed to be? It's not in any of the board info column numbers.
I have error during compilation the project...
Also, inside in jar file this dll is absent
Currently to get data between two events you need to add timestamps to these events and find data between these 2 timestamps. We can simplify this process:
We can add Marker channel to all boards and in user code during the streaming you will be able to write smth like:
board.add_marker(1)
# do smth
board.add_marker(1)
This method will set value for marker channel in next package.
Later in user API it will be possible to query epochs between two marker values.
Smth like
data = board.get_board_data()
marker_channel = BoardShim.get_marker_channel(board_id)
marker_value = 1
epochs = BoardShim.get_epochs(data, marker_channel, marker_value)
Travis changed their subscription plans and now they gonna charge for MacOS builds. For now we have smth like free tier with limited amount of runs. It will expire soon and we will not be able to use it wo payments.
Need to move to github actions as soon as possible. Its a showstopper.
More info about this change https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing
Email from travis support:
"Please note that we have now changed our subscription plans from Trials to Free Plan. This means your account has migrated to the new "Free Plan" usage on travis-ci.com. In addition, I confirm that this is only for the Free Plan, so no payment has been charged to your account.
If you received an email earlier stating you had 1000 credits, please disregard as you actually have 10,000 allotted."
Currently tests and builds are up and running again. Its not crucial issue.
In #131 we moved from travis to github actions and now we can build uniform solution for CI and move windows builds to github actions too
(tensorflow-gpu) D:\PycharmProjects\openbci\python_tests>python brainflow_get_data.py --ip-address 192.168.4.1 --board-id 5
Traceback (most recent call last):
File "brainflow_get_data.py", line 54, in
main ()
File "brainflow_get_data.py", line 39, in main
board.prepare_session ()
File "C:\Users\Administrator.conda\envs\tensorflow-gpu\lib\site-packages\brainflow\board_shim.py", line 722,
in prepare_session
raise BrainFlowError ('unable to prepare streaming session', res)
brainflow.board_shim.BrainFlowError: INVALID_ARGUMENTS_ERROR:13 unable to prepare streaming session
Good afternoon.
The instructions say "Add folders lib and inc to Matlab path". Only these directories are missing in brainflow / matlab-package / brainflow. And without their indication, an error occurs. Tell me, please, where are folders lib and inc located?
Parallel signal processing methods with primary focus on get_avg_band_powers
Existing filters should be renamed and plain filters wo smoothing should be added.
Instead adding new methods I think in terms of API it should look like new entries in Filter Enum
DSPFilters docs https://github.com/vinniefalco/DSPFilters/blob/master/shared/DSPFilters/source/Documentation.cpp
Example:
// now
f = new Dsp::SmoothedFilterDesign<Dsp::Butterworth::Design::BandPass<MAX_FILTER_ORDER>,
1, Dsp::DirectFormII> (1024);
// new
f = new Dsp::FilterDesign<Dsp::Butterworth::Design::BandPass<MAX_FILTER_ORDER>, 1> ();
Also need to check the difference between old and new filters(check fft plots visually, check how it affects concentration\relaxation calculation, etc)
hi, how can i get brainflow_get_data.py, previously in python-package/examples/ 3Q3Q
We can allow users to calculate their own metrics and run their own models via BrainFlow API.
To implement it we can use onnxruntime - https://github.com/microsoft/onnxruntime
We can not link it because it will limit supported platforms but probably we can load it manually in runtime
Dear Andrey,
I just found BrainFlow on GitHub and I think it is fantastic.
I run into problems: it crashes when it starts streaming.
I am a python user, Ubuntu 18.04, Python 3.8, Ganglion board with USB dongle BLED112.
brainflow==2.1.0
I am running the script from the code samples:
https://brainflow.readthedocs.io/en/stable/Examples.html#python-get-data-from-a-board
python main.py --board-id 1 --serial-port /dev/ttyACM0 --mac-address e0:06:15:36:28:44 --log
[2019-12-22 19:29:33.146] [brainflow_logger] [info] incomming json: {
"ip_address": "",
"ip_port": 0,
"ip_protocol": 0,
"mac_address": "e0:06:15:36:28:44",
"other_info": "",
"serial_port": "/dev/ttyACM0"
}
[2019-12-22 19:29:33.146] [brainflow_logger] [debug] ganglionlib initialized
[2019-12-22 19:29:33.146] [brainflow_logger] [info] search for e0:06:15:36:28:44
[2019-12-22 19:29:35.117] [brainflow_logger] [debug] use stub streamer
[2019-12-22 19:29:35.340] [brainflow_logger] [debug] start streaming
Segmentation fault (core dumped)
From: https://stackoverflow.com/questions/13654449/error-segmentation-fault-core-dumped
"Segmentation fault (core dumped)" is the string that Linux prints when a program exits with a SIGSEGV signal and you have core creation enabled. This means some program has crashed.
As you are getting this error from running Python, this means the Python interpreter has crashed. There are only a few reasons this can happen:
- You're using a third-party extension module written in C, and that extension module has crashed.
- You're (directly or indirectly) using the built-in module ctypes, and calling external code that crashes.
- There's something wrong with your Python installation.
- You've discovered a bug in Python that you should report.
I suppose we are in the first case.
Thanks in advice for your effort and time.
I wish you lovely holidays and a happy new year.
Kind Regards
Matteo Mazzanti
Hi there!
I'm having a great experience trying out brainflow with OpenBCI boards. Great framework!
So far, There's only one issue that I have come across. After trying out brainflow on a windows PC, I moved to using a raspberry pi 3. I did compile everything from the source & double checked everything I did with the brainflow documentation. my program is meant to work on a real-time system, so basically the streaming continues forever unless the user wants to stop it. if I use the 'get_board_data' routine, everything goes well for about a few seconds up to a minute, and then then I only see empty data, and the 'data_count' is indeed zero. if the 'get_current_board_data' routine is used, after a while the same data is emitted over and over (probably due to no new data entering the buffer).
I have tested this with OpnBCI cyton & ganglion with the wifishield.
This seems to be the case with both the python version and the C++ version of brainflow.
Hello! I tried several options for building the kernel ...
Dear Andrey,
I am having a problem:
brainflow.board_shim.BrainFlowError: GENERAL_ERROR:17 unable to stop streaming session.
Using the python script provided at:
https://brainflow.readthedocs.io/en/stable/Examples.html
Ubuntu v18.04
Python v3.8
Brainflow v2.1.3
OpenBCI Ganglion board
I am using:
board.start_stream ()
instead of:
board.start_stream (45000, args.streamer_params)
$ python main.py --board-id 1 --serial-port /dev/ttyACM0 --mac-address d2:e4:be:82:36:be --log
[2020-02-08 17:01:46.795] [brainflow_logger] [info] incomming json: {
"ip_address": "",
"ip_port": 0,
"ip_protocol": 0,
"mac_address": "d2:e4:be:82:36:be",
"other_info": "",
"serial_port": "/dev/ttyACM0"
}
[2020-02-08 17:01:46.795] [brainflow_logger] [debug] ganglionlib initialized
[2020-02-08 17:01:46.795] [brainflow_logger] [info] search for d2:e4:be:82:36:be
[2020-02-08 17:01:48.865] [brainflow_logger] [debug] use stub streamer
[2020-02-08 17:01:49.087] [brainflow_logger] [debug] start streaming
[2020-02-08 17:01:50.497] [brainflow_logger] [error] failed to stop streaming 13
Traceback (most recent call last):
File "main.py", line 56, in <module>
main ()
File "main.py", line 49, in main
board.stop_stream ()
File "/home/mrx/anaconda3/envs/OBCI_Brainflow_213/lib/python3.8/site-packages/brainflow/board_shim.py", line 741, in stop_stream
raise BrainFlowError ('unable to stop streaming session', res)
brainflow.board_shim.BrainFlowError: GENERAL_ERROR:17 unable to stop streaming session
Thanks in advice for your help.
/Matteo M.
Accord is not supported by it's author anymore, we can get rid of it and use plain arrays
Hi there,
Great project. Was looking to do some stuff with Brainflow and Machine Learning. Specifically, I'd like to accelerate the inferencing of the ML models with CUDA on an NVIDIA Jetson.
Willing to work with you guys on this. Assuming the models are pre-trained and exist in a common format, it should be straight-forward.
Any thoughts or information on the models as they stand?
Thanks for being awesome!
Currently signal processing algorithms work per channel and in user code need to write smth like
eeg_channels = BoardShim.get_eeg_channels (board_id)
for channel in eeg_channels:
DataFilter.perform_bandpass (data[channel], BoardShim.get_sampling_rate (board_id), 15.0, 6.0, 4, FilterTypes.BESSEL.value, 0)
Its fine but in some languages its hard to parallel such computations(scripting languages with GIL), even in languages with real multithreading support it requires efforts to parallel it.
We can redesign the API to work like
eeg_channels = BoardShim.get_eeg_channels (board_id)
DataFilter.perform_bandpass (data, eeg_channels, BoardShim.get_sampling_rate (board_id), 15.0, 6.0, 4, FilterTypes.BESSEL.value, 0)
And parallel calculations like we do for get_avg_band_powers
Performance drawback - will need to convert 2d array to 1d array each time to pass it to low-level API. But it still should be much faster than single threaded code specially for large arrays.
Questions:
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.