Skip to content

Commit

Permalink
Documentation update.
Browse files Browse the repository at this point in the history
Moved some logging details to module level in docs.
Added missing Ambient light documentation.
  • Loading branch information
hbldh committed Jun 18, 2018
1 parent 95353b8 commit 5668a99
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 20 deletions.
20 changes: 1 addition & 19 deletions docs/source/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,7 @@ The MetaWear client provided by this package. It can be used as such:
from pymetawear.client import MetaWearClient
c = MetaWearClient('DD:3A:7D:4D:56:F0')
The client can now be used for either reading the current module data or activate some functionality in it.
There are two major modalities for obtaining data from sensors: subscribing to data from it or logging the data
to the MetaWear board for subsequent download.

Streaming data
--------------

Streaming the data is a method of data extraction that is preferable if you have a need of the data in real-time,
e.g. for IMU navigation. It sends a epoch time tagged dictionary to a callback function specified by you, to process
as you see fit.

Streaming is also the only option that allows for access to high frequency (>400 Hz) data for accelerometer and gyroscope.

Logging data
------------

If you are not dependent on having data delivered continuously but rather just need it saved for analysis later on, then
logging it to the board is a better choice. It reduces the potential for BLE disconnections during data recording, making
it a more stable means of ensuring that data is actually collected.
The client can now be used for either reading the current module data or activating some functionality in it.

API
---
Expand Down
39 changes: 39 additions & 0 deletions docs/source/modules/ambientlight.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.. _modules_accelerometer:

Ambient light module
====================

The PyMetaWear implementation of the ``libmetawear``
ambient light module.

It is initialized at the creation of the :py:class:`~MetaWearClient`
client and can then be accessed in the ``ambient_light``
attribute of the client.

Data streaming example
----------------------

If you need a real time stream of sensor data, use the :py:method:`notifications` method on the :py:mod:`ambient_light` module:

.. code-block:: python
from pymetawear.client import MetaWearClient
c = MetaWearClient('DD:3A:7D:4D:56:F0')
print("Write ambient light settings...")
c.ambient_light.set_settings(gain=4, integration_time=200, measurement_rate=200)
def ambient_light_callback(data):
"""Handle a (epoch, data) ambient light data tuple."""
print("Epoch time: [{0}] Data: {1}".format(data[0], data[1]))
# Enable notifications and register a callback for them.
c.ambient_light.notifications(ambient_light_callback)
API
---

.. automodule:: pymetawear.modules.ambientlight
:members:
43 changes: 43 additions & 0 deletions docs/source/modules/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,51 @@ MetaWear modules
magnetometer
barometer
led
ambientlight
settings
haptic
switch
temperature
sensor_fusion


There are two major modalities for obtaining data from sensors: subscribing to data from it or logging the data
to the MetaWear board for subsequent download.

Streaming data
--------------

Streaming the data is a method of data extraction that is preferable if you have a need of the data in real-time,
e.g. for IMU navigation. It sends a epoch time tagged dictionary to a callback function specified by you, to process
as you see fit.

Streaming is also the only option that allows for access to high frequency (>400 Hz) data for accelerometer and gyroscope.

Modules supporting continuous data streaming:

- :py:mod:`accelerometer`
- :py:mod:`gyroscope`
- :py:mod:`magnetometer`
- :py:mod:`barometer`
- :py:mod:`switch`
- :py:mod:`ambientlight`
- :py:mod:`sensor_fusion`

Modules supporting notification protocol, but notifications are received by manually triggering them:

- :py:mod:`temperature`
- :py:mod:`settings` (battery)

Logging data
------------

If you are not dependent on having data delivered continuously but rather just need it saved for analysis later on, then
logging it to the board is a better choice. It reduces the potential for BLE disconnections during data recording, making
it a more stable means of ensuring that data is actually collected.

Modules supporting logging data (at least with PyMetaWear implementation):

- :py:mod:`accelerometer`
- :py:mod:`gyroscope`
- :py:mod:`magnetometer`
- :py:mod:`sensor_fusion`
2 changes: 1 addition & 1 deletion pymetawear/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import logging

from mbientlab.metawear import MetaWear, libmetawear
# Temporary for money patch
# Temporary for monkey patch
from mbientlab.metawear.cbindings import FnVoid_VoidP_Int, Const
from mbientlab.metawear import Event

Expand Down

0 comments on commit 5668a99

Please sign in to comment.