<commit_before>PyMetawear
==========

.. image:: https://travis-ci.org/hbldh/pymetawear.svg?branch=master
    :target: https://travis-ci.org/hbldh/pymetawear
.. image:: https://coveralls.io/repos/github/hbldh/pymetawear/badge.svg?branch=master
    :target: https://coveralls.io/github/hbldh/pymetawear?branch=master

Python package for connecting to and using `MbientLab's MetaWear <https://mbientlab.com/>`_ boards.

PyMetawear is meant to be a thin wrapper around the
`MetaWear C++ API <https://github.com/mbientlab/Metawear-CppAPI>`_,
providing a more Pythonic interface. It has support for using either
`pybluez <https://github.com/karulis/pybluez>`_ and
`gattlib <https://bitbucket.org/OscarAcena/pygattlib>`_ or
`pygatt <https://github.com/peplin/pygatt>`_ for
Bluetooth Low Energy communication.

PyMetaWear can be run with Python 2.7 with both backends, but only with the `pygatt` backend for Python 3.

    - PyMetaWear is currently a Linux only package!
    - PyMetaWear is only tested with Ubuntu 14.04+ and Linux Mint 17 as of yet!

Installation
------------

First, make sure all dependencies are installed:

.. code-block:: bash

    $ sudo apt-get install cmake build-essential python-dev bluetooth libbluetooth-dev libboost-python-dev libboost-thread-dev

PyMetaWear can be installed from pip:

.. code-block:: bash

    $ pip install git+git://github.com/hbldh/pymetawear.git

Development
~~~~~~~~~~~

Clone this repository and run

.. code-block:: bash

    $ python setup.py build

to pull in the `MetaWear C++ API <https://github.com/mbientlab/Metawear-CppAPI>`_ submodule,
build it and copy the Python wrappers from it to the PyMetaWear folder. This can also be achieved by
running

.. code-block:: bash

    $ pip install -e .

in the cloned repository's root folder.

Documentation
-------------

Available in the [Github pages](https://hbldh.github.io/pymetawear/)
of this repository.

Basic Usage
-----------

Currently, this MetaWear client is a pretty thin object, only
handling the Bluetooth connection and
actual communication and mostly being called indirectly
from the ``libmetawear`` C++ library.

.. code-block:: python

    from pymetawear.client import MetaWearClient
    backend = 'pybluez'  # Or 'pygatt'
    c = MetaWearClient('DD:3A:7D:4D:56:F0', backend)<commit_msg>Cherrypick README fro master branch<commit_after>PyMetawear
==========

.. image:: https://travis-ci.org/hbldh/pymetawear.svg?branch=master
    :target: https://travis-ci.org/hbldh/pymetawear
.. image:: https://coveralls.io/repos/github/hbldh/pymetawear/badge.svg?branch=master
    :target: https://coveralls.io/github/hbldh/pymetawear?branch=master

Python package for connecting to and using `MbientLab's MetaWear <https://mbientlab.com/>`_ boards.

PyMetawear is meant to be a thin wrapper around the
`MetaWear C++ API <https://github.com/mbientlab/Metawear-CppAPI>`_,
providing a more Pythonic interface. It has support for using either
`pybluez <https://github.com/karulis/pybluez>`_ and
`gattlib <https://bitbucket.org/OscarAcena/pygattlib>`_ or
`pygatt <https://github.com/peplin/pygatt>`_ for
Bluetooth Low Energy communication.

PyMetaWear can be run with Python 2.7 with both backends, but only with the `pygatt` backend for Python 3.

    - PyMetaWear is currently a Linux only package!
    - PyMetaWear is only tested with Ubuntu 14.04+ and Linux Mint 17 as of yet!

Installation
------------

First, make sure all dependencies are installed:

.. code-block:: bash

    $ sudo apt-get install cmake build-essential python-dev bluetooth libbluetooth-dev libboost-python-dev libboost-thread-dev

PyMetaWear can be installed from pip:

.. code-block:: bash

    $ pip install git+git://github.com/hbldh/pymetawear.git

Development
~~~~~~~~~~~

Clone this repository and run

.. code-block:: bash

    $ python setup.py build

to pull in the `MetaWear C++ API <https://github.com/mbientlab/Metawear-CppAPI>`_ submodule,
build it and copy the Python wrappers from it to the PyMetaWear folder. This can also be achieved by
running

.. code-block:: bash

    $ pip install -e .

in the cloned repository's root folder.

Documentation
-------------

Available in the `Github pages <https://hbldh.github.io/pymetawear/>`_
of this repository.

Basic Usage
-----------

Currently, this MetaWear client is a pretty thin object, only
handling the Bluetooth connection and
actual communication and mostly being called indirectly
from the ``libmetawear`` C++ library.

.. code-block:: python

    from pymetawear.client import MetaWearClient
    backend = 'pybluez'  # Or 'pygatt'
    c = MetaWearClient('DD:3A:7D:4D:56:F0', backend)
{'fraction_non_alphanumeric': 0.12295081967213115, 'fraction_numerical': 0.0064710957722174285, 'mean_word_length': 3.870798319327731, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 22, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4752865', 'n_tokens_mistral': 1583, 'n_tokens_neox': 1487, 'n_words': 466}