Skip to main content

Feature extraction from mobile phone motion sensor data

Project description

TiltX

Feature extraction from mobile phone motion sensor data

This repository implements a method which extracts some of the key features from mobile phone motion sensor data.

At t=0 a visual stimulus appears on the screen. As the response, a participant (person holding the phone) is required to tilt the phone in a specific direction (left, right, up, or down). Once the roll or picth angle reaches 0.5 radians (t=T>0), the movement is completed. T is the event time registered by the app. The rotaion along the third axis (yaw) does not affect the outcome of the task, hence it is neglected.

The features extracted by TiltX are: reaction time, L1 norms, maximal deviation, number of turning points, and sample entropy.

Usage

These steps introduce how to use TiltX.

Input data

The DataGenerator is a utility class that generates sample datasets.

from tiltx.data_generator import DataGenerator
t, alpha, beta = DataGenerator.example(1)

Note: t, alpha, and beta need to be equal length arrays.

Extract features

The FeatureExtractor extracts key features from the data.

from tiltx.feature_extractor import FeatureExtractor
features = FeatureExtractor(t,alpha,beta,RT_method='cumsum',correct='up')

Note: cumsum is a method for reaction time detection and correct is the direction in which the phone should be tilted in order to successfully complete the task.

print('Reaction time: %.3f'%(features.RT))
print('L1-norm of the triggering axis: %.3f'%(features.L1_x))
print('L1-norm of the remaining (non-triggering) axis: %.3f'%(features.L1_y))

Reaction time: 0.669
L1-norm of the triggering axis: 0.492
L1-norm of the remaining (non-triggering) axis: 0.006

Visualize

By calling plot() function in FeatureExtractor, we plot the roll and pitch angles from the moment the stimulus appears till the moment when the app registers the move as completed.

features.plot()

  • x is a triggering angle (the one which reaches 0.5 radians first)
  • y is the remaining (non-triggering) angle
  • the shaded regions are proportional to L1 norms
  • the black dotted line marks the begining of the reaction

Documentation

For a tutorial and a brief note on signal features, check out the notebooks folder.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tiltx-0.0.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tiltx-0.0.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file tiltx-0.0.1.tar.gz.

File metadata

  • Download URL: tiltx-0.0.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.5

File hashes

Hashes for tiltx-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8b9555560f1c76b2528b45b3c9df9ba3802ac4dbc43bb3993cfe1824d1b04f19
MD5 5848bbd14e496563b0d165233fd25ee2
BLAKE2b-256 015bbe2eaaf89eb315760624976b29e5c9f1c99e23aaf939713962845460aba9

See more details on using hashes here.

File details

Details for the file tiltx-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tiltx-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.5

File hashes

Hashes for tiltx-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5de6fee71444bd229fd4aca5b20c7f76cbbb2acd41bb28d9458e2ad09dbdc7b8
MD5 b6fe2e8c17760549b3422279425800bb
BLAKE2b-256 398aca36487f44e61193a3120d2993380d3935629c82e32732d3ad5f7531baa2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page