Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ addons:
install:
# Install project requirements
- pip install -r requirements.txt
# Install BluePy for Ganglion because Travis runs Linux
- pip install bluepy
# Install test and coverage requirements
- pip install codecov mock nose coverage
- pip install codecov mock nose coverage pylint

# Run tests
script:
- python setup.py install
- nosetests --with-coverage --cover-package=openbci
after_success:
- codecov
- pylint openbci
57 changes: 30 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,21 @@ NOTE: For comprehensive list see requirments.txt: (https://github.com/OpenBCI/Op

OpenBCI 8 and 32 bit board with 8 or 16 channels.

This library includes the main open_bci_v3 class definition that instantiates an OpenBCI Board object. This object will initialize communication with the board and get the environment ready for data streaming. This library is designed to work with iOS and Linux distributions. To use a Windows OS, change the __init__ function in open_bci_v3.py to establish a serial connection in Windows.
This library includes the OpenBCICyton and OpenBCIGanglion classes which are drivers for their respective devices. The OpenBCICyton class is designed to work on all systems, while the OpenBCIGanglion class relies on a Bluetooth driver that is only available on Linux, discussed in the next section.

For additional details on connecting your Cyton board visit: http://docs.openbci.com/Hardware/02-Cyton

### Ganglion Board

The Ganglion board relies on Bluetooth Low Energy connectivity (BLE).
The Ganglion board relies on Bluetooth Low Energy connectivity (BLE), and our code relies on the BluePy library to communicate with it. The BluePy library currently only works on Linux-based operating systems. To use Ganglion you will need to install it:

You may need to alter the settings of your bluetooth adapter in order to reduce latency and avoid packet drops -- e.g. if the terminal spams "Warning: Dropped 1 packets" several times a seconds, DO THAT.
`pip install bluepy`

On linux, assuming `hci0` is the name of your bluetooth adapter:
You may be able to use the Ganglion board from a virtual machine (VM) running Linux on other operating systems, such as MacOS or Windows. See [this thread](https://github.com/OpenBCI/OpenBCI_Python/issues/68) for advice.

You may need to alter the settings of your Bluetooth adapter in order to reduce latency and avoid packet drops -- e.g. if the terminal spams "Warning: Dropped 1 packets" several times a seconds, DO THAT.

On Linux, assuming `hci0` is the name of your bluetooth adapter:

`sudo bash -c 'echo 9 > /sys/kernel/debug/bluetooth/hci0/conn_min_interval'`

Expand Down Expand Up @@ -253,7 +257,6 @@ Warning: Connecting pins to high frequency 2x amp signal
--> a
Corresponding SD file OBCI_18.TXT$$$
--> /start T:3

```

NOTES:
Expand Down Expand Up @@ -296,37 +299,37 @@ Note: type `/start` to launch the selected plugins.
Add new functionalities to user.py by creating new scripts inside the `plugins` folder. You class must inherit from yapsy.IPlugin, see below a minimal example with `print` plugin:

```python
import plugin_interface as plugintypes
import plugin_interface as plugintypes

class PluginPrint(plugintypes.IPluginExtended):
def activate(self):
print "Print activated"
class PluginPrint(plugintypes.IPluginExtended):
def activate(self):
print("Print activated")

def deactivate(self):
print "Goodbye"
def deactivate(self):
print("Goodbye")

def show_help(self):
print "I do not need any parameter, just printing stuff."
def show_help(self):
print("I do not need any parameter, just printing stuff.")

# called with each new sample
def __call__(self, sample):
print "----------------"
print("%f" %(sample.id))
print sample.channel_data
print sample.aux_data
# called with each new sample
def __call__(self, sample):
print("----------------")
print("%f" % sample.id)
print(sample.channel_data)
print(sample.aux_data)
```

Describe your plugin with a corresponding `print.yapsy-plugin`:

```
[Core]
Name = print
Module = print

[Documentation]
Author = Various
Version = 0.1
Description = Print board values on stdout
[Core]
Name = print
Module = print

[Documentation]
Author = Various
Version = 0.1
Description = Print board values on stdout
```


Expand Down
3 changes: 3 additions & 0 deletions externals/mne_openbci.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# License: BSD (3-clause)

import warnings

np = None
try:
import numpy as np
Expand All @@ -18,6 +19,7 @@
except ImportError:
raise ImportError('MNE is needed to use function.')


class RawOpenBCI(_BaseRaw):
"""Raw object from OpenBCI file

Expand Down Expand Up @@ -59,6 +61,7 @@ class RawOpenBCI(_BaseRaw):
--------
mne.io.Raw : Documentation of attribute and methods.
"""

@verbose
def __init__(self, input_fname, montage=None, eog=None,
misc=(-3, -2, -1), stim_channel=None, scale=1e-6, sfreq=250,
Expand Down
7 changes: 2 additions & 5 deletions openbci/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

from .cyton import OpenBCICyton
from .ganglion import OpenBCIGanglion
from .plugins import *
from .utils import *
from .wifi import OpenBCIWiFi


__version__ = "1.0.0"
if sys.platform.startswith("linux"):
from .ganglion import OpenBCIGanglion
Loading