PhoneSensors
phonesensors is a Python package to aid with receiving various sensor data from phones in a quick and easy way. It is
meant to be used in conjunction with the
SensorStreamer
app for Android devices, but support for any other app streaming sensor data over a TCP socket can be implemented
with ease by subclassing the BaseParser in parsers.py.
How to install
pip install phonesensors
How to use
Open the SensorStreamer app and make it a TCP server emitting JSON packets on a port of your choice. Port 5000 is used for this example. Find out the IP address of your device (e.g. 192.168.1.1). The following code snippet will print the sensor data being streamed from your device:
from phonesensors import SensorStreamerClient, Apps
with SensorStreamerClient("192.168.1.1", 5000, Apps.SENSORSTREAMER) as client:
for data in client:
print(data)
Data format
data in the above example code snippet is a SensorDataCollection instance. You can obtain the specific sensor data
by accessing its attributes. The sensor data and timestamps are returned as numpy arrays:
acceleration_values = packet.acc.values
acceleration_timestamps = packet.acc.timestamps
proximity_values = packet.prox.values
proximity_timestamps = packet.prox.timestamps
Data from different sources may have different number of elements due to differences in sampling frequency. For example,
acceleration_values, a 3D vector, may have 4 samples and thus be a (4,3) array. While proximity_values, a 1D scalar,
may only have one sample and thus be a (1,) array.
Metadata
Release files for phonesensors 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| phonesensors-1.0.0.tar.gz | 9.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| phonesensors-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.9 kB
Release files / phonesensors-1.0.0.tar.gz
| Download URL | phonesensors-1.0.0.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c06899fd77ec92cbc40b6a561d0f6f66032892358126304b86dff85edcae595
|
|
BLAKE2b-256 checksum How to use checksums |
c0ee2a6c51357a14bd7841509ddd7463bdc209ebfae09236dc82dc8fb1831b25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.3
|
Release files / phonesensors-1.0.0-py3-none-any.whl
| Download URL | phonesensors-1.0.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2dc2319e361e7a95a38ce0841a878349db3d40bac9b3beef276737903cf97fb
|
|
BLAKE2b-256 checksum How to use checksums |
883d0ed81c86187fe53343ced9170b101b696e0a475c9822e85c59b75821b4b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.3
|